aeternity / elixir-merkle-patricia-tree Goto Github PK
View Code? Open in Web Editor NEWThis project forked from exthereum/merkle_patricia_tree
Elixir implementation of modified Merkle Patricia tree (trie)
License: MIT License
This project forked from exthereum/merkle_patricia_tree
Elixir implementation of modified Merkle Patricia tree (trie)
License: MIT License
Readme should reflect that this repo is not Ethereum compatible and is for Aeternity blockchain. (We changed hash and maybe something else)
Also the Installation section should be adjusted.
In order for elixir-node to sync with epoch 0.16 we need to implement lookup's in proofs as this is necessary to implement the POI's used by epoch.
The proof verification logic does not check whether the hashes are correct - It is trivial to fake a proof. I added a test demonstrating this to the GH-9 branch.
Failing test on the GH-9 branch:
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)
Root hash is wrong when we update a key when there exists a longer key:
Steps to reproduce:
db = MerklePatriciaTree.DB.ETS.random_ets_db()
trie1 = Trie.new(db)
trie2 = Trie.new(db)
trie1 = Trie.update(trie1, "key", "oldvalue")
trie1 = Trie.update(trie1, "key_loner", "loner_key_value")
trie1 = Trie.update(trie1, "key", "newvalue")
trie2 = Trie.update(trie2, "key", "newvalue")
trie2 = Trie.update(trie2, "key_loner", "loner_key_value")
trie1.root_hash == trie2.root_hash
Result: false
Expected result: true
I added a test that fails.
Note: Ethereum tests also fail - #10
Feeding decode_node
function with wrong parameters order
Implement a wrapper(or functions) for efficient manipulation of a particular sub-tree of the merkle patricia trie.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.