Skip to content

Conversation

@shane-moore
Copy link

@shane-moore shane-moore commented Oct 24, 2025

Changes per spec

  • process_attestations modified
    • is_attestation_same_slot added
    • get_attestation_participation_flag_indices modified

How This Works

The fast path for converting a slot's builder_pending_payment to a builder_pending_withdrawal triggers when the execution payload envelope for that slot is received and verified. In that case, we immediately queue the withdrawal corresponding to the CL block that carried the bid.

However, the envelope may never be released. As a fallback, we want to convert the builder_pending_payment if enough validators attested on time to the block of that slot.

What this PR Changes

Therefore, the builder_pending_payment has a weight field. During block processing, this PR modifies process_attestation to updates this weight only for same slot attestations, adding the attester’s balance once per validator. (Note that same slot means that the attestation.data.beacon_block_root corresponds to the state.get_block_root(data.slot)).

In a future PR

Later, during epoch processing, we'll check if the weight is above quorum and if so, convert the builder_pending_payment to a builder_pending_withdrawal, which will have a withdrawable_epoch.

@ethDreamer

@shane-moore shane-moore force-pushed the epbs-process-attestation branch from 2611ffc to def8e8e Compare October 24, 2025 14:27
@chong-he chong-he added the gloas label Oct 24, 2025
@shane-moore shane-moore force-pushed the epbs-process-attestation branch from def8e8e to 9d93170 Compare October 24, 2025 14:49
Copy link
Member

@eserilev eserilev left a comment

Choose a reason for hiding this comment

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

I haven't done a review against the spec yet, just some nits to hopefully make this PR a little bit easier to review

@@ -0,0 +1,322 @@
use super::*;
Copy link
Member

Choose a reason for hiding this comment

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

could we keep this stuff in process_operations? Makes the PR a bit easier to review if the diff here is minimized. The changes here are a bit sensitive and I don't want to miss anything

Copy link
Author

Choose a reason for hiding this comment

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

@eserilev, I feel you on that! moved the logic over to process_operations

let is_matching_payload = if is_attestation_same_slot(state, data)? {
// For same-slot attestations, data.index must be 0
if data.index != 0 {
// TODO(EIP7732): consider if we want to use a different error type, since this is more of an overloaded data index scenario as opposed to the InvalidCommitteeIndex previous error. It's more like `AttestationInvalid::BadOverloadedDataIndex`
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be nice to introduce a new error variant

Copy link
Author

Choose a reason for hiding this comment

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

for sure, I updated to the following but am happy to name it something else if another preference

  if data.index != 0 {
                return Err(Error::BadOverloadedDataIndex(data.index));
   }

if state.fork_name_unchecked().altair_enabled() {
initialize_progressive_balances_cache(state, spec)?;
altair_deneb::process_attestation(
altair_gloas::altair::process_attestation(
Copy link
Member

Choose a reason for hiding this comment

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

we'll write a test case for the gloas case in a subequent PR I assume?

Copy link
Author

Choose a reason for hiding this comment

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

yep! added a TODO to write some test cases for this. we'll be able to write tests for gloas features once we can properly produce gloas blocks and payloads.

// TODO(EIP-7732): add test cases to `consensus/state_processing/src/per_block_processing/tests.rs` to handle gloas.
// The tests will require being able to build gloas blocks, which currently fails due to errors as mentioned here.
// https://github.com/sigp/lighthouse/pull/8273

probably within the next couple weeks I would think. At that point, I'll go back and create tests for this and my other recent PR's, which also have TODO's for testing

@shane-moore shane-moore force-pushed the epbs-process-attestation branch 2 times, most recently from d08908b to 72fec1d Compare October 25, 2025 12:22
@shane-moore shane-moore changed the title gloas modify process_attestations Gloas modify process_attestations Oct 27, 2025
use types::{AttestationData, BeaconState, BeaconStateError, EthSpec};

/// Checks if the attestation was for the block proposed at the attestation slot.
pub fn is_attestation_same_slot<E: EthSpec>(
Copy link
Member

Choose a reason for hiding this comment

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

this seems like something that might just be a function on the BeaconState itself rather than in its own file?

Copy link
Author

Choose a reason for hiding this comment

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

@ethDreamer, makes sense to me. updated in 4d199a5

@ethDreamer ethDreamer mentioned this pull request Nov 10, 2025
87 tasks
@shane-moore shane-moore force-pushed the epbs-process-attestation branch from 72fec1d to 4d199a5 Compare November 11, 2025 16:39
&& data.target.root == *state.get_block_root_at_epoch(data.target.epoch)?;
let is_matching_head =

let is_matching_blockroot =
Copy link
Member

@ethDreamer ethDreamer Nov 18, 2025

Choose a reason for hiding this comment

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

Honestly i feel this code would be much easier to check if you just assign a variable to head_root_matches like the spec does. The spec may over-assign variables but I don't think that matters terribly for performance but it's just much easier to compare to the spec then.

Copy link
Author

Choose a reason for hiding this comment

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

ah yah @ethDreamer , looks like head_root_matches came out of a more recent PR than the v1.6.0-beta.1 release, which I thought was devnet-0 target. i asked in epbs channel if that's still the target, and they seem like they're open to devnet-0 being based on at least the latest release, v1.6.1.

i've pushed commit to handle all the relevant changes to this function per latest spec.

Additionally, this week, I'll attempt to go through all the spec changes from v1.6.0-beta.1 til recent as to handle anything we'll need for self-building

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants