diff --git a/nimbus/p2p/chain.nim b/nimbus/p2p/chain.nim index a837f1106..a187cc907 100644 --- a/nimbus/p2p/chain.nim +++ b/nimbus/p2p/chain.nim @@ -45,7 +45,7 @@ method persistBlocks*(c: Chain, headers: openarray[BlockHeader], bodies: openarr let vmState = newBaseVMState(head, c.db) let validationResult = processBlock(c.db, head, headers[i], bodies[i], vmState) - when not defined(release) and not defined(debugging_tool): + when not defined(release): if validationResult == ValidationResult.Error: dumpDebuggingMetaData(c.db, headers[i], bodies[i], vmState.receipts) diff --git a/premix/debug.nim b/premix/debug.nim index 45cd16565..c7fcf0297 100644 --- a/premix/debug.nim +++ b/premix/debug.nim @@ -1,7 +1,7 @@ import json, os, stint, eth_trie/db, byteutils, eth_common, - ../nimbus/db/[db_chain], ../nimbus/p2p/chain, - chronicles + ../nimbus/db/[db_chain], chronicles, ../nimbus/vm_state, + ../nimbus/p2p/executor proc prepareBlockEnv(node: JsonNode, memoryDB: TrieDatabaseRef) = let state = node["state"] @@ -13,18 +13,16 @@ proc prepareBlockEnv(node: JsonNode, memoryDB: TrieDatabaseRef) = proc executeBlock(memoryDB: TrieDatabaseRef, blockNumber: Uint256) = let - chainDB = newBaseChainDB(memoryDB, false) parentNumber = blockNumber - 1 + chainDB = newBaseChainDB(memoryDB, false) parent = chainDB.getBlockHeader(parentNumber) header = chainDB.getBlockHeader(blockNumber) - headerHash = header.blockHash - body = chainDB.getBlockBody(headerHash) - chain = newChain(chainDB) - headers = @[header] - bodies = @[body] + body = chainDB.getBlockBody(header.blockHash) + + let + vmState = newBaseVMState(parent, chainDB) + validationResult = processBlock(chainDB, parent, header, body, vmState) - chainDB.setHead(parent, true) - let validationResult = chain.persistBlocks(headers, bodies) if validationResult != ValidationResult.OK: error "block validation error", validationResult else: diff --git a/premix/debug.nim.cfg b/premix/debug.nim.cfg deleted file mode 100644 index a31f7504a..000000000 --- a/premix/debug.nim.cfg +++ /dev/null @@ -1 +0,0 @@ --d:debugging_tool \ No newline at end of file