better logging for running client (#2781)

* better logging for running client

* logs for persistance + more data

* persistance logs fixed

* blobgas

* blobGas is Opt

* suggestions added

* fcU fixed
This commit is contained in:
Advaita Saha 2024-10-28 03:50:04 +05:30 committed by GitHub
parent d828dead2d
commit ba1cbed14f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 5 deletions

View File

@ -196,12 +196,22 @@ proc forkchoiceUpdated*(ben: BeaconEngineRef,
bundle.blobsBundle,
bundle.executionRequests)
info "Created payload for sealing",
id = id.toHex,
hash = bundle.executionPayload.blockHash.short,
info "Created payload for block proposal",
number = bundle.executionPayload.blockNumber,
attr = attrs
hash = bundle.executionPayload.blockHash.short,
txs = bundle.executionPayload.transactions.len,
gasUsed = bundle.executionPayload.gasUsed,
blobGasUsed = bundle.executionPayload.blobGasUsed.get(Quantity(0)),
id = id.toHex,
attrs = attrs
return validFCU(Opt.some(id), blockHash)
info "Fork choice updated",
requested = header.number,
hash = blockHash.short,
head = ben.chain.latestNumber,
base = ben.chain.baseNumber,
baseHash = ben.chain.baseHash.short
return validFCU(Opt.none(Bytes8), blockHash)

View File

@ -12,7 +12,7 @@ import
../web3_eth_conv,
eth/common/hashes,
../beacon_engine,
web3/execution_types,
web3/[execution_types, primitives],
../payload_conv,
./api_utils,
chronicles
@ -196,4 +196,12 @@ proc newPayload*(ben: BeaconEngineRef,
let blockHash = latestValidHash(db, parent, ttd)
return invalidStatus(blockHash, vres.error())
info "New payload received and validated",
number = header.number,
hash = blockHash.short,
parent = header.parentHash.short,
txs = blk.transactions.len,
gasUsed = header.gasUsed,
blobGas = header.blobGasUsed.get(0'u64)
return validStatus(blockHash)

View File

@ -11,6 +11,7 @@
{.push raises: [].}
import
chronicles,
std/tables,
../../common,
../../db/core_db,
@ -212,6 +213,7 @@ proc writeBaggage(c: ForkedChainRef, target: Hash32) =
shouldNotKeyError:
var prevHash = target
var count = 0'u64
while prevHash != c.baseHash:
let blk = c.blocks[prevHash]
c.db.persistTransactions(header.number, header.txRoot, blk.blk.transactions)
@ -224,6 +226,13 @@ proc writeBaggage(c: ForkedChainRef, target: Hash32) =
for tx in blk.blk.transactions:
c.txRecords.del(rlpHash(tx))
prevHash = header.parentHash
count.inc
notice "Finalized blocks persisted",
numberOfBlocks = count,
last = target.short,
baseNumber = c.baseHeader.number,
baseHash = c.baseHash.short
func updateBase(c: ForkedChainRef,
newBaseHash: Hash32,
@ -620,6 +629,9 @@ func latestHash*(c: ForkedChainRef): Hash32 =
func baseNumber*(c: ForkedChainRef): BlockNumber =
c.baseHeader.number
func baseHash*(c: ForkedChainRef): Hash32 =
c.baseHash
func txRecords*(c: ForkedChainRef, txHash: Hash32): (Hash32, uint64) =
c.txRecords.getOrDefault(txHash, (Hash32.default, 0'u64))