fix debug tool

This commit is contained in:
andri lim 2019-01-12 19:49:08 +07:00 committed by zah
parent e104153379
commit 78367bf10a
3 changed files with 9 additions and 12 deletions

View File

@ -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)

View File

@ -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:

View File

@ -1 +0,0 @@
-d:debugging_tool