diff --git a/tests/replay/undump_blocks.nim b/tests/replay/undump_blocks.nim index 9319ba096..7e8407edc 100644 --- a/tests/replay/undump_blocks.nim +++ b/tests/replay/undump_blocks.nim @@ -10,9 +10,11 @@ import std/[os, sequtils, strformat, strutils], + results, eth/[common, rlp], nimcrypto/utils, ../../nimbus/db/core_db, + ../../fluffy/eth_data/era1, ./gunzip # ------------------------------------------------------------------------------ @@ -172,11 +174,25 @@ iterator undumpBlocks*(gzFile: string): (seq[BlockHeader],seq[BlockBody]) = echo &"*** Ignoring line({lno}): {line}." waitFor = "transaction" -iterator undumpBlocks*(gzs: seq[string]): (seq[BlockHeader],seq[BlockBody])= + +iterator undumpBlocks*(era1files: seq[string]): (seq[BlockHeader],seq[BlockBody])= ## Variant of `undumpBlocks()` - for f in gzs: - for w in f.undumpBlocks: - yield w + for fileName in era1files: + var headers: seq[BlockHeader] + var bodies: seq[BlockBody] + let era1File = Era1File.open(fileName).value + for blockTuple in era1File.era1BlockTuples: + headers.add blockTuple.header + bodies.add blockTuple.body + if headers.len == 100: + yield (headers, bodies) + headers.setLen 0 + bodies.setLen 0 + if headers.len > 0: + yield (headers, bodies) + headers.setLen 0 + bodies.setLen 0 + iterator undumpBlocks*( gzFile: string; # Data dump file diff --git a/tests/test_coredb.nim b/tests/test_coredb.nim index e0ab7a039..4c2fb9dc7 100644 --- a/tests/test_coredb.nim +++ b/tests/test_coredb.nim @@ -33,12 +33,12 @@ const # Reference file for finding some database directory base sampleDirRefFile = "coredb_test_xx.nim" - dbTypeDefault = LegacyDbMemory - ldgTypeDefault = LegacyAccountsCache + dbTypeDefault = AristoDbRocks + ldgTypeDefault = LedgerCache let # Standard test sample - bChainCapture = bulkTest0 + bChainCapture = mainEra1 # ------------------------------------------------------------------------------ # Helpers @@ -275,10 +275,7 @@ when isMainModule: sampleList = cmdLineConfig().samples if sampleList.len == 0: - sampleList = @[bulkTest0] - when true: - sampleList = @[bulkTest2, bulkTest3] - sampleList = @[ariTest1] # debugging + sampleList = @[mainEra1] var state: (Duration, int) for n,capture in sampleList: diff --git a/tests/test_coredb/coredb_test_xx.nim b/tests/test_coredb/coredb_test_xx.nim index 9cd2a2ece..5f47cd19e 100644 --- a/tests/test_coredb/coredb_test_xx.nim +++ b/tests/test_coredb/coredb_test_xx.nim @@ -9,6 +9,7 @@ # distributed except according to those terms. import + std/[os, sequtils], eth/common, ../../nimbus/db/core_db, ../../nimbus/common/chain_config @@ -84,6 +85,14 @@ let "mainnet550849-719232.txt.gz", "mainnet719233-843841.txt.gz"]) + mainEra1* = CaptureSpecs( + builtIn: true, + name: "main", + network: MainNet, + files: toSeq(walkPattern("*.era1")), + numBlocks: high(int), + dbType: AristoDbRocks) + # ------------------ bulkTest0* = goerliSample