Skip to content

fix: emit payload_attributes for local proposals by default#9258

Merged
nflaig merged 4 commits intoChainSafe:unstablefrom
eth2353:payload-attributes-for-proposer
Apr 23, 2026
Merged

fix: emit payload_attributes for local proposals by default#9258
nflaig merged 4 commits intoChainSafe:unstablefrom
eth2353:payload-attributes-for-proposer

Conversation

@eth2353
Copy link
Copy Markdown
Contributor

@eth2353 eth2353 commented Apr 22, 2026

Motivation

I was looking at the payload_attributes SSE event and noticed Lodestar behaves slightly differently from other clients. Lodestar emits the event for every slot when the --emitPayloadAttributes flag is provided, and doesn't emit it under any other condition.

Whereas other clients (Teku, Prysm, Lighthouse, Grandine) emit the event if a local proposal is expected in the next slot, and have a CLI flag that allows them to emit the event for every slot.

Description

This PR aligns Lodestar's default behavior with other clients. It adds default payload_attributes SSE emission for local block proposals, while preserving the existing --emitPayloadAttributes flag as an override to emit the event for every slot.

The emitted event now uses the proposal’s actual fee recipient and the prepared parent root.

AI Assistance Disclosure

I consulted Codex (GPT-5.4) to help draft the implementation.

@eth2353 eth2353 requested a review from a team as a code owner April 22, 2026 08:40
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the PrepareNextSlotScheduler to improve the emission of payloadAttributes SSE events. The logic now triggers an event if the node is the next proposer or if the emitPayloadAttributes flag is set. Additionally, it ensures the parentBlockRoot uses the updatedHeadRoot and corrects the feeRecipient default to a 20-byte zero address. I have no feedback to provide as the review comments were explanatory in nature.

Copy link
Copy Markdown
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should align that with other clients, I am curious what you are using it for @eth2353

prepareState: updatedPrepareState,
prepareSlot,
parentBlockRoot: fromHex(headRoot),
parentBlockRoot: fromHex(updatedHeadRoot),
Copy link
Copy Markdown
Member

@nflaig nflaig Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we just discussed this here #9209, it's definitely correct to emit updatedHeadRoot if we are the proposer in case of a proposer boost reorg, but would like to get +1 from @twoeths

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks right to me too

  • if we're the next proposal, updatedHeadRoot is the one we'll go with
  • if not, updatedHeadRoot is same to headRoot

Comment thread packages/beacon-node/src/chain/prepareNextSlot.ts
Comment thread packages/beacon-node/src/chain/prepareNextSlot.ts Outdated
Co-authored-by: Nico Flaig <nflaig@protonmail.com>
nflaig
nflaig previously approved these changes Apr 22, 2026
Copy link
Copy Markdown
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, leaving up for @twoeths for final approval/merge

@eth2353
Copy link
Copy Markdown
Contributor Author

eth2353 commented Apr 22, 2026

I am curious what you are using it for @eth2353

I'm playing around with the idea of Vero talking to relays directly, like Vouch does. For that I needed an EL parent_hash and this SSE topic seemed like the best place to get it (without the overhead of fetching full blocks).

The --emitPayloadAttributes CLI flag works fine but other clients' behavior is different (and more intuitive imo).

@nflaig
Copy link
Copy Markdown
Member

nflaig commented Apr 23, 2026

@eth2353 I think I broke your PR 😓

twoeths
twoeths previously approved these changes Apr 23, 2026
Comment thread packages/beacon-node/src/chain/prepareNextSlot.ts Outdated
@nflaig nflaig dismissed stale reviews from twoeths and themself via 334df3d April 23, 2026 20:25
@nflaig nflaig enabled auto-merge (squash) April 23, 2026 20:29
@nflaig nflaig merged commit 921c575 into ChainSafe:unstable Apr 23, 2026
19 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.52%. Comparing base (07875b3) to head (334df3d).
⚠️ Report is 1 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #9258      +/-   ##
============================================
- Coverage     52.53%   52.52%   -0.01%     
============================================
  Files           848      848              
  Lines         61309    61304       -5     
  Branches       4510     4510              
============================================
- Hits          32206    32201       -5     
  Misses        29038    29038              
  Partials         65       65              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eth2353 eth2353 deleted the payload-attributes-for-proposer branch April 23, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants