From ed0e8823870610f9f148f21e0984d36ae02f4669 Mon Sep 17 00:00:00 2001 From: Jordan Hrycaj Date: Wed, 16 Mar 2022 09:13:17 +0000 Subject: [PATCH] Exported blobs and some scripts to parallel project nimbus-eth1-blobs (#995) why: TDD data and test script that are not needed for CI are externally held. This saves space. also: Added support for test-custom_networks.nim to run import Devnet5 dump. --- README.md | 6 + run-nimbus-sync | 115 --- .../{kintsugi.json => devnet4.json} | 2 +- tests/customgenesis/devnet5.json | 867 ++++++++++++++++++ tests/{test_pow => replay}/mainspecs2k.txt.gz | Bin tests/replay/pp.nim | 65 +- tests/replay/pp_light.nim | 160 ++++ tests/replay/undump.nim | 1 + tests/test_custom_network.nim | 255 +++++- tests/test_genesis.nim | 18 +- tests/test_pow.nim | 50 +- tests/test_txpool.nim | 22 +- tests/test_txpool/helpers.nim | 10 - 13 files changed, 1301 insertions(+), 270 deletions(-) delete mode 100755 run-nimbus-sync rename tests/customgenesis/{kintsugi.json => devnet4.json} (99%) create mode 100644 tests/customgenesis/devnet5.json rename tests/{test_pow => replay}/mainspecs2k.txt.gz (100%) create mode 100644 tests/replay/pp_light.nim diff --git a/README.md b/README.md index e8deda4b9..a39455d8b 100644 --- a/README.md +++ b/README.md @@ -275,6 +275,12 @@ rm vendor/Nim/bin/nim make -j8 build-nim ``` +- some programs in the _tests_ subdirectory do a replay of blockchain + database dumps when compiled and run locally. The dumps are found in + [this](https://github.com/status-im/nimbus-eth1-blobs) module which + need to be cloned as _nimbus-eth1-blobs_ parellel to the _nimbus-eth1_ + file system root. + #### Git submodule workflow Working on a dependency: diff --git a/run-nimbus-sync b/run-nimbus-sync deleted file mode 100755 index 99afe1f19..000000000 --- a/run-nimbus-sync +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/bash -# -# Script to run Nimbus-eth1 on the same networks Geth supports by name, -# with a trusted connection to a dedicated peer for that network. -# -# All protocols are disabled other than the minimum we need for block sync. -# -# This is very helpful for debugging and improving pipelined sync, and for -# improving the database and other processing, even though p2p sync is the -# endgame. -# -# - Discovery protocols are turned off -# - NAT hole punching protocols are turned off -# - Whisper protocol is turned off (`--protocols:eth`) -# - The only connection is to a single, active Geth for that network. -# - Each network's data is stored in a different location to avoid conflicts. -# - Each network is accessed by binding to a different port locally, -# so we can run several at the same time. -# - Log level is set to `TRACE` because we can read them when we're not -# swamped with discovery messages. Sync isn't fast enough yet. -# -# The enode URLs below are public facing Geth instances that are syncing to -# each of the networks. Nimbus-eth1 devs are free to use them for testing -# while they remain up. However, better results will be obtained if those nodes -# also have the Nimbus instances as "trusted peers". -# -set -e -u -o pipefail - -# First argument says which testnet, or use mainnet for that. -# Defaults to goerli if omitted. -testnet=${1:-goerli} - -# Additional arguments after the first are passed to Nimbus. -shift || : - -staticnode_geth_mainnet='enode://7af995207d620d363ffbdac3216c45140c8fc31a1a30cac94dfad94713ba6b03efeb4f8dd4c0d676ec3e32a9eac2804560c3d3001c7551a2bb955c1e5ce22d17@mainnet.geth.ethereum.arxlogic.com:30303' -staticnode_geth_goerli='enode://9a8651c02d14ffbf7e328cd6c31307d90c9411673deeec819a1b7a205eed121c7eea192146937958608eaebff25dcd232fce958f031bf82ba3d55deaac3d0715@goerli.geth.ethereum.arxlogic.com:30303'; -staticnode_geth_ropsten='enode://861f2b16e3da33f2af677de97087dd489b17f9a0685fdaf751fb524fdf171cd4b8f02a5dc9e25a2730d1aa1b22176f5c88397b7f01180d032375d1526a8e1421@ropsten.geth.ethereum.arxlogic.com:30303' -staticnode_geth_rinkeby='enode://bb34c7a91c9895769f782cd1f0da88025f302960beebac305010b7395912b3835eb954426b3cf4be1b47bae4c32973d87688ace8cce412a3efb88baabc77bd98@rinkeby.geth.ethereum.arxlogic.com:30303' -staticnode_geth_yolov3='enode://a11e7ed2a1a21b9464619f77734b9dec76befbc5ebb95ac7820f45728bc42c30f9bd406a83ddc28b28141bc0a8469638467ad6a48065977e1ac8e8f1c7a1e6b4@yolov3.geth.ethereum.arxlogic.com:30303' - -case $testnet in - mainnet) - net_option= port=30193 staticnodes=$staticnode_geth_mainnet ;; - goerli) - net_option=--goerli port=30194 staticnodes=$staticnode_geth_goerli ;; - ropsten) - net_option=--ropsten port=30195 staticnodes=$staticnode_geth_ropsten ;; - rinkeby) - net_option=--rinkeby port=30196 staticnodes=$staticnode_geth_rinkeby ;; - yolov3) - net_option=--yolov3 port=30197 staticnodes=$staticnode_geth_yolov3 ;; - *) - echo "Unrecognised network: $testnet" 1>&2; exit 1 ;; -esac - -# Perform DNS name lookup for enodes with names. -# Geth supports this nowadays, but Nimbus does not. -resolve_enodes() { - local node prefix suffix host port ip - set -- - for node in $staticnodes; do - case $node in - enode://*@*:*) - prefix=${node%@*} suffix=${node##*@} - host=${suffix%:*} port=${suffix##*:} - case $host in - *[^0-9.]*) - ip=$(host -t a "$host" 2>/dev/null) - case $ip in - "$host has address "[0-9]*) - ip=${ip##* has address } - ;; - *) - echo "Name lookup for $host failed" 1>&2 - exit 1 - ;; - esac - node=$prefix@$ip:$port - esac - esac - set -- "$@" "$node" - done - staticnodes="$*" -} -resolve_enodes - -datadir="$HOME"/.nimbus/"$testnet" - -# Use a stable nodekey if we have one, to ensure the remote Geth almost always -# accepts our connections. The nodekey's corresponding `enode` URL must be -# added with `admin.addTrustedPeer` to the remote Geth. This isn't perfect. -# Sometimes Geth is too busy even for a trusted peer. But usually it works. -# -# Note, this nodekey file isn't created automatically by nimbus-eth1 at the -# moment. We have to have done it manually before now. -# -if [ -e "$datadir"/nimbus/nodekey ]; then - nodekey=$(cat "$datadir"/nimbus/nodekey) - if [ -n "$nodekey" ]; then - set -- --nodekey:"$nodekey" - fi -fi - -# So the process name shows up without a path in `netstat`. -export PATH=$HOME/Status/nimbus-eth1/build:$PATH - -exec nimbus \ - --datadir:"$datadir" $net_option \ - --prune:full \ - --logMetrics --logMetricsInterval:5 \ - --log-level:TRACE \ - --nodiscover --nat:none --port:$port --protocols:eth \ - --staticnodes:"$staticnodes" \ - "$@" diff --git a/tests/customgenesis/kintsugi.json b/tests/customgenesis/devnet4.json similarity index 99% rename from tests/customgenesis/kintsugi.json rename to tests/customgenesis/devnet4.json index 2f78d3368..878ba544b 100644 --- a/tests/customgenesis/kintsugi.json +++ b/tests/customgenesis/devnet4.json @@ -1,6 +1,6 @@ { "config": { - "chainId": 1337702, + "chainId": 1337752, "homesteadBlock": 0, "eip150Block": 0, "eip155Block": 0, diff --git a/tests/customgenesis/devnet5.json b/tests/customgenesis/devnet5.json new file mode 100644 index 000000000..6d7f10ec3 --- /dev/null +++ b/tests/customgenesis/devnet5.json @@ -0,0 +1,867 @@ +{ + "config": { + "chainId": 1337762, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "londonBlock": 0, + "mergeForkBlock": 1000, + "terminalTotalDifficulty": 500000000000 + }, + "genesis" : { /* added for nimbus */ + "alloc": { + "0x0000000000000000000000000000000000000000": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000001": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000002": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000003": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000004": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000005": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000006": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000007": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000008": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000009": { + "balance": "1" + }, + "0x000000000000000000000000000000000000000a": { + "balance": "1" + }, + "0x000000000000000000000000000000000000000b": { + "balance": "1" + }, + "0x000000000000000000000000000000000000000c": { + "balance": "1" + }, + "0x000000000000000000000000000000000000000d": { + "balance": "1" + }, + "0x000000000000000000000000000000000000000e": { + "balance": "1" + }, + "0x000000000000000000000000000000000000000f": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000010": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000011": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000012": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000013": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000014": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000015": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000016": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000017": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000018": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000019": { + "balance": "1" + }, + "0x000000000000000000000000000000000000001a": { + "balance": "1" + }, + "0x000000000000000000000000000000000000001b": { + "balance": "1" + }, + "0x000000000000000000000000000000000000001c": { + "balance": "1" + }, + "0x000000000000000000000000000000000000001d": { + "balance": "1" + }, + "0x000000000000000000000000000000000000001e": { + "balance": "1" + }, + "0x000000000000000000000000000000000000001f": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000020": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000021": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000022": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000023": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000024": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000025": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000026": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000027": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000028": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000029": { + "balance": "1" + }, + "0x000000000000000000000000000000000000002a": { + "balance": "1" + }, + "0x000000000000000000000000000000000000002b": { + "balance": "1" + }, + "0x000000000000000000000000000000000000002c": { + "balance": "1" + }, + "0x000000000000000000000000000000000000002d": { + "balance": "1" + }, + "0x000000000000000000000000000000000000002e": { + "balance": "1" + }, + "0x000000000000000000000000000000000000002f": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000030": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000031": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000032": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000033": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000034": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000035": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000036": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000037": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000038": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000039": { + "balance": "1" + }, + "0x000000000000000000000000000000000000003a": { + "balance": "1" + }, + "0x000000000000000000000000000000000000003b": { + "balance": "1" + }, + "0x000000000000000000000000000000000000003c": { + "balance": "1" + }, + "0x000000000000000000000000000000000000003d": { + "balance": "1" + }, + "0x000000000000000000000000000000000000003e": { + "balance": "1" + }, + "0x000000000000000000000000000000000000003f": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000040": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000041": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000042": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000043": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000044": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000045": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000046": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000047": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000048": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000049": { + "balance": "1" + }, + "0x000000000000000000000000000000000000004a": { + "balance": "1" + }, + "0x000000000000000000000000000000000000004b": { + "balance": "1" + }, + "0x000000000000000000000000000000000000004c": { + "balance": "1" + }, + "0x000000000000000000000000000000000000004d": { + "balance": "1" + }, + "0x000000000000000000000000000000000000004e": { + "balance": "1" + }, + "0x000000000000000000000000000000000000004f": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000050": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000051": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000052": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000053": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000054": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000055": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000056": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000057": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000058": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000059": { + "balance": "1" + }, + "0x000000000000000000000000000000000000005a": { + "balance": "1" + }, + "0x000000000000000000000000000000000000005b": { + "balance": "1" + }, + "0x000000000000000000000000000000000000005c": { + "balance": "1" + }, + "0x000000000000000000000000000000000000005d": { + "balance": "1" + }, + "0x000000000000000000000000000000000000005e": { + "balance": "1" + }, + "0x000000000000000000000000000000000000005f": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000060": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000061": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000062": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000063": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000064": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000065": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000066": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000067": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000068": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000069": { + "balance": "1" + }, + "0x000000000000000000000000000000000000006a": { + "balance": "1" + }, + "0x000000000000000000000000000000000000006b": { + "balance": "1" + }, + "0x000000000000000000000000000000000000006c": { + "balance": "1" + }, + "0x000000000000000000000000000000000000006d": { + "balance": "1" + }, + "0x000000000000000000000000000000000000006e": { + "balance": "1" + }, + "0x000000000000000000000000000000000000006f": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000070": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000071": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000072": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000073": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000074": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000075": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000076": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000077": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000078": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000079": { + "balance": "1" + }, + "0x000000000000000000000000000000000000007a": { + "balance": "1" + }, + "0x000000000000000000000000000000000000007b": { + "balance": "1" + }, + "0x000000000000000000000000000000000000007c": { + "balance": "1" + }, + "0x000000000000000000000000000000000000007d": { + "balance": "1" + }, + "0x000000000000000000000000000000000000007e": { + "balance": "1" + }, + "0x000000000000000000000000000000000000007f": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000080": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000081": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000082": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000083": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000084": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000085": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000086": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000087": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000088": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000089": { + "balance": "1" + }, + "0x000000000000000000000000000000000000008a": { + "balance": "1" + }, + "0x000000000000000000000000000000000000008b": { + "balance": "1" + }, + "0x000000000000000000000000000000000000008c": { + "balance": "1" + }, + "0x000000000000000000000000000000000000008d": { + "balance": "1" + }, + "0x000000000000000000000000000000000000008e": { + "balance": "1" + }, + "0x000000000000000000000000000000000000008f": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000090": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000091": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000092": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000093": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000094": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000095": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000096": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000097": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000098": { + "balance": "1" + }, + "0x0000000000000000000000000000000000000099": { + "balance": "1" + }, + "0x000000000000000000000000000000000000009a": { + "balance": "1" + }, + "0x000000000000000000000000000000000000009b": { + "balance": "1" + }, + "0x000000000000000000000000000000000000009c": { + "balance": "1" + }, + "0x000000000000000000000000000000000000009d": { + "balance": "1" + }, + "0x000000000000000000000000000000000000009e": { + "balance": "1" + }, + "0x000000000000000000000000000000000000009f": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000a0": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000a1": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000a2": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000a3": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000a4": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000a5": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000a6": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000a7": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000a8": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000a9": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000aa": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ab": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ac": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ad": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ae": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000af": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000b0": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000b1": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000b2": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000b3": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000b4": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000b5": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000b6": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000b7": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000b8": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000b9": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ba": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000bb": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000bc": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000bd": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000be": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000bf": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000c0": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000c1": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000c2": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000c3": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000c4": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000c5": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000c6": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000c7": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000c8": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000c9": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ca": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000cb": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000cc": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000cd": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ce": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000cf": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000d0": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000d1": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000d2": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000d3": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000d4": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000d5": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000d6": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000d7": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000d8": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000d9": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000da": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000db": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000dc": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000dd": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000de": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000df": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000e0": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000e1": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000e2": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000e3": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000e4": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000e5": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000e6": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000e7": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000e8": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000e9": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ea": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000eb": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ec": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ed": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ee": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ef": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000f0": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000f1": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000f2": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000f3": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000f4": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000f5": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000f6": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000f7": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000f8": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000f9": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000fa": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000fb": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000fc": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000fd": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000fe": { + "balance": "1" + }, + "0x00000000000000000000000000000000000000ff": { + "balance": "1" + }, + "0x4242424242424242424242424242424242424242": { + "balance": "0", + "code": "0x60806040526004361061003f5760003560e01c806301ffc9a71461004457806322895118146100a4578063621fd130146101ba578063c5f2892f14610244575b600080fd5b34801561005057600080fd5b506100906004803603602081101561006757600080fd5b50357fffffffff000000000000000000000000000000000000000000000000000000001661026b565b604080519115158252519081900360200190f35b6101b8600480360360808110156100ba57600080fd5b8101906020810181356401000000008111156100d557600080fd5b8201836020820111156100e757600080fd5b8035906020019184600183028401116401000000008311171561010957600080fd5b91939092909160208101903564010000000081111561012757600080fd5b82018360208201111561013957600080fd5b8035906020019184600183028401116401000000008311171561015b57600080fd5b91939092909160208101903564010000000081111561017957600080fd5b82018360208201111561018b57600080fd5b803590602001918460018302840111640100000000831117156101ad57600080fd5b919350915035610304565b005b3480156101c657600080fd5b506101cf6110b5565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102095781810151838201526020016101f1565b50505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025057600080fd5b506102596110c7565b60408051918252519081900360200190f35b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806102fe57507fffffffff0000000000000000000000000000000000000000000000000000000082167f8564090700000000000000000000000000000000000000000000000000000000145b92915050565b6030861461035d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118056026913960400191505060405180910390fd5b602084146103b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061179c6036913960400191505060405180910390fd5b6060821461040f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806118786029913960400191505060405180910390fd5b670de0b6b3a7640000341015610470576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118526026913960400191505060405180910390fd5b633b9aca003406156104cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001806117d26033913960400191505060405180910390fd5b633b9aca00340467ffffffffffffffff811115610535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061182b6027913960400191505060405180910390fd5b6060610540826114ba565b90507f649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c589898989858a8a6105756020546114ba565b6040805160a0808252810189905290819060208201908201606083016080840160c085018e8e80828437600083820152601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690910187810386528c815260200190508c8c808284376000838201819052601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01690920188810386528c5181528c51602091820193918e019250908190849084905b83811015610648578181015183820152602001610630565b50505050905090810190601f1680156106755780820380516001836020036101000a031916815260200191505b5086810383528881526020018989808284376000838201819052601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169092018881038452895181528951602091820193918b019250908190849084905b838110156106ef5781810151838201526020016106d7565b50505050905090810190601f16801561071c5780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390a1600060028a8a600060801b604051602001808484808284377fffffffffffffffffffffffffffffffff0000000000000000000000000000000090941691909301908152604080517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0818403018152601090920190819052815191955093508392506020850191508083835b602083106107fc57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016107bf565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610859573d6000803e3d6000fd5b5050506040513d602081101561086e57600080fd5b5051905060006002806108846040848a8c6116fe565b6040516020018083838082843780830192505050925050506040516020818303038152906040526040518082805190602001908083835b602083106108f857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016108bb565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610955573d6000803e3d6000fd5b5050506040513d602081101561096a57600080fd5b5051600261097b896040818d6116fe565b60405160009060200180848480828437919091019283525050604080518083038152602092830191829052805190945090925082918401908083835b602083106109f457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016109b7565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610a51573d6000803e3d6000fd5b5050506040513d6020811015610a6657600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610ada57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610a9d565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610b37573d6000803e3d6000fd5b5050506040513d6020811015610b4c57600080fd5b50516040805160208101858152929350600092600292839287928f928f92018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b60208310610bd957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b9c565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610c36573d6000803e3d6000fd5b5050506040513d6020811015610c4b57600080fd5b50516040518651600291889160009188916020918201918291908601908083835b60208310610ca957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610c6c565b6001836020036101000a0380198251168184511680821785525050505050509050018367ffffffffffffffff191667ffffffffffffffff1916815260180182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310610d4e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610d11565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610dab573d6000803e3d6000fd5b5050506040513d6020811015610dc057600080fd5b5051604080516020818101949094528082019290925280518083038201815260609092019081905281519192909182918401908083835b60208310610e3457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610df7565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015610e91573d6000803e3d6000fd5b5050506040513d6020811015610ea657600080fd5b50519050858114610f02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260548152602001806117486054913960600191505060405180910390fd5b60205463ffffffff11610f60576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117276021913960400191505060405180910390fd5b602080546001019081905560005b60208110156110a9578160011660011415610fa0578260008260208110610f9157fe5b0155506110ac95505050505050565b600260008260208110610faf57fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061102557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610fe8565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa158015611082573d6000803e3d6000fd5b5050506040513d602081101561109757600080fd5b50519250600282049150600101610f6e565b50fe5b50505050505050565b60606110c26020546114ba565b905090565b6020546000908190815b60208110156112f05781600116600114156111e6576002600082602081106110f557fe5b01548460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061116b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161112e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa1580156111c8573d6000803e3d6000fd5b5050506040513d60208110156111dd57600080fd5b505192506112e2565b600283602183602081106111f657fe5b015460405160200180838152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831061126b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161122e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa1580156112c8573d6000803e3d6000fd5b5050506040513d60208110156112dd57600080fd5b505192505b6002820491506001016110d1565b506002826112ff6020546114ba565b600060401b6040516020018084815260200183805190602001908083835b6020831061135a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161131d565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000095909516920191825250604080518083037ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8018152601890920190819052815191955093508392850191508083835b6020831061143f57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611402565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930194509192505080830381855afa15801561149c573d6000803e3d6000fd5b5050506040513d60208110156114b157600080fd5b50519250505090565b60408051600880825281830190925260609160208201818036833701905050905060c082901b8060071a60f81b826000815181106114f457fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060061a60f81b8260018151811061153757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060051a60f81b8260028151811061157a57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060041a60f81b826003815181106115bd57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060031a60f81b8260048151811061160057fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060021a60f81b8260058151811061164357fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060011a60f81b8260068151811061168657fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508060001a60f81b826007815181106116c957fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050919050565b6000808585111561170d578182fd5b83861115611719578182fd5b505082019391909203915056fe4465706f736974436f6e74726163743a206d65726b6c6520747265652066756c6c4465706f736974436f6e74726163743a207265636f6e7374727563746564204465706f7369744461746120646f6573206e6f74206d6174636820737570706c696564206465706f7369745f646174615f726f6f744465706f736974436f6e74726163743a20696e76616c6964207769746864726177616c5f63726564656e7469616c73206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c7565206e6f74206d756c7469706c65206f6620677765694465706f736974436f6e74726163743a20696e76616c6964207075626b6579206c656e6774684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f20686967684465706f736974436f6e74726163743a206465706f7369742076616c756520746f6f206c6f774465706f736974436f6e74726163743a20696e76616c6964207369676e6174757265206c656e677468a26469706673582212201dd26f37a621703009abf16e77e69c93dc50c79db7f6cc37543e3e0e3decdc9764736f6c634300060b0033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000022": "0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b", + "0x0000000000000000000000000000000000000000000000000000000000000023": "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0x0000000000000000000000000000000000000000000000000000000000000024": "0xc78009fdf07fc56a11f122370658a353aaa542ed63e44c4bc15ff4cd105ab33c", + "0x0000000000000000000000000000000000000000000000000000000000000025": "0x536d98837f2dd165a55d5eeae91485954472d56f246df256bf3cae19352a123c", + "0x0000000000000000000000000000000000000000000000000000000000000026": "0x9efde052aa15429fae05bad4d0b1d7c64da64d03d7a1854a588c2cb8430c0d30", + "0x0000000000000000000000000000000000000000000000000000000000000027": "0xd88ddfeed400a8755596b21942c1497e114c302e6118290f91e6772976041fa1", + "0x0000000000000000000000000000000000000000000000000000000000000028": "0x87eb0ddba57e35f6d286673802a4af5975e22506c7cf4c64bb6be5ee11527f2c", + "0x0000000000000000000000000000000000000000000000000000000000000029": "0x26846476fd5fc54a5d43385167c95144f2643f533cc85bb9d16b782f8d7db193", + "0x000000000000000000000000000000000000000000000000000000000000002a": "0x506d86582d252405b840018792cad2bf1259f1ef5aa5f887e13cb2f0094f51e1", + "0x000000000000000000000000000000000000000000000000000000000000002b": "0xffff0ad7e659772f9534c195c815efc4014ef1e1daed4404c06385d11192e92b", + "0x000000000000000000000000000000000000000000000000000000000000002c": "0x6cf04127db05441cd833107a52be852868890e4317e6a02ab47683aa75964220", + "0x000000000000000000000000000000000000000000000000000000000000002d": "0xb7d05f875f140027ef5118a2247bbb84ce8f2f0f1123623085daf7960c329f5f", + "0x000000000000000000000000000000000000000000000000000000000000002e": "0xdf6af5f5bbdb6be9ef8aa618e4bf8073960867171e29676f8b284dea6a08a85e", + "0x000000000000000000000000000000000000000000000000000000000000002f": "0xb58d900f5e182e3c50ef74969ea16c7726c549757cc23523c369587da7293784", + "0x0000000000000000000000000000000000000000000000000000000000000030": "0xd49a7502ffcfb0340b1d7885688500ca308161a7f96b62df9d083b71fcc8f2bb", + "0x0000000000000000000000000000000000000000000000000000000000000031": "0x8fe6b1689256c0d385f42f5bbe2027a22c1996e110ba97c171d3e5948de92beb", + "0x0000000000000000000000000000000000000000000000000000000000000032": "0x8d0d63c39ebade8509e0ae3c9c3876fb5fa112be18f905ecacfecb92057603ab", + "0x0000000000000000000000000000000000000000000000000000000000000033": "0x95eec8b2e541cad4e91de38385f2e046619f54496c2382cb6cacd5b98c26f5a4", + "0x0000000000000000000000000000000000000000000000000000000000000034": "0xf893e908917775b62bff23294dbbe3a1cd8e6cc1c35b4801887b646a6f81f17f", + "0x0000000000000000000000000000000000000000000000000000000000000035": "0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa", + "0x0000000000000000000000000000000000000000000000000000000000000036": "0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c", + "0x0000000000000000000000000000000000000000000000000000000000000037": "0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167", + "0x0000000000000000000000000000000000000000000000000000000000000038": "0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7", + "0x0000000000000000000000000000000000000000000000000000000000000039": "0x31206fa80a50bb6abe29085058f16212212a60eec8f049fecb92d8c8e0a84bc0", + "0x000000000000000000000000000000000000000000000000000000000000003a": "0x21352bfecbeddde993839f614c3dac0a3ee37543f9b412b16199dc158e23b544", + "0x000000000000000000000000000000000000000000000000000000000000003b": "0x619e312724bb6d7c3153ed9de791d764a366b389af13c58bf8a8d90481a46765", + "0x000000000000000000000000000000000000000000000000000000000000003c": "0x7cdd2986268250628d0c10e385c58c6191e6fbe05191bcc04f133f2cea72c1c4", + "0x000000000000000000000000000000000000000000000000000000000000003d": "0x848930bd7ba8cac54661072113fb278869e07bb8587f91392933374d017bcbe1", + "0x000000000000000000000000000000000000000000000000000000000000003e": "0x8869ff2c22b28cc10510d9853292803328be4fb0e80495e8bb8d271f5b889636", + "0x000000000000000000000000000000000000000000000000000000000000003f": "0xb5fe28e79f1b850f8658246ce9b6a1e7b49fc06db7143e8fe0b4f2b0c5523a5c", + "0x0000000000000000000000000000000000000000000000000000000000000040": "0x985e929f70af28d0bdd1a90a808f977f597c7c778c489e98d3bd8910d31ac0f7" + } + }, + "0xf97e180c050e5Ab072211Ad2C213Eb5AEE4DF134": { + "balance": "10000000000000000000000000" + }, + "0x2cA5F489CC1Fd1CEC24747B64E8dE0F4A6A850E1": { + "balance": "10000000000000000000000000" + }, + "0x7203bd333a874D9d329050ecE393820fCD501eaA": { + "balance": "10000000000000000000000000" + }, + "0xA51918aA40D78Ff8be939bf0E8404252875c6aDF": { + "balance": "10000000000000000000000000" + }, + "0xAA81078e6b2121dd7A846690DFdD6b10d7658d8B": { + "balance": "10000000000000000000000000" + }, + "0xFA2d31D8f21c1D1633E9BEB641dF77D21D63ccDd": { + "balance": "10000000000000000000000000" + }, + "0xf751C9c6d60614226fE57D2cAD6e10C856a2ddA3": { + "balance": "10000000000000000000000000" + }, + "0x9cD16887f6A808AEaa65D3c840f059EeA4ca1319": { + "balance": "10000000000000000000000000" + }, + "0x2E07043584F11BFF0AC39c927665DF6c6ebaffFB": { + "balance": "10000000000000000000000000" + }, + "0x60e771E5eCA8E26690920de669520Da210D64A9B": { + "balance": "10000000000000000000000000" + }, + "0xFC4db92C2Cf77CE02fBfd7Da0346d2CbFA66aD59": { + "balance": "10000000000000000000000000" + } + }, + "coinbase": "0x0000000000000000000000000000000000000000", + "difficulty": "0x01", + "extraData": "", + "gasLimit": "0x400000", + "nonce": "0x1234", + "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": "0" + } /* added for nimbus */ +} diff --git a/tests/test_pow/mainspecs2k.txt.gz b/tests/replay/mainspecs2k.txt.gz similarity index 100% rename from tests/test_pow/mainspecs2k.txt.gz rename to tests/replay/mainspecs2k.txt.gz diff --git a/tests/replay/pp.nim b/tests/replay/pp.nim index d4fdb3ec0..66a644440 100644 --- a/tests/replay/pp.nim +++ b/tests/replay/pp.nim @@ -12,73 +12,21 @@ ## ---------------------------------------------------- import - std/[sequtils, strformat, strutils, tables, times], - ../../nimbus/[chain_config, constants], - eth/[common, trie/trie_defs] + std/[tables, times], + ./pp_light, + ../../nimbus/chain_config, + eth/common -# ------------------------------------------------------------------------------ -# Public functions, units pretty printer -# ------------------------------------------------------------------------------ - -proc ppMs*(elapsed: Duration): string = - result = $elapsed.inMilliSeconds - let ns = elapsed.inNanoSeconds mod 1_000_000 - if ns != 0: - # to rounded deca milli seconds - let dm = (ns + 5_000i64) div 10_000i64 - result &= &".{dm:02}" - result &= "ms" - -proc ppSecs*(elapsed: Duration): string = - result = $elapsed.inSeconds - let ns = elapsed.inNanoseconds mod 1_000_000_000 - if ns != 0: - # to rounded decs seconds - let ds = (ns + 5_000_000i64) div 10_000_000i64 - result &= &".{ds:02}" - result &= "s" - -proc toKMG*[T](s: T): string = - proc subst(s: var string; tag, new: string): bool = - if tag.len < s.len and s[s.len - tag.len ..< s.len] == tag: - s = s[0 ..< s.len - tag.len] & new - return true - result = $s - for w in [("000", "K"),("000K","M"),("000M","G"),("000G","T"), - ("000T","P"),("000P","E"),("000E","Z"),("000Z","Y")]: - if not result.subst(w[0],w[1]): - return +export + pp_light # ------------------------------------------------------------------------------ # Public functions, pretty printer # ------------------------------------------------------------------------------ -proc pp*(s: string; hex = false): string = - if hex: - let n = (s.len + 1) div 2 - (if s.len < 20: s else: s[0 .. 5] & ".." & s[s.len-8 .. s.len-1]) & - "[" & (if 0 < n: "#" & $n else: "") & "]" - elif s.len <= 30: - s - else: - (if (s.len and 1) == 0: s[0 ..< 8] else: "0" & s[0 ..< 7]) & - "..(" & $s.len & ").." & s[s.len-16 ..< s.len] - proc pp*(b: Blob): string = b.mapIt(it.toHex(2)).join.toLowerAscii.pp(hex = true) -proc pp*(a: Hash256; collapse = true): string = - if not collapse: - a.data.mapIt(it.toHex(2)).join.toLowerAscii - elif a == emptyRlpHash: - "emptyRlpHash" - elif a == EMPTY_UNCLE_HASH: - "EMPTY_UNCLE_HASH" - elif a == EMPTY_SHA3: - "EMPTY_SHA3" - else: - a.data.mapIt(it.toHex(2)).join[56 .. 63].toLowerAscii - proc pp*(a: EthAddress): string = a.mapIt(it.toHex(2)).join[32 .. 39].toLowerAscii @@ -119,6 +67,7 @@ proc pp*(g: Genesis; sep = " "): string = &"parentHash={g.parentHash.pp}{sep}" & &"baseFeePerGas={g.baseFeePerGas}" + proc pp*(h: BlockHeader; indent: int): string = h.pp("\n" & " ".repeat(max(1,indent))) diff --git a/tests/replay/pp_light.nim b/tests/replay/pp_light.nim new file mode 100644 index 000000000..f1ad141d3 --- /dev/null +++ b/tests/replay/pp_light.nim @@ -0,0 +1,160 @@ +# Nimbus +# Copyright (c) 2018-2019 Status Research & Development GmbH +# Licensed under either of +# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or +# http://www.apache.org/licenses/LICENSE-2.0) +# * MIT license ([LICENSE-MIT](LICENSE-MIT) or +# http://opensource.org/licenses/MIT) +# at your option. This file may not be copied, modified, or distributed except +# according to those terms. + +## Pretty printing, an alternative to `$` for debugging +## ---------------------------------------------------- +## +## minimal dependencies, avoiding circular import + +import + std/[sequtils, strformat, strutils, tables, times], + nimcrypto/hash + +export + sequtils, strformat, strutils + +const + ZeroHash256 = MDigest[256].default + + EmptyUncleHash = ( "1dcc4de8dec75d7aab85b567b6ccd41a" & + "d312451b948a7413f0a142fd40d49347" ).toDigest + + BlankRootHash = ( "56e81f171bcc55a6ff8345e692c0f86e" & + "5b48e01b996cadc001622fb5e363b421" ).toDigest + + EmptySha3 = ( "c5d2460186f7233c927e7db2dcc703c0" & + "e500b653ca82273b7bfad8045d85a470" ).toDigest + + EmptyRlpHash = ( "56e81f171bcc55a6ff8345e692c0f86e" & + "5b48e01b996cadc001622fb5e363b421" ).toDigest + +# ------------------------------------------------------------------------------ +# Helpers +# ------------------------------------------------------------------------------ + +proc reGroup(q: openArray[int]; itemsPerSegment = 16): seq[seq[int]] = + var top = 0 + while top < q.len: + let w = top + top = min(w + itemsPerSegment, q.len) + result.add q[w ..< top] + +# ------------------------------------------------------------------------------ +# Public functions, units pretty printer +# ------------------------------------------------------------------------------ + +proc ppMs*(elapsed: Duration): string = + result = $elapsed.inMilliSeconds + let ns = elapsed.inNanoSeconds mod 1_000_000 + if ns != 0: + # to rounded deca milli seconds + let dm = (ns + 5_000i64) div 10_000i64 + result &= &".{dm:02}" + result &= "ms" + +proc ppSecs*(elapsed: Duration): string = + result = $elapsed.inSeconds + let ns = elapsed.inNanoseconds mod 1_000_000_000 + if ns != 0: + # to rounded decs seconds + let ds = (ns + 5_000_000i64) div 10_000_000i64 + result &= &".{ds:02}" + result &= "s" + +proc toKMG*[T](s: T): string = + proc subst(s: var string; tag, new: string): bool = + if tag.len < s.len and s[s.len - tag.len ..< s.len] == tag: + s = s[0 ..< s.len - tag.len] & new + return true + result = $s + for w in [("000", "K"),("000K","M"),("000M","G"),("000G","T"), + ("000T","P"),("000P","E"),("000E","Z"),("000Z","Y")]: + if not result.subst(w[0],w[1]): + return + +# ------------------------------------------------------------------------------ +# Public functions, pretty printer +# ------------------------------------------------------------------------------ + +proc pp*(s: string; hex = false): string = + if hex: + let n = (s.len + 1) div 2 + (if s.len < 20: s else: s[0 .. 5] & ".." & s[s.len-8 .. s.len-1]) & + "[" & (if 0 < n: "#" & $n else: "") & "]" + elif s.len <= 30: + s + else: + (if (s.len and 1) == 0: s[0 ..< 8] else: "0" & s[0 ..< 7]) & + "..(" & $s.len & ").." & s[s.len-16 ..< s.len] + +proc pp*(q: openArray[int]; itemsPerLine: int; lineSep: string): string = + doAssert q == q.reGroup(itemsPerLine).concat + q.reGroup(itemsPerLine) + .mapIt(it.mapIt(&"0x{it:02x}").join(", ")) + .join("," & lineSep) + +proc pp*(a: MDigest[256]; collapse = true): string = + if not collapse: + a.data.mapIt(it.toHex(2)).join.toLowerAscii + elif a == EmptyRlpHash: + "emptyRlpHash" + elif a == EmptyUncleHash: + "emptyUncleHash" + elif a == EmptySha3: + "EmptySha3" + elif a == ZeroHash256: + "zeroHash256" + else: + a.data.mapIt(it.toHex(2)).join[56 .. 63].toLowerAscii + +proc pp*(a: openArray[MDigest[256]]; collapse = true): string = + "@[" & a.toSeq.mapIt(it.pp).join(" ") & "]" + +proc pp*(q: openArray[int]; itemsPerLine: int; indent: int): string = + q.pp(itemsPerLine = itemsPerLine, lineSep = "\n" & " ".repeat(max(1,indent))) + +proc pp*(q: openArray[byte]; noHash = false): string = + if q.len == 32 and not noHash: + var a: array[32,byte] + for n in 0..31: a[n] = q[n] + MDigest[256](data: a).pp + else: + q.toSeq.mapIt(it.toHex(2)).join.toLowerAscii.pp(hex = true) + +# ------------------------------------------------------------------------------ +# Elapsed time pretty printer +# ------------------------------------------------------------------------------ + +template showElapsed*(noisy: bool; info: string; code: untyped) = + block: + let start = getTime() + code + if noisy: + let elpd {.inject.} = getTime() - start + if 0 < times.inSeconds(elpd): + echo "*** ", info, &": {elpd.ppSecs:>4}" + else: + echo "*** ", info, &": {elpd.ppMs:>4}" + +template catchException*(info: string; trace: bool; code: untyped) = + block: + try: + code + except CatchableError as e: + if trace: + echo "*** ", info, ": exception ", e.name, "(", e.msg, ")" + echo " ", e.getStackTrace.strip.replace("\n","\n ") + +template catchException*(info: string; code: untyped) = + catchException(info, false, code) + +# ------------------------------------------------------------------------------ +# End +# ------------------------------------------------------------------------------ diff --git a/tests/replay/undump.nim b/tests/replay/undump.nim index 8980b0763..6e24b365a 100644 --- a/tests/replay/undump.nim +++ b/tests/replay/undump.nim @@ -67,6 +67,7 @@ proc dumpGroupNl*(db: BaseChainDB; headers: openArray[BlockHeader]; ## `p2p/chain/persist_blocks.persistBlocksImpl()`: ## :: ## dumpStream.write c.db.dumpGroupNl(headers,bodies) + ## dumpStream.flushFile ## ## where `dumpStream` is some stream (think of `stdout`) of type `File` ## that could be initialised with diff --git a/tests/test_custom_network.nim b/tests/test_custom_network.nim index c71b567eb..7b0708c54 100644 --- a/tests/test_custom_network.nim +++ b/tests/test_custom_network.nim @@ -20,19 +20,56 @@ ## from `issue 932` `_. import - std/[distros, os, strformat, strutils, sequtils], + std/[distros, os], ../nimbus/[chain_config, config, genesis], ../nimbus/db/[db_chain, select_backend], - ./replay/pp, + ../nimbus/p2p/chain, + ./replay/[undump, pp], + chronicles, eth/[common, p2p, trie/db], nimcrypto/hash, + stew/results, unittest2 -const - baseDir = [".", "tests", ".." / "tests", $DirSep] # path containg repo - repoDir = ["customgenesis", "."] # alternative repo paths - jFile = "kintsugi.json" +type + ReplaySession = object + fancyName: string # display name + genesisFile: string # json file base name + termTotalDff: UInt256 # terminal total difficulty (to verify) + captureFile: string # gzipped RPL data dump + ttdReachedAt: uint64 # block number where total difficulty becomes `true` + failBlockAt: uint64 # stop here and expect that block to fail +const + baseDir = [".", "..", ".."/"..", $DirSep] + repoDir = [".", "tests"/"replay", "tests"/"customgenesis", + "nimbus-eth1-blobs"/"replay", + "nimbus-eth1-blobs"/"custom-network"] + + devnet4 = ReplaySession( + fancyName: "Devnet4", + genesisFile: "devnet4.json", + captureFile: "devnetfour5664.txt.gz", + termTotalDff: 5_000_000_000.u256, + ttdReachedAt: 5645, + # Previously failed at `ttdReachedAt` (needed `state.nim` fix/update) + failBlockAt: 99999999) + + devnet5 = ReplaySession( + fancyName: "Devnet5", + genesisFile: "devnet5.json", + captureFile: "devnetfive43968.txt.gz", + termTotalDff: 500_000_000_000.u256, + ttdReachedAt: 43711, + failBlockAt: 99999999) + + kiln = ReplaySession( + fancyName: "Kiln", + genesisFile: "kiln.json", + captureFile: "kiln25872.txt.gz", + termTotalDff: 20_000_000_000_000.u256, + ttdReachedAt: 9999999, + failBlockAt: 9999999) when not defined(linux): const isUbuntu32bit = false @@ -58,6 +95,18 @@ let # disablePersistentDB = isUbuntu32bit +# Block chains shared between test suites +var + mdb: BaseChainDB # memory DB + ddb: BaseChainDB # perstent DB on disk + ddbDir: string # data directory for disk database + sSpcs: ReplaySession # current replay session specs + +const + # FIXED: Persistent database crash on `Devnet4` replay if the database + # directory was acidentally deleted (due to a stray "defer:" directive.) + ddbCrashBlockNumber = 2105 + # ------------------------------------------------------------------------------ # Helpers # ------------------------------------------------------------------------------ @@ -71,10 +120,11 @@ proc findFilePath(file: string): string = return path proc flushDbDir(s: string) = - let dataDir = s / "nimbus" - if (dataDir / "data").dirExists: - # Typically under Windows: there might be stale file locks. - try: dataDir.removeDir except: discard + if s != "": + let dataDir = s / "nimbus" + if (dataDir / "data").dirExists: + # Typically under Windows: there might be stale file locks. + try: dataDir.removeDir except: discard proc say*(noisy = false; pfx = "***"; args: varargs[string, `$`]) = if noisy: @@ -85,37 +135,90 @@ proc say*(noisy = false; pfx = "***"; args: varargs[string, `$`]) = else: echo pfx, args.toSeq.join +proc setTraceLevel = + discard + when defined(chronicles_runtime_filtering) and loggingEnabled: + setLogLevel(LogLevel.TRACE) + +proc setErrorLevel = + discard + when defined(chronicles_runtime_filtering) and loggingEnabled: + setLogLevel(LogLevel.ERROR) + +# ------------------------------------------------------------------------------ +# Private functions +# ------------------------------------------------------------------------------ + +proc ddbCleanUp(dir: string) = + if not disablePersistentDB: + ddbDir = dir + dir.flushDbDir + +proc ddbCleanUp = + ddbDir.ddbCleanUp + +proc isOK(rc: ValidationResult): bool = + rc == ValidationResult.OK + +proc ttdReached(db: BaseChainDB): bool = + if db.config.terminalTotalDifficulty.isSome: + return db.config.terminalTotalDifficulty.get <= db.totalDifficulty + +proc importBlocks(c: Chain; h: seq[BlockHeader]; b: seq[BlockBody]; + noisy = false): bool = + ## On error, the block number of the failng block is returned + let + (first, last) = (h[0].blockNumber, h[^1].blockNumber) + nTxs = b.mapIt(it.transactions.len).foldl(a+b) + nUnc = b.mapIt(it.uncles.len).foldl(a+b) + tddOk = c.db.ttdReached + bRng = if 1 < h.len: &"s [#{first}..#{last}]={h.len}" else: &" #{first}" + blurb = &"persistBlocks([#{first}..#" + + noisy.say "***", &"block{bRng} #txs={nTxs} #uncles={nUnc}" + + catchException("persistBlocks()", trace = true): + if c.persistBlocks(h, b).isOk: + if not tddOk and c.db.ttdReached: + noisy.say "***", &"block{bRng} => tddReached" + return true + # ------------------------------------------------------------------------------ # Test Runner # ------------------------------------------------------------------------------ -proc runner(noisy = true; file = jFile) = +proc genesisLoadRunner(noisy = true; + captureSession = devnet4; + persistPruneTrie = true) = + sSpcs = captureSession + let - fileInfo = file.splitFile.name.split(".")[0] - filePath = file.findFilePath + gFileInfo = sSpcs.genesisFile.splitFile.name.split(".")[0] + gFilePath = sSpcs.genesisFile.findFilePath tmpDir = if disablePersistentDB: "*notused*" - else: filePath.splitFile.dir / "tmp" + else: gFilePath.splitFile.dir / "tmp" - defer: - if not disablePersistentDB: tmpDir.flushDbDir + persistPruneInfo = if persistPruneTrie: "pruning enabled" + else: "no pruning" - suite "Kintsugi custom network test scenario": + suite &"{sSpcs.fancyName} custom network genesis & database setup": var params: NetworkParams - mdb, ddb: BaseChainDB - test &"Load params from {fileInfo}": - noisy.say "***", "custom-file=", filePath - check filePath.loadNetworkParams(params) + test &"Load params from {gFileInfo}": + noisy.say "***", "custom-file=", gFilePath + check gFilePath.loadNetworkParams(params) - test "Construct in-memory BaseChainDB": + test "Construct in-memory BaseChainDB, pruning enabled": mdb = newBaseChainDB( newMemoryDb(), id = params.config.chainID.NetworkId, params = params) - test &"Construct persistent BaseChainDB on {tmpDir}": + check mdb.ttd == sSpcs.termTotalDff + + test &"Construct persistent BaseChainDB on {tmpDir}, {persistPruneInfo}": if disablePersistentDB: skip() else: @@ -123,15 +226,17 @@ proc runner(noisy = true; file = jFile) = # cleared. There might be left overs from a previous crash or # because there were file locks under Windows which prevented a # previous clean up. - tmpDir.flushDbDir + tmpDir.ddbCleanUp # Constructor ... ddb = newBaseChainDB( tmpDir.newChainDb.trieDB, id = params.config.chainID.NetworkId, - pruneTrie = true, + pruneTrie = persistPruneTrie, params = params) + check mdb.ttd == sSpcs.termTotalDff + test "Initialise in-memory Genesis": mdb.initializeEmptyDb @@ -156,17 +261,109 @@ proc runner(noisy = true; file = jFile) = onTheFlyHeaderPP = ddb.toGenesisHeader.pp check storedhHeaderPP == onTheFlyHeaderPP + +proc testnetChainRunner(noisy = true; + memoryDB = true; + stopAfterBlock = 999999999) = + let + cFileInfo = sSpcs.captureFile.splitFile.name.split(".")[0] + cFilePath = sSpcs.captureFile.findFilePath + dbInfo = if memoryDB: "in-memory" else: "persistent" + + pivotBlockNumber = sSpcs.failBlockAt.u256 + lastBlockNumber = stopAfterBlock.u256 + ttdBlockNumber = sSpcs.ttdReachedAt.u256 + + suite &"Block chain DB inspector for {sSpcs.fancyName}": + var + bdb: BaseChainDB + chn: Chain + pivotHeader: BlockHeader + pivotBody: BlockBody + + test &"Inherit {dbInfo} block chain DB from previous session": + check not mdb.isNil + check not ddb.isNil + + # Whatever DB suits, mdb: in-memory, ddb: persistet/on-disk + bdb = if memoryDB: mdb else: ddb + + chn = bdb.newChain + noisy.say "***", "ttd", + " db.config.TTD=", chn.db.config.terminalTotalDifficulty + # " db.arrowGlacierBlock=0x", chn.db.config.arrowGlacierBlock.toHex + + test &"Replay {cFileInfo} capture, may fail ~#{pivotBlockNumber} "& + &"(slow -- time for coffee break)": + noisy.say "***", "capture-file=", cFilePath + discard + + test &"Processing {sSpcs.fancyName} blocks": + for w in cFilePath.undumpNextGroup: + let (fromBlock, toBlock) = (w[0][0].blockNumber, w[0][^1].blockNumber) + + # Install & verify Genesis + if w[0][0].blockNumber == 0.u256: + doAssert w[0][0] == bdb.getBlockHeader(0.u256) + continue + + # Persist blocks, full range before `pivotBlockNumber` + if toBlock < pivotBlockNumber: + if not chn.importBlocks(w[0], w[1], noisy): + # Just a guess -- might be any block in that range + (pivotHeader, pivotBody) = (w[0][0],w[1][0]) + break + if chn.db.ttdReached: + check ttdBlockNumber <= toBlock + else: + check toBlock < ttdBlockNumber + if lastBlockNumber <= toBlock: + break + + else: + let top = (pivotBlockNumber - fromBlock).truncate(uint64).int + + # Load the blocks before the pivot block + if 0 < top: + check chn.importBlocks(w[0][0 ..< top],w[1][0 ..< top], noisy) + + (pivotHeader, pivotBody) = (w[0][top],w[1][top]) + break + + test &"Processing {sSpcs.fancyName} block #{pivotHeader.blockNumber}, "& + &"persistBlocks() will fail": + + setTraceLevel() + + if pivotHeader.blockNumber == 0: + skip() + else: + # Expecting that the import fails at the current block ... + check not chn.importBlocks(@[pivotHeader], @[pivotBody], noisy) + # ------------------------------------------------------------------------------ # Main function(s) # ------------------------------------------------------------------------------ proc customNetworkMain*(noisy = defined(debug)) = - noisy.runner + defer: ddbCleanUp() + noisy.genesisLoadRunner when isMainModule: - var noisy = defined(debug) - noisy = true - noisy.runner + let noisy = defined(debug) or true + setErrorLevel() + + noisy.showElapsed("customNetwork"): + defer: ddbCleanUp() + + noisy.genesisLoadRunner( + # any of: devnet4, devnet5, kiln, etc. + captureSession = devnet4) + + # Note that the `testnetChainRunner()` finds the replay dump files + # typically on the `nimbus-eth1-blobs` module. + noisy.testnetChainRunner( + stopAfterBlock = 999999999) # ------------------------------------------------------------------------------ # End diff --git a/tests/test_genesis.nim b/tests/test_genesis.nim index 6688cabfe..9be08a944 100644 --- a/tests/test_genesis.nim +++ b/tests/test_genesis.nim @@ -4,8 +4,8 @@ import ../nimbus/[genesis, config, chain_config] const - baseDir = [".", "tests", ".." / "tests", $DirSep] # path containg repo - repoDir = ["customgenesis", "status"] # alternative repo paths + baseDir = [".", "tests", ".."/"tests", $DirSep] # path containg repo + repoDir = [".", "customgenesis"] # alternative repo paths proc findFilePath(file: string): string = result = "?unknown?" / file @@ -56,9 +56,9 @@ proc customGenesisTest() = check cg.config.cliquePeriod == 30 check cg.config.cliqueEpoch == 30000 - test "kintsugi.json": + test "Devnet4.json (aka Kintsugi in all but chainId)": var cg: NetworkParams - check loadNetworkParams("kintsugi.json".findFilePath, cg) + check loadNetworkParams("devnet4.json".findFilePath, cg) let h = cg.toGenesisHeader let stateRoot = "3b84f313bfd49c03cc94729ade2e0de220688f813c0c895a99bd46ecc9f45e1e".toDigest let genesisHash = "a28d8d73e087a01d09d8cb806f60863652f30b6b6dfa4e0157501ff07d422399".toDigest @@ -66,6 +66,16 @@ proc customGenesisTest() = check h.blockHash == genesisHash check cg.config.poaEngine == false + test "Devnet5.json (aka Kiln in all but chainId and TTD)": + var cg: NetworkParams + check loadNetworkParams("devnet5.json".findFilePath, cg) + let h = cg.toGenesisHeader + let stateRoot = "52e628c7f35996ba5a0402d02b34535993c89ff7fc4c430b2763ada8554bee62".toDigest + let genesisHash = "51c7fe41be669f69c45c33a56982cbde405313342d9e2b00d7c91a7b284dd4f8".toDigest + check h.stateRoot == stateRoot + check h.blockHash == genesisHash + check cg.config.poaEngine == false + proc genesisMain*() = genesisTest() customGenesisTest() diff --git a/tests/test_pow.nim b/tests/test_pow.nim index 5ca11a989..19f1b2130 100644 --- a/tests/test_pow.nim +++ b/tests/test_pow.nim @@ -10,14 +10,14 @@ import std/[os, sequtils, strformat, strutils, times], - ./replay/gunzip, + ./replay/[pp, gunzip], ../nimbus/utils/[pow, pow/pow_cache, pow/pow_dataset], eth/[common], unittest2 const baseDir = [".", "tests", ".." / "tests", $DirSep] # path containg repo - repoDir = ["test_pow", "status"] # alternative repos + repoDir = ["replay"] # alternative repos specsDump = "mainspecs2k.txt.gz" @@ -25,45 +25,6 @@ const # Helpers # ------------------------------------------------------------------------------ -proc ppMs*(elapsed: Duration): string = - result = $elapsed.inMilliSeconds - let ns = elapsed.inNanoSeconds mod 1_000_000 - if ns != 0: - # to rounded deca milli seconds - let dm = (ns + 5_000i64) div 10_000i64 - result &= &".{dm:02}" - result &= "ms" - -proc ppSecs*(elapsed: Duration): string = - result = $elapsed.inSeconds - let ns = elapsed.inNanoseconds mod 1_000_000_000 - if ns != 0: - # to rounded decs seconds - let ds = (ns + 5_000_000i64) div 10_000_000i64 - result &= &".{ds:02}" - result &= "s" - -proc toKMG*[T](s: T): string = - proc subst(s: var string; tag, new: string): bool = - if tag.len < s.len and s[s.len - tag.len ..< s.len] == tag: - s = s[0 ..< s.len - tag.len] & new - return true - result = $s - for w in [("000", "K"),("000K","M"),("000M","G"),("000G","T"), - ("000T","P"),("000P","E"),("000E","Z"),("000Z","Y")]: - if not result.subst(w[0],w[1]): - return - -template showElapsed*(noisy: bool; info: string; code: untyped) = - let start = getTime() - code - if noisy: - let elpd {.inject.} = getTime() - start - if 0 < elpd.inSeconds: - echo "*** ", info, &": {elpd.ppSecs:>4}" - else: - echo "*** ", info, &": {elpd.ppMs:>4}" - proc say*(noisy = false; pfx = "***"; args: varargs[string, `$`]) = if noisy: if args.len == 0: @@ -73,13 +34,6 @@ proc say*(noisy = false; pfx = "***"; args: varargs[string, `$`]) = else: echo pfx, args.toSeq.join -proc pp*(a: BlockNonce): string = - a.mapIt(it.toHex(2)).join.toLowerAscii - -proc pp*(a: Hash256): string = - a.data.mapIt(it.toHex(2)).join[24 .. 31].toLowerAscii - - proc findFilePath(file: string): string = result = "?unknown?" / file for dir in baseDir: diff --git a/tests/test_txpool.nim b/tests/test_txpool.nim index 2989c65b4..2c5a80fae 100644 --- a/tests/test_txpool.nim +++ b/tests/test_txpool.nim @@ -29,8 +29,8 @@ type const prngSeed = 42 - baseDir = [".", "tests", ".." / "tests", $DirSep] # path containg repo - repoDir = ["replay", "status"] # alternative repos + baseDir = [".", "..", ".."/"..", $DirSep] + repoDir = [".", "tests"/"replay", "nimbus-eth1-blobs"/"replay"] goerliCapture: CaptureSpecs = ( network: GoerliNet, @@ -134,6 +134,16 @@ proc findFilePath(file: string): string = if path.fileExists: return path +proc setTraceLevel = + discard + when defined(chronicles_runtime_filtering) and loggingEnabled: + setLogLevel(LogLevel.TRACE) + +proc setErrorLevel = + discard + when defined(chronicles_runtime_filtering) and loggingEnabled: + setLogLevel(LogLevel.ERROR) + # ------------------------------------------------------------------------------ # Test Runners # ------------------------------------------------------------------------------ @@ -894,11 +904,13 @@ when isMainModule: const noisy = defined(debug) capts0: CaptureSpecs = goerliCapture - capts1: CaptureSpecs = (GoerliNet, "goerli504192.txt.gz", 30000, 500, 1500) + capts1: CaptureSpecs = (GoerliNet, "goerli482304.txt.gz", 30000, 500, 1500) # Note: mainnet has the leading 45k blocks without any transactions - capts2: CaptureSpecs = (MainNet, "mainnet843841.txt.gz", 30000, 500, 1500) + capts2: CaptureSpecs = (MainNet, "mainnet332160.txt.gz", 30000, 500, 1500) - noisy.runTxLoader(capture = capts2) + setErrorLevel() + + noisy.runTxLoader(capture = capts1) noisy.runTxPoolTests true.runTxPackerTests diff --git a/tests/test_txpool/helpers.nim b/tests/test_txpool/helpers.nim index 596aad2e1..14c44bc6c 100644 --- a/tests/test_txpool/helpers.nim +++ b/tests/test_txpool/helpers.nim @@ -186,16 +186,6 @@ proc isOK*(rc: ValidationResult): bool = proc toHex*(acc: EthAddress): string = acc.toSeq.mapIt(it.toHex(2)).join -template showElapsed*(noisy: bool; info: string; code: untyped) = - let start = getTime() - code - if noisy: - let elpd {.inject.} = getTime() - start - if 0 < elpd.inSeconds: - echo "*** ", info, &": {elpd.ppSecs:>4}" - else: - echo "*** ", info, &": {elpd.ppMs:>4}" - proc say*(noisy = false; pfx = "***"; args: varargs[string, `$`]) = if noisy: if args.len == 0: