aeternity / elixir-merkle-patricia-tree

Elixir implementation of modified Merkle Patricia tree (trie)
MIT License
10 stars 6 forks source link

Test failed (Ethereum Common Tests, root hash) #10

Open cytadela8 opened 6 years ago

cytadela8 commented 6 years ago

Found by @grzegorz225

1) test Ethereum Common Tests (MerklePatriciaTreeTest)
     test/merkle_patricia_tree_test.exs:11
     Assertion with == failed
     code:  assert trie.root_hash() == test["root"] |> hex_to_binary
     left:  <<29, 106, 144, 207, 179, 208, 47, 233, 11, 118, 195, 7, 121, 115,
              10, 90, 195, 211, 88, 113, 206, 45, 251, 7, 107, 129, 67, 190, 5,
              54, 237, 167>>
     right: <<138, 173, 120, 157, 255, 47, 83, 139, 202, 93, 142, 165, 110, 138,
              190, 16, 244, 199, 186, 58, 93, 234, 149, 254, 164, 205, 110, 124,
              58, 17, 104, 211>>
     stacktrace:
       test/merkle_patricia_tree_test.exs:33: anonymous fn/3 in MerklePatriciaTreeTest."test Ethereum Common Tests"/1
       (stdlib) lists.erl:1263: :lists.foldl/3
       test/merkle_patricia_tree_test.exs:13: anonymous fn/2 in MerklePatriciaTreeTest."test Ethereum Common Tests"/1
       (stdlib) lists.erl:1263: :lists.foldl/3
       test/merkle_patricia_tree_test.exs:12: (test)
cytadela8 commented 6 years ago

Steps to reproduce:

# Download repo with submodule
mix deps.get
mix test
cytadela8 commented 6 years ago

Note: running mix deps.get gives following diff, becouse mix.deps doesn't reflect mix.exs:

-  "enacl": {:git, "https://github.com/jlouis/enacl.git", "c8403ab198b80863479c2ab5a9ccd0a8d73a57c4", [ref: "c8403ab"]},
+  "enacl": {:git, "https://github.com/aeternity/enacl.git", "2f50ba6289f2f2d9fef05d22a396c0bab4f64149", [ref: "2f50ba6"]},
cytadela8 commented 6 years ago

Part of reason this test fails is that Ethereum tests we include use different hash function. We should test this code with original hash function or regenerate test outputs with Epoch library.