Closed code-monad closed 1 year ago
This PR brings a new implementation for SparseMerkleTree (check trie_tree.rs), typically called TrieTree, which is:
SparseMerkleTree
MerkleProof
Compiled MerkleProof
Reference
Here's some bench data with rw operations counters This can reproduced by the benchmark : benches/store_counter_benchmark.rs with command: cargo bench --features trie -- --test and cargo bench -- --test
cargo bench --features trie -- --test
cargo bench -- --test
cargo bench --features trie -- --test #... random update 100 keys, store counters: Counters { get_branch_counter: 1740, get_leaf_counter: 0, insert_branch_counter: 660, insert_leaf_counter: 100, remove_branch_counter: 0, remove_leaf_counter: 0 } random update 10000 keys, store counters: Counters { get_branch_counter: 370570, get_leaf_counter: 0, insert_branch_counter: 131628, insert_leaf_counter: 10000, remove_branch_counter: 0, remove_leaf_counter: 0 } random update_all 100 keys, store counters: Counters { get_branch_counter: 1731, get_leaf_counter: 0, insert_branch_counter: 657, insert_leaf_counter: 100, remove_branch_counter: 0, remove_leaf_counter: 0 } random update_all 10000 keys, store counters: Counters { get_branch_counter: 371504, get_leaf_counter: 0, insert_branch_counter: 131988, insert_leaf_counter: 10000, remove_branch_counter: 0, remove_leaf_counter: 0 }
cargo bench -- --test #... random update 100 keys, store counters: Counters { get_branch_counter: 25600, get_leaf_counter: 0, insert_branch_counter: 25600, insert_leaf_counter: 100, remove_branch_counter: 0, remove_leaf_counter: 0 } random update 10000 keys, store counters: Counters { get_branch_counter: 2560000, get_leaf_counter: 0, insert_branch_counter: 2560000, insert_leaf_counter: 10000, remove_branch_counter: 0, remove_leaf_counter: 0 } random update_all 100 keys, store counters: Counters { get_branch_counter: 24836, get_leaf_counter: 0, insert_branch_counter: 24935, insert_leaf_counter: 100, remove_branch_counter: 0, remove_leaf_counter: 0 } random update_all 10000 keys, store counters: Counters { get_branch_counter: 2418267, get_leaf_counter: 0, insert_branch_counter: 2428266, insert_leaf_counter: 10000, remove_branch_counter: 0, remove_leaf_counter: 0 }
Others just look good to me, I'll approve if all above comments resolved.
This PR brings a new implementation for
SparseMerkleTree
(check trie_tree.rs), typically called TrieTree, which is:MerkleProof
&Compiled MerkleProof
Reference
Read/Write performace comparison:
Here's some bench data with rw operations counters This can reproduced by the benchmark : benches/store_counter_benchmark.rs with command:
cargo bench --features trie -- --test
andcargo bench -- --test
New
Original