premix report page: modify header section to display block summary
This commit is contained in:
parent
f75faf54c3
commit
817bce3555
|
@ -47,7 +47,7 @@ method persistBlocks*(c: Chain, headers: openarray[BlockHeader], bodies: openarr
|
||||||
|
|
||||||
when not defined(release):
|
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)
|
||||||
raise newException(Exception, "Validation error. Debugging metadata dumped.")
|
raise newException(Exception, "Validation error. Debugging metadata dumped.")
|
||||||
|
|
||||||
if validationResult != ValidationResult.OK:
|
if validationResult != ValidationResult.OK:
|
||||||
|
|
|
@ -232,7 +232,7 @@ proc traceTransactions*(chainDB: BaseChainDB, header: BlockHeader, blockBody: Bl
|
||||||
result.add traceTransaction(chainDB, header, blockBody, i, {DisableState})
|
result.add traceTransaction(chainDB, header, blockBody, i, {DisableState})
|
||||||
|
|
||||||
proc dumpDebuggingMetaData*(chainDB: BaseChainDB, header: BlockHeader,
|
proc dumpDebuggingMetaData*(chainDB: BaseChainDB, header: BlockHeader,
|
||||||
blockBody: BlockBody, receipts: seq[Receipt], launchDebugger = true) =
|
blockBody: BlockBody, vmState: BaseVMState, launchDebugger = true) =
|
||||||
let
|
let
|
||||||
blockNumber = header.blockNumber
|
blockNumber = header.blockNumber
|
||||||
|
|
||||||
|
@ -241,13 +241,21 @@ proc dumpDebuggingMetaData*(chainDB: BaseChainDB, header: BlockHeader,
|
||||||
captureDB = newCaptureDB(chainDB.db, memoryDB)
|
captureDB = newCaptureDB(chainDB.db, memoryDB)
|
||||||
captureTrieDB = trieDB captureDB
|
captureTrieDB = trieDB captureDB
|
||||||
captureChainDB = newBaseChainDB(captureTrieDB, false)
|
captureChainDB = newBaseChainDB(captureTrieDB, false)
|
||||||
|
bloom = createBloom(vmState.receipts)
|
||||||
|
|
||||||
|
let blockSummary = %{
|
||||||
|
"receiptsRoot": %("0x" & toHex(calcReceiptRoot(vmState.receipts).data)),
|
||||||
|
"stateRoot": %("0x" & toHex(vmState.accountDb.rootHash.data)),
|
||||||
|
"logsBloom": %("0x" & toHex(bloom))
|
||||||
|
}
|
||||||
|
|
||||||
var metaData = %{
|
var metaData = %{
|
||||||
"blockNumber": %blockNumber.toHex,
|
"blockNumber": %blockNumber.toHex,
|
||||||
"txTraces": traceTransactions(captureChainDB, header, blockBody),
|
"txTraces": traceTransactions(captureChainDB, header, blockBody),
|
||||||
"stateDump": dumpBlockState(captureChainDB, header, blockBody),
|
"stateDump": dumpBlockState(captureChainDB, header, blockBody),
|
||||||
"blockTrace": traceBlock(captureChainDB, header, blockBody, {DisableState}),
|
"blockTrace": traceBlock(captureChainDB, header, blockBody, {DisableState}),
|
||||||
"receipts": toJson(receipts)
|
"receipts": toJson(vmState.receipts),
|
||||||
|
"block": blockSummary
|
||||||
}
|
}
|
||||||
|
|
||||||
metaData.dumpMemoryDB(memoryDB)
|
metaData.dumpMemoryDB(memoryDB)
|
||||||
|
|
|
@ -367,6 +367,11 @@ function headerRenderer(nimbus, geth) {
|
||||||
let container = $('#headerContainer').empty();
|
let container = $('#headerContainer').empty();
|
||||||
$('#headerTitle').text('Block #' + parseInt(geth.block.number, 16));
|
$('#headerTitle').text('Block #' + parseInt(geth.block.number, 16));
|
||||||
|
|
||||||
|
let body = premix.newTable(container);
|
||||||
|
const blockSummary = ['stateRoot', 'receiptsRoot', 'logsBloom'];
|
||||||
|
for(var idx of blockSummary) {
|
||||||
|
premix.renderRow(body, nimbus.block, geth.block, idx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateNavigation(txs, nimbus, geth) {
|
function generateNavigation(txs, nimbus, geth) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ proc executeBlock(blockEnv: JsonNode, memoryDB: TrieDatabaseRef, blockNumber: Ui
|
||||||
else:
|
else:
|
||||||
info "block validation success", validationResult, blockNumber
|
info "block validation success", validationResult, blockNumber
|
||||||
|
|
||||||
dumpDebuggingMetaData(chainDB, header, body, vmState.receipts, false)
|
dumpDebuggingMetaData(chainDB, header, body, vmState, false)
|
||||||
let
|
let
|
||||||
fileName = "debug" & $blockNumber & ".json"
|
fileName = "debug" & $blockNumber & ".json"
|
||||||
nimbus = json.parseFile(fileName)
|
nimbus = json.parseFile(fileName)
|
||||||
|
|
|
@ -26,7 +26,7 @@ proc dumpDebug(chainDB: BaseChainDB, blockNumber: Uint256) =
|
||||||
|
|
||||||
captureChainDB.setHead(parent, true)
|
captureChainDB.setHead(parent, true)
|
||||||
let validationResult = processBlock(captureChainDB, parent, header, body, vmState)
|
let validationResult = processBlock(captureChainDB, parent, header, body, vmState)
|
||||||
dumpDebuggingMetaData(captureChainDB, header, body, vmState.receipts, false)
|
dumpDebuggingMetaData(captureChainDB, header, body, vmState, false)
|
||||||
|
|
||||||
proc main() =
|
proc main() =
|
||||||
let conf = getConfiguration()
|
let conf = getConfiguration()
|
||||||
|
|
|
@ -75,7 +75,7 @@ proc huntProblematicBlock(blockNumber: Uint256): ValidationResult =
|
||||||
|
|
||||||
if validationResult != ValidationResult.OK:
|
if validationResult != ValidationResult.OK:
|
||||||
transaction.dispose()
|
transaction.dispose()
|
||||||
dumpDebuggingMetaData(chainDB, thisBlock.header, thisBlock.body, vmState.receipts, false)
|
dumpDebuggingMetaData(chainDB, thisBlock.header, thisBlock.body, vmState, false)
|
||||||
|
|
||||||
result = validationResult
|
result = validationResult
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue