Revert "Get electra_op_pool up to date (#5756)" (#5757)

This reverts commit ab9e58aa3d.
This commit is contained in:
ethDreamer
2024-05-09 17:10:04 -05:00
committed by GitHub
parent ab9e58aa3d
commit ca0967119b
12 changed files with 108 additions and 307 deletions

View File

@@ -113,15 +113,11 @@ pub mod attesting_indices_electra {
.map(|committee| (committee.index, committee))
.collect();
let committee_count_per_slot = committees.len() as u64;
let mut participant_count = 0;
for index in committee_indices {
if let Some(&beacon_committee) = committees_map.get(&index) {
// This check is new to the spec's `process_attestation` in Electra.
if index >= committee_count_per_slot {
return Err(BeaconStateError::InvalidCommitteeIndex(index));
if aggregation_bits.len() != beacon_committee.committee.len() {
return Err(BeaconStateError::InvalidBitfield);
}
participant_count.safe_add_assign(beacon_committee.committee.len() as u64)?;
let committee_attesters = beacon_committee
.committee
.iter()
@@ -140,13 +136,10 @@ pub mod attesting_indices_electra {
committee_offset.safe_add(beacon_committee.committee.len())?;
} else {
return Err(Error::NoCommitteeFound(index));
return Err(Error::NoCommitteeFound);
}
}
// This check is new to the spec's `process_attestation` in Electra.
if participant_count as usize != aggregation_bits.len() {
return Err(BeaconStateError::InvalidBitfield);
// TODO(electra) what should we do when theres no committee found for a given index?
}
let mut indices = output.into_iter().collect_vec();

View File

@@ -67,9 +67,9 @@ pub struct Attestation<E: EthSpec> {
#[superstruct(only(Electra), partial_getter(rename = "aggregation_bits_electra"))]
pub aggregation_bits: BitList<E::MaxValidatorsPerSlot>,
pub data: AttestationData,
pub signature: AggregateSignature,
#[superstruct(only(Electra))]
pub committee_bits: BitVector<E::MaxCommitteesPerSlot>,
pub signature: AggregateSignature,
}
impl<E: EthSpec> Decode for Attestation<E> {
@@ -92,7 +92,6 @@ impl<E: EthSpec> Decode for Attestation<E> {
}
}
// TODO(electra): think about how to handle fork variants here
impl<E: EthSpec> TestRandom for Attestation<E> {
fn random_for_test(rng: &mut impl RngCore) -> Self {
let aggregation_bits: BitList<E::MaxValidatorsPerCommittee> = BitList::random_for_test(rng);

View File

@@ -159,8 +159,7 @@ pub enum Error {
IndexNotSupported(usize),
InvalidFlagIndex(usize),
MerkleTreeError(merkle_proof::MerkleTreeError),
NoCommitteeFound(CommitteeIndex),
InvalidCommitteeIndex(CommitteeIndex),
NoCommitteeFound,
}
/// Control whether an epoch-indexed field can be indexed at the next epoch or not.

View File

@@ -408,8 +408,6 @@ impl EthSpec for MainnetEthSpec {
pub struct MinimalEthSpec;
impl EthSpec for MinimalEthSpec {
type MaxCommitteesPerSlot = U4;
type MaxValidatorsPerSlot = U8192;
type SlotsPerEpoch = U8;
type EpochsPerEth1VotingPeriod = U4;
type SlotsPerHistoricalRoot = U64;
@@ -434,6 +432,8 @@ impl EthSpec for MinimalEthSpec {
SubnetBitfieldLength,
SyncCommitteeSubnetCount,
MaxValidatorsPerCommittee,
MaxCommitteesPerSlot,
MaxValidatorsPerSlot,
GenesisEpoch,
HistoricalRootsLimit,
ValidatorRegistryLimit,