Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 15 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,11 @@ incremental = false
inherits = "release"
debug = true

[patch.crates-io]
# FIXME(mac): EIP-7688 development patches
ssz_types = { git = "https://github.com/sigp/ssz_types", branch = "progressive" }
milhouse = { git = "https://github.com/sigp/milhouse", branch = "progressive-list" }
ethereum_ssz = { git = "https://github.com/sigp/ethereum_ssz", branch = "progressive" }
ethereum_ssz_derive = { git = "https://github.com/sigp/ethereum_ssz", branch = "progressive" }
tree_hash = { git = "https://github.com/sigp/tree_hash", branch = "progressive" }
tree_hash_derive = { git = "https://github.com/sigp/tree_hash", branch = "progressive" }
32 changes: 32 additions & 0 deletions beacon_node/beacon_chain/src/attestation_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ use state_processing::{
common::{
attesting_indices_base,
attesting_indices_electra::{self, get_committee_indices},
attesting_indices_gloas,
},
per_block_processing::errors::{AttestationValidationError, BlockOperationError},
signature_sets::{
Expand Down Expand Up @@ -668,6 +669,16 @@ impl<'a, T: BeaconChainTypes> IndexedAggregatedAttestation<'a, T> {
signed_aggregate.message.selection_proof.clone(),
signed_aggregate.message.aggregate.data.clone(),
),
SignedAggregateAndProof::Gloas(signed_aggregate) => (
signed_aggregate
.message
.aggregate
.committee_index()
.ok_or(Error::NotExactlyOneCommitteeBitSet(0))?,
signed_aggregate.message.aggregator_index,
signed_aggregate.message.selection_proof.clone(),
signed_aggregate.message.aggregate.data.clone(),
),
};
let slot = data.slot;

Expand Down Expand Up @@ -704,6 +715,13 @@ impl<'a, T: BeaconChainTypes> IndexedAggregatedAttestation<'a, T> {
)
.map_err(|e| BeaconChainError::from(e).into())
}
SignedAggregateAndProof::Gloas(signed_aggregate) => {
attesting_indices_gloas::get_indexed_attestation(
&committees,
&signed_aggregate.message.aggregate,
)
.map_err(|e| BeaconChainError::from(e).into())
}
}
};

Expand Down Expand Up @@ -1532,6 +1550,20 @@ pub fn obtain_indexed_attestation_and_committees_per_slot<T: BeaconChainTypes>(
}
})
}
AttestationRef::Gloas(att) => {
attesting_indices_gloas::get_indexed_attestation(&committees, att)
.map(|attestation| (attestation, committees_per_slot))
.map_err(|e| {
if let BlockOperationError::BeaconStateError(NoCommitteeFound(index)) = e {
Error::NoCommitteeForSlotAndIndex {
slot: att.data.slot,
index,
}
} else {
Error::Invalid(e)
}
})
}
}
})
}
Expand Down
8 changes: 5 additions & 3 deletions beacon_node/beacon_chain/src/beacon_block_reward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.safe_mul(WEIGHT_DENOMINATOR)?
.safe_div(PROPOSER_WEIGHT)?;

let mut current_epoch_participation = state.current_epoch_participation()?.clone();
let mut previous_epoch_participation = state.previous_epoch_participation()?.clone();
let mut current_epoch_participation = state.current_epoch_participation()?.to_owned_list();
let mut previous_epoch_participation =
state.previous_epoch_participation()?.to_owned_list();

for attestation in block.body().attestations() {
let data = attestation.data();
Expand All @@ -289,7 +290,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
};

let validator_participation = epoch_participation
.get_mut(index)
.as_mut()
.into_get_mut(index)
.ok_or(BeaconStateError::ParticipationOutOfBounds(index))?;

if participation_flag_indices.contains(&flag_index)
Expand Down
14 changes: 13 additions & 1 deletion beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
if header_from_payload != execution_payload_header {
for txn in execution_payload.transactions() {
debug!(
bytes = format!("0x{}", hex::encode(&**txn)),
bytes = format!("0x{}", hex::encode(txn)),
"Reconstructed txn"
);
}
Expand Down Expand Up @@ -1760,6 +1760,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
att.committee_index()
.ok_or(Error::AttestationCommitteeIndexNotSet)?,
),
AttestationRef::Gloas(att) => self.get_aggregated_attestation_electra(
att.data.slot,
&att.data.tree_hash_root(),
att.committee_index()
.ok_or(Error::AttestationCommitteeIndexNotSet)?,
),
}
}

Expand Down Expand Up @@ -5781,6 +5787,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
match slashing {
AttesterSlashing::Base(slashing) => base.push(slashing),
AttesterSlashing::Electra(slashing) => electra.push(slashing),
// Gloas-typed slashings cannot be included in pre-Gloas blocks, and
// Gloas blocks are produced via `complete_partial_beacon_block_gloas`.
AttesterSlashing::Gloas(_) => (),
}
(base, electra)
},
Expand All @@ -5791,6 +5800,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
match attestation {
Attestation::Base(attestation) => base.push(attestation),
Attestation::Electra(attestation) => electra.push(attestation),
// Gloas-typed attestations cannot be included in pre-Gloas blocks, and
// Gloas blocks are produced via `complete_partial_beacon_block_gloas`.
Attestation::Gloas(_) => (),
}
(base, electra)
},
Expand Down
Loading
Loading