Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overzealous getUncles KvtNotFound(Kvt, ctx=get, error=GetNotFound) warning on GetBlockBodies request #2639

Open
tersec opened this issue Sep 19, 2024 · 0 comments
Labels

Comments

@tersec
Copy link
Contributor

tersec commented Sep 19, 2024

This isn't anything going wrong, and should not be a warning.

from status-im/infra-nimbus#193 (comment)

WRN 2024-09-17 09:05:17.889+00:00 getUncles()                                topics="core_db" ommersHash=3EF3400295E8F4DFE6AED323009018E85DADBB1A4D960FC5CEE0709D484F6E97 error="KvtNotFound(Kvt, ctx=get, error=GetNotFound)"

with many more like this in the logs, even before any CLs had started to use the nimbus-eth1 engine API, i.e. it was only based on connected eth68 peers. Based on this, the most likely reason is that the not completely synced nimbus-eth1 node

requestResponse:
# User message 0x05: GetBlockBodies.
proc getBlockBodies(peer: Peer, hashes: openArray[Hash256]) =
trace trEthRecvReceived & "GetBlockBodies (0x05)", peer,
hashes=hashes.len
if hashes.len > maxBodiesFetch:
debug "GetBlockBodies (0x05) requested too many bodies",
peer, requested=hashes.len, max=maxBodiesFetch
await peer.disconnect(BreachOfProtocol)
return
let ctx = peer.networkState()
let bodies = ctx.getBlockBodies(hashes)
handleHandlerError(bodies)
if bodies.get.len > 0:
trace trEthSendReplying & "with BlockBodies (0x06)", peer,
sent=bodies.get.len, requested=hashes.len
else:
trace trEthSendReplying & "EMPTY BlockBodies (0x06)", peer,
sent=0, requested=hashes.len
await response.send(bodies.get)

calling
method getBlockBodies*(ctx: EthWireRef,
hashes: openArray[Hash256]):
Result[seq[BlockBody], string]
{.gcsafe.} =
let db = ctx.db
var body: BlockBody
var list: seq[BlockBody]
for blockHash in hashes:
if db.getBlockBody(blockHash, body):
list.add body
else:
list.add BlockBody()
trace "handlers.getBlockBodies: blockBody not found", blockHash
return ok(list)

calls (eventually)
proc getBlockBody*(
db: CoreDbRef;
header: BlockHeader;
output: var BlockBody;
): bool =
try:
output.transactions = db.getTransactions(header.txRoot)
output.uncles = db.getUncles(header.ommersHash)
if header.withdrawalsRoot.isSome:
output.withdrawals = Opt.some(db.getWithdrawals(header.withdrawalsRoot.get))
true
except RlpError:
false

calls
proc getUncles*(
db: CoreDbRef;
ommersHash: Hash256;
): seq[BlockHeader]
{.gcsafe, raises: [RlpError].} =
const info = "getUncles()"
if ommersHash != EMPTY_UNCLE_HASH:
let encodedUncles = block:
let key = genericHashKey(ommersHash)
db.ctx.getKvt().get(key.toOpenArray).valueOr:
if error.error == KvtNotFound:
warn info, ommersHash, error=($$error)
return @[]
return rlp.decode(encodedUncles, seq[BlockHeader])

when the header is present but not the body is not.

For example, this can occur after having imported era1 files -- persistBlocks etc do populate the headers in the database, but not (because the blocks already live in the era1 files) the blocks themselves. And they are pre-merge, so they have non-empty uncles/ommers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants