Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify tree.Hash / Skipped test TestProof #50

Closed
liamsi opened this issue May 3, 2018 · 3 comments
Closed

Clarify tree.Hash / Skipped test TestProof #50

liamsi opened this issue May 3, 2018 · 3 comments
Assignees

Comments

@liamsi
Copy link
Contributor

liamsi commented May 3, 2018

Find out why TestProof fails (tree root never seems to match here).
It's not clear why this is a race-condition. Either 1) fix test, 2) clarify why it is skipped, or 3) remove test (only if the test does not make sense).

https://github.com/tendermint/iavl/blob/35f66e53d9b01e83b30de68b931f54b2477a94c9/basic_test.go#L392-L422

@liamsi liamsi self-assigned this May 3, 2018
@liamsi
Copy link
Contributor Author

liamsi commented May 3, 2018

This is what I think the problem is:

While tree.Iterate is called with tree.Hash() as the root hash, tree.Hash() is called on the latest versioned tree (the persisted tree, see here).
tree.Iterate(...) on the other side operates on the whole tree (incl. the non-persisted / orphaned nodes); see here

The test passes again if:

===================================================================
--- basic_test.go	(revision fd37a0fa3a7454423233bc3d5ea828f38e0af787)
+++ basic_test.go	(date 1525356743000)
@@ -387,7 +387,7 @@
 }
 
 func TestProof(t *testing.T) {
-	t.Skipf("This test has a race condition causing it to occasionally panic.")
+	//t.Skipf("This test has a race condition causing it to occasionally panic.")
 
 	// Construct some random tree
 	db := db.NewMemDB()
@@ -412,7 +412,7 @@
 		assert.NoError(t, err)
 		assert.Equal(t, value, value2)
 		if assert.NotNil(t, proof) {
-			testProof(t, proof.(*KeyExistsProof), key, value, tree.Hash())
+			testProof(t, proof.(*KeyExistsProof), key, value, tree.orphaningTree.Hash())
 		}
 		return false
 	})

Looks like there should be 2 VersionedTree.Hash() methods (one with orphans and one without), or, there should be a VersionedTree.Iterate which ignores the orphaned nodes (like Hash() does), too.

What should be the intended behaviour here? @jaekwon @ebuchman

@liamsi liamsi added the question label May 3, 2018
@liamsi liamsi changed the title Skipped test TestProof Clarify tree.Hash / Skipped test TestProof Jun 20, 2018
@liamsi
Copy link
Contributor Author

liamsi commented Jun 20, 2018

After discussing with @jlandrews, will open a PR with the above changes which will fix the test.

ridenaio pushed a commit to idena-network/iavl that referenced this issue Jul 1, 2019
iavl: skip TestIAVLTreeFdump since internal code is buggy
@tac0turtle
Copy link
Member

resolved in #92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants