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 vmState = newBaseVMState(head, c.db)
let validationResult = processBlock(c.db, head, headers[i], bodies[i], vmState) 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: if validationResult == ValidationResult.Error:
dumpDebuggingMetaData(c.db, headers[i], bodies[i], vmState.receipts) dumpDebuggingMetaData(c.db, headers[i], bodies[i], vmState.receipts)

View File

@ -1,7 +1,7 @@
import import
json, os, stint, eth_trie/db, byteutils, eth_common, json, os, stint, eth_trie/db, byteutils, eth_common,
../nimbus/db/[db_chain], ../nimbus/p2p/chain, ../nimbus/db/[db_chain], chronicles, ../nimbus/vm_state,
chronicles ../nimbus/p2p/executor
proc prepareBlockEnv(node: JsonNode, memoryDB: TrieDatabaseRef) = proc prepareBlockEnv(node: JsonNode, memoryDB: TrieDatabaseRef) =
let state = node["state"] let state = node["state"]
@ -13,18 +13,16 @@ proc prepareBlockEnv(node: JsonNode, memoryDB: TrieDatabaseRef) =
proc executeBlock(memoryDB: TrieDatabaseRef, blockNumber: Uint256) = proc executeBlock(memoryDB: TrieDatabaseRef, blockNumber: Uint256) =
let let
chainDB = newBaseChainDB(memoryDB, false)
parentNumber = blockNumber - 1 parentNumber = blockNumber - 1
chainDB = newBaseChainDB(memoryDB, false)
parent = chainDB.getBlockHeader(parentNumber) parent = chainDB.getBlockHeader(parentNumber)
header = chainDB.getBlockHeader(blockNumber) header = chainDB.getBlockHeader(blockNumber)
headerHash = header.blockHash body = chainDB.getBlockBody(header.blockHash)
body = chainDB.getBlockBody(headerHash)
chain = newChain(chainDB) let
headers = @[header] vmState = newBaseVMState(parent, chainDB)
bodies = @[body] validationResult = processBlock(chainDB, parent, header, body, vmState)
chainDB.setHead(parent, true)
let validationResult = chain.persistBlocks(headers, bodies)
if validationResult != ValidationResult.OK: if validationResult != ValidationResult.OK:
error "block validation error", validationResult error "block validation error", validationResult
else: else:

View File

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