mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-28 20:00:43 +00:00
Fix logging in block processing (#2870)
* log blockhash and parentHash in stateRoot mismatch * logs for case when parent not found * some more logs in epilogue * add parentHash
This commit is contained in:
parent
daaf0f2a20
commit
5e152f9436
@ -482,6 +482,9 @@ proc importBlock*(c: ForkedChainRef, blk: Block): Result[void, string] =
|
||||
if header.parentHash notin c.blocks:
|
||||
# If it's parent is an invalid block
|
||||
# there is no hope the descendant is valid
|
||||
debug "Parent block not found",
|
||||
blockHash = header.blockHash.short,
|
||||
parentHash = header.parentHash.short
|
||||
return err("Block is not part of valid chain")
|
||||
|
||||
# TODO: If engine API keep importing blocks
|
||||
|
@ -168,6 +168,8 @@ proc procBlkEpilogue(
|
||||
# TODO replace logging with better error
|
||||
debug "wrong state root in block",
|
||||
blockNumber = header.number,
|
||||
blockHash = header.blockHash,
|
||||
parentHash = header.parentHash,
|
||||
expected = header.stateRoot,
|
||||
actual = stateRoot,
|
||||
arrivedFrom = vmState.parent.stateRoot
|
||||
@ -178,6 +180,10 @@ proc procBlkEpilogue(
|
||||
let bloom = createBloom(vmState.receipts)
|
||||
|
||||
if header.logsBloom != bloom:
|
||||
debug "wrong logsBloom in block",
|
||||
blockNumber = header.number,
|
||||
actual = bloom,
|
||||
expected = header.logsBloom
|
||||
return err("bloom mismatch")
|
||||
|
||||
let receiptsRoot = calcReceiptsRoot(vmState.receipts)
|
||||
@ -185,6 +191,8 @@ proc procBlkEpilogue(
|
||||
# TODO replace logging with better error
|
||||
debug "wrong receiptRoot in block",
|
||||
blockNumber = header.number,
|
||||
parentHash = header.parentHash.short,
|
||||
blockHash = header.blockHash.short,
|
||||
actual = receiptsRoot,
|
||||
expected = header.receiptsRoot
|
||||
return err("receiptRoot mismatch")
|
||||
@ -197,6 +205,8 @@ proc procBlkEpilogue(
|
||||
if header.requestsHash.get != requestsHash:
|
||||
debug "wrong requestsHash in block",
|
||||
blockNumber = header.number,
|
||||
parentHash = header.parentHash.short,
|
||||
blockHash = header.blockHash.short,
|
||||
actual = requestsHash,
|
||||
expected = header.requestsHash.get
|
||||
return err("requestsHash mismatch")
|
||||
|
Loading…
x
Reference in New Issue
Block a user