Gloas PayloadAttestation gossip verification (#9145)

Co-Authored-By: hopinheimer <knmanas6@gmail.com>

Co-Authored-By: hopinheimer <48147533+hopinheimer@users.noreply.github.com>

Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
hopinheimer
2026-04-27 05:51:20 -04:00
committed by GitHub
parent fae7941b2d
commit 6ab48a76f0
11 changed files with 1014 additions and 16 deletions

View File

@@ -42,6 +42,8 @@ pub type ObservedSyncContributors<E> =
pub type ObservedAggregators<E> = AutoPruningEpochContainer<EpochHashSet, E>;
pub type ObservedSyncAggregators<E> =
AutoPruningSlotContainer<SlotSubcommitteeIndex, (), SyncAggregatorSlotHashSet, E>;
pub type ObservedPayloadAttesters<E> =
AutoPruningSlotContainer<Slot, (), PayloadAttesterSlotHashSet<E>, E>;
#[derive(Debug, PartialEq)]
pub enum Error {
@@ -255,6 +257,46 @@ impl Item<()> for SyncAggregatorSlotHashSet {
}
}
/// Stores a `HashSet` of validator indices that have sent a payload attestation gossip
/// message during a slot.
pub struct PayloadAttesterSlotHashSet<E> {
set: HashSet<usize>,
phantom: PhantomData<E>,
}
impl<E: EthSpec> Item<()> for PayloadAttesterSlotHashSet<E> {
fn with_capacity(capacity: usize) -> Self {
Self {
set: HashSet::with_capacity(capacity),
phantom: PhantomData,
}
}
/// Defaults to `PTC_SIZE`, the maximum number of payload attesters per slot.
fn default_capacity() -> usize {
E::ptc_size()
}
fn len(&self) -> usize {
self.set.len()
}
fn validator_count(&self) -> usize {
self.set.len()
}
/// Inserts the `validator_index` in the set. Returns `true` if the `validator_index` was
/// already in the set.
fn insert(&mut self, validator_index: usize, _value: ()) -> bool {
!self.set.insert(validator_index)
}
/// Returns `true` if the `validator_index` is in the set.
fn get(&self, validator_index: usize) -> Option<()> {
self.set.contains(&validator_index).then_some(())
}
}
/// A container that stores some number of `T` items.
///
/// This container is "auto-pruning" since it gets an idea of the current slot by which