fix: ensure block in forkchoice before validate by_root payload#9479
Conversation
There was a problem hiding this comment.
Code Review
This pull request defers execution payload envelope validation until the corresponding block is imported into the fork choice. Previously, a non-null payloadInput (which can be seeded from the block body during download) was assumed to mean the block was already imported, leading to potential validation failures (such as BLOCK_ROOT_UNKNOWN). The changes ensure that the fork choice is checked first, deferring validation and pulling the block if it is not yet imported. A new unit test has been added to verify this behavior. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Performance Report✔️ no performance regression detected Full benchmark results
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #9479 +/- ##
=========================================
Coverage 52.59% 52.59%
=========================================
Files 848 848
Lines 60890 60890
Branches 4485 4485
=========================================
Hits 32023 32023
Misses 28805 28805
Partials 62 62 🚀 New features to boost your workflow:
|
nflaig
left a comment
There was a problem hiding this comment.
LGTM, already had this code running on the devnet for over a day, no issues there
…emit (#9492) ## Summary The base-branch update brought in #9479's new test ("defers envelope validation until the block is in fork choice when payload input is seeded from the block body") which uses the same `let emitter!: ChainEventEmitter` + destructuring-assignment + sibling closure capture pattern that #9491 already mitigated in the original failing test below. Same `TS2769` fires at the new test's emit site: ``` test/unit/sync/unknownBlock.test.ts(1027,20): error TS2769: No overload matches this call. Argument of type 'ChainEvent.unknownEnvelopeBlockRoot' is not assignable to parameter of type 'unique symbol'. ``` Also, #9479's emit predates this PR's addition of `slot: Slot` to the `ChainEvent.unknownEnvelopeBlockRoot` event signature, so the emit data is missing the required `slot` field after the merge. ## Fix Same minimal cast workaround as #9491 plus the required `slot: 0` field: ```diff - emitter.emit(ChainEvent.unknownEnvelopeBlockRoot, { + // tsgo overload-resolution miss when emit is reached through a closure that captures emitter + // first; cast re-anchors the StrictEventEmitter overload for ChainEvent keys (see #9491). + (emitter as ChainEventEmitter).emit(ChainEvent.unknownEnvelopeBlockRoot, { rootHex: blockRootHex, + slot: 0, peer, source: BlockInputSource.gossip, }); ``` Single-site change. The 5 other `emitter.emit(ChainEvent.unknownEnvelopeBlockRoot, ...)` sites in the file remain unchanged because they aren't reached through a sibling closure capture; the cast at the sibling test's emit (introduced in #9491, currently at line 1126) also remains as-is and continues to typecheck cleanly with the expanded `EventType` union from #9439. ## Test plan - [ ] CI: `Type Checks (24)` passes (no TS2769 on `unknownBlock.test.ts`). - [ ] CI: the new `defers envelope validation until the block is in fork choice when payload input is seeded from the block body` test still passes — emit semantics unchanged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: lodekeeper <lodekeeper@users.noreply.github.com>
Motivation
validateGossipExecutionPayloadEnvelope()because block was not in forkchoceDescription
Closes #9478
AI Assistance Disclosure