mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 13:24:21 +00:00
fixes debugger
This commit is contained in:
parent
b189e1604f
commit
4c48244cbb
@ -49,6 +49,7 @@ type
|
||||
debugMode: bool
|
||||
trace: bool
|
||||
vmState: BaseVMState
|
||||
debugData: JsonNode
|
||||
|
||||
MiningHeader* = object
|
||||
parentHash*: Hash256
|
||||
@ -528,11 +529,22 @@ func shouldCheckSeal(tester: Tester): bool =
|
||||
if tester.sealEngine.isSome:
|
||||
result = tester.sealEngine.get() != NoProof
|
||||
|
||||
proc collectDebugData(tester: var Tester) =
|
||||
let vmState = tester.vmState
|
||||
let tracingResult = if tester.trace: vmState.getTracingResult() else: %[]
|
||||
tester.debugData.add %{
|
||||
"blockNumber": %($vmState.blockNumber),
|
||||
"structLogs": tracingResult,
|
||||
}
|
||||
|
||||
proc runTester(tester: var Tester, chainDB: BaseChainDB, testStatusIMPL: var TestStatus) =
|
||||
discard chainDB.persistHeaderToDb(tester.genesisBlockHeader)
|
||||
check chainDB.getCanonicalHead().blockHash == tester.genesisBlockHeader.blockHash
|
||||
let checkSeal = tester.shouldCheckSeal
|
||||
|
||||
if tester.debugMode:
|
||||
tester.debugData = newJArray()
|
||||
|
||||
for idx, testerBlock in tester.blocks:
|
||||
let shouldBeGoodBlock = testerBlock.blockHeader.isSome
|
||||
|
||||
@ -552,6 +564,9 @@ proc runTester(tester: var Tester, chainDB: BaseChainDB, testStatusIMPL: var Tes
|
||||
# Block should have caused a validation error
|
||||
check noError == false
|
||||
|
||||
if tester.debugMode:
|
||||
tester.collectDebugData()
|
||||
|
||||
proc dumpAccount(accountDb: ReadOnlyStateDB, address: EthAddress, name: string): JsonNode =
|
||||
result = %{
|
||||
"name": %name,
|
||||
@ -572,9 +587,8 @@ proc dumpDebugData(tester: Tester, fixture: JsonNode, fixtureName: string, fixtu
|
||||
accounts[$account] = dumpAccount(vmState.readOnlyStateDB, account, "acc" & $i)
|
||||
inc i
|
||||
|
||||
let tracingResult = if tester.trace: vmState.getTracingResult() else: %[]
|
||||
let debugData = %{
|
||||
"structLogs": tracingResult,
|
||||
"debugData": tester.debugData,
|
||||
"accounts": accounts
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user