From 4974ca49dbf2277c62e222097b753c9ab4f28d64 Mon Sep 17 00:00:00 2001 From: andri lim Date: Wed, 29 Apr 2020 11:12:15 +0700 Subject: [PATCH] fix buildWitness API --- stateless/test_block_witness.nim | 2 +- stateless/test_witness_keys.nim | 9 ++++++--- stateless/witness_from_tree.nim | 5 +++-- stateless/witness_types.nim | 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/stateless/test_block_witness.nim b/stateless/test_block_witness.nim index 546e6ab59..9830120d3 100644 --- a/stateless/test_block_witness.nim +++ b/stateless/test_block_witness.nim @@ -30,7 +30,7 @@ proc testGetBranch(tester: Tester, rootHash: KeccakHash, testStatusIMPL: var Tes #try: for address in tester.address: var wb = initWitnessBuilder(tester.memdb, rootHash) - var witness = wb.getBranchRecurse(address) + var witness = wb.buildWitness(address) var db = newMemoryDB() when defined(useInputStream): diff --git a/stateless/test_witness_keys.nim b/stateless/test_witness_keys.nim index d3b48eb79..5b01e0770 100644 --- a/stateless/test_witness_keys.nim +++ b/stateless/test_witness_keys.nim @@ -43,20 +43,23 @@ proc randAccount(db: DB): Account = result.codeHash = randCode(db) result.storageRoot = randStorage(db) +proc randAddress(): EthAddress = + discard randomBytes(result.addr, sizeof(result)) + proc runTest(numPairs: int) = var memDB = newMemoryDB() var trie = initSecureHexaryTrie(memDB) - var addrs = newSeq[Bytes](numPairs) + var addrs = newSeq[EthAddress](numPairs) for i in 0..= 0 and i < 17) x = x or (1 shl i).uint