quick and dirty modification of sync test that uses gzipped blocks to use era1 files instead.
This commit is contained in:
parent
47a86f0df6
commit
34c795ded4
|
@ -10,9 +10,11 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[os, sequtils, strformat, strutils],
|
std/[os, sequtils, strformat, strutils],
|
||||||
|
results,
|
||||||
eth/[common, rlp],
|
eth/[common, rlp],
|
||||||
nimcrypto/utils,
|
nimcrypto/utils,
|
||||||
../../nimbus/db/core_db,
|
../../nimbus/db/core_db,
|
||||||
|
../../fluffy/eth_data/era1,
|
||||||
./gunzip
|
./gunzip
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
@ -172,11 +174,25 @@ iterator undumpBlocks*(gzFile: string): (seq[BlockHeader],seq[BlockBody]) =
|
||||||
echo &"*** Ignoring line({lno}): {line}."
|
echo &"*** Ignoring line({lno}): {line}."
|
||||||
waitFor = "transaction"
|
waitFor = "transaction"
|
||||||
|
|
||||||
iterator undumpBlocks*(gzs: seq[string]): (seq[BlockHeader],seq[BlockBody])=
|
|
||||||
|
iterator undumpBlocks*(era1files: seq[string]): (seq[BlockHeader],seq[BlockBody])=
|
||||||
## Variant of `undumpBlocks()`
|
## Variant of `undumpBlocks()`
|
||||||
for f in gzs:
|
for fileName in era1files:
|
||||||
for w in f.undumpBlocks:
|
var headers: seq[BlockHeader]
|
||||||
yield w
|
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*(
|
iterator undumpBlocks*(
|
||||||
gzFile: string; # Data dump file
|
gzFile: string; # Data dump file
|
||||||
|
|
|
@ -33,12 +33,12 @@ const
|
||||||
# Reference file for finding some database directory base
|
# Reference file for finding some database directory base
|
||||||
sampleDirRefFile = "coredb_test_xx.nim"
|
sampleDirRefFile = "coredb_test_xx.nim"
|
||||||
|
|
||||||
dbTypeDefault = LegacyDbMemory
|
dbTypeDefault = AristoDbRocks
|
||||||
ldgTypeDefault = LegacyAccountsCache
|
ldgTypeDefault = LedgerCache
|
||||||
|
|
||||||
let
|
let
|
||||||
# Standard test sample
|
# Standard test sample
|
||||||
bChainCapture = bulkTest0
|
bChainCapture = mainEra1
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Helpers
|
# Helpers
|
||||||
|
@ -275,10 +275,7 @@ when isMainModule:
|
||||||
|
|
||||||
sampleList = cmdLineConfig().samples
|
sampleList = cmdLineConfig().samples
|
||||||
if sampleList.len == 0:
|
if sampleList.len == 0:
|
||||||
sampleList = @[bulkTest0]
|
sampleList = @[mainEra1]
|
||||||
when true:
|
|
||||||
sampleList = @[bulkTest2, bulkTest3]
|
|
||||||
sampleList = @[ariTest1] # debugging
|
|
||||||
|
|
||||||
var state: (Duration, int)
|
var state: (Duration, int)
|
||||||
for n,capture in sampleList:
|
for n,capture in sampleList:
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
# distributed except according to those terms.
|
# distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
|
std/[os, sequtils],
|
||||||
eth/common,
|
eth/common,
|
||||||
../../nimbus/db/core_db,
|
../../nimbus/db/core_db,
|
||||||
../../nimbus/common/chain_config
|
../../nimbus/common/chain_config
|
||||||
|
@ -84,6 +85,14 @@ let
|
||||||
"mainnet550849-719232.txt.gz",
|
"mainnet550849-719232.txt.gz",
|
||||||
"mainnet719233-843841.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
|
bulkTest0* = goerliSample
|
||||||
|
|
Loading…
Reference in New Issue