From 0addffcc6c83f5ffdf4ea6340cb61f3c75b1c416 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Sun, 26 May 2024 09:57:59 +0200 Subject: [PATCH] binary tries: remove (#684) not used anywhere --- eth/trie.nim | 5 +- eth/trie/sparse_binary.nim | 177 ------------------- eth/trie/sparse_proofs.nim | 86 --------- tests/trie/all_tests.nim | 1 - tests/trie/test_sparse_binary_trie.nim | 230 ------------------------- 5 files changed, 2 insertions(+), 497 deletions(-) delete mode 100644 eth/trie/sparse_binary.nim delete mode 100644 eth/trie/sparse_proofs.nim delete mode 100644 tests/trie/test_sparse_binary_trie.nim 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..