diff --git a/eth/trie.nim b/eth/trie.nim index 29bf1f5..6a11592 100644 --- a/eth/trie.nim +++ b/eth/trie.nim @@ -1,6 +1,5 @@ import - ./trie/[hexary, sparse_binary] + ./trie/[hexary, trie_defs] export - hexary, sparse_binary - + hexary, trie_defs diff --git a/eth/trie/sparse_binary.nim b/eth/trie/sparse_binary.nim deleted file mode 100644 index 5571a2f..0000000 --- a/eth/trie/sparse_binary.nim +++ /dev/null @@ -1,177 +0,0 @@ -import - "."/[trie_bitseq, trie_defs, trie_utils, db, sparse_proofs] - -export - trie_utils, trie_bitseq, - sparse_proofs.verifyProof - -type - DB = TrieDatabaseRef - - SparseBinaryTrie* = object - db: DB - rootHash: seq[byte] - -type - # 256 * 2 div 8 - DoubleHash = array[64, byte] - -proc initDoubleHash(a, b: openArray[byte]): DoubleHash = - doAssert(a.len == 32, $a.len) - doAssert(b.len == 32, $b.len) - result[0..31] = a - result[32..^1] = b - -proc initDoubleHash(x: openArray[byte]): DoubleHash = - initDoubleHash(x, x) - -proc init*(x: typedesc[SparseBinaryTrie], db: DB): SparseBinaryTrie = - result.db = db - # Initialize an empty tree with one branch - var value = initDoubleHash(emptyNodeHashes[0].data) - result.rootHash = @(keccakHash(value).data) - result.db.put(result.rootHash, value) - - for i in 0..