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

Implement EIP-7549 #5512

Closed
wants to merge 36 commits into from
Closed

Implement EIP-7549 #5512

wants to merge 36 commits into from

Conversation

eserilev
Copy link
Collaborator

@eserilev eserilev commented Apr 2, 2024

Issue Addressed

#5130

@eserilev eserilev added electra Required for the Electra/Prague fork work-in-progress PR is a work-in-progress labels Apr 2, 2024
@eserilev eserilev changed the title Implement EIP 7549 Implement EIP-7549 Apr 2, 2024
@@ -3271,6 +3271,7 @@ impl ApiTester {

let mut attestation = Attestation {
aggregation_bits: BitList::with_capacity(duty.committee_length as usize).unwrap(),
index: <_>::default(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Setting it to the value 0 feels more explicit than using default. use .into() or the type new()

@macladson macladson mentioned this pull request Apr 4, 2024
.map_err(|e| BeaconChainError::from(e).into())
}
Attestation::Electra(att) => {
// TODO(eip7594) need to get access to the beacon state
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why access to the full state? You just need the entire shuffling

Copy link
Member

Choose a reason for hiding this comment

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

I chatted about this with Eitan on Tuesday and recommended plumbing through the committee cache with the full set of committees. Just requires a bit of tweaking of map_committee_cache

beacon_node/beacon_chain/src/naive_aggregation_pool.rs Outdated Show resolved Hide resolved
consensus/state_processing/src/consensus_context.rs Outdated Show resolved Hide resolved
}
}

pub mod electra {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not necessary to duplicate all this logic. The only difference is when converting an on-chain attestation to an indexed attestation which can be common in all forks. Just convert attestations from any fork into the electra indexed attestation. The relevant attestation data for reward processing is the same too.

Comment on lines 635 to 636
// TODO(eip7549) is setting to default ok here?
attestations: <_>::default(),
Copy link
Collaborator

@dapplion dapplion Apr 9, 2024

Choose a reason for hiding this comment

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

No, that is not representative of the maximum size. You need to create a list with max count of electra attestations of maximum size


#[superstruct(only(Electra), partial_getter(rename = "attesting_indices_electra"))]
#[serde(with = "quoted_variable_list_u64")]
pub attesting_indices: VariableList<u64, E::MaxValidatorsPerCommitteePerSlot>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

oooohhh that's annoying.. Hmm in practice this change does not affect much as it strictly increases the maximum length of the list. This is only relevant when merkleizing attester slashings. In LH internals we can have a common type for both or just use the bigger electra variant everywhere, and downsize to the base when doing block inclusions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

im now using the electra variant everywhere, though i still need to add logic to downsize & enfore the smaller list size for the base variant

@eserilev eserilev force-pushed the eip-7549 branch 4 times, most recently from 020fe50 to 1bc3b79 Compare April 13, 2024 14:53
proposer_index,
}),
Attestation::Electra(att) => {
PendingAttestation::Electra(PendingAttestationElectra {
Copy link
Member

Choose a reason for hiding this comment

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

this should just an error

#[serde(untagged)]
#[tree_hash(enum_behaviour = "transparent")]
#[ssz(enum_behaviour = "transparent")]
#[serde(bound = "E: EthSpec", deny_unknown_fields)]
#[arbitrary(bound = "E: EthSpec")]
pub struct PendingAttestation<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 doesn't need be superstructed (it is phase0 only)

@eserilev eserilev closed this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electra Required for the Electra/Prague fork work-in-progress PR is a work-in-progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants