Skip to content
Open
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
15 changes: 13 additions & 2 deletions crates/blockchain/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fn update_safe_target(store: &mut Store) {
/// Aggregate committee signatures at interval 2.
///
/// Collects individual gossip signatures, aggregates them by attestation data,
/// and stores the resulting proofs in `LatestNewAggregatedPayloads`.
/// and stores the resulting proofs in the new aggregated payloads buffer.
fn aggregate_committee_signatures(store: &mut Store) -> Vec<SignedAggregatedAttestation> {
let gossip_sigs: Vec<(SignatureKey, _)> = store.iter_gossip_signatures().collect();
if gossip_sigs.is_empty() {
Expand Down Expand Up @@ -334,6 +334,17 @@ pub fn on_tick(
4 => {
// End of slot - accept accumulated attestations and log tree
accept_new_attestations(store, true);

// Prune stale gossip signatures and attestation data by age
let (pruned_sigs, pruned_att_data) = store.prune_attestation_data_by_age(slot);
if pruned_sigs + pruned_att_data > 0 {
info!(
%slot,
pruned_sigs,
pruned_att_data,
"Pruned stale attestation data by age"
);
}
}
_ => unreachable!("slots only have 5 intervals"),
}
Expand Down Expand Up @@ -1067,7 +1078,7 @@ fn build_block(
/// Select existing aggregated proofs for attestations to include in a block.
///
/// Fresh gossip aggregation happens at interval 2 (`aggregate_committee_signatures`).
/// This function only selects from existing proofs in the `LatestKnownAggregatedPayloads` table
/// This function only selects from existing proofs in the known aggregated payloads buffer
/// (proofs from previously received blocks and promoted gossip aggregations).
///
/// Returns a list of (attestation, proof) pairs ready for block inclusion.
Expand Down
10 changes: 1 addition & 9 deletions crates/storage/src/api/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ pub enum Table {
GossipSignatures,
/// Attestation data indexed by tree hash root: H256 -> AttestationData
AttestationDataByRoot,
/// Pending aggregated payloads (not yet active in fork choice):
/// SignatureKey -> Vec<StoredAggregatedPayload>
LatestNewAggregatedPayloads,
/// Active aggregated payloads (counted in fork choice):
/// SignatureKey -> Vec<StoredAggregatedPayload>
LatestKnownAggregatedPayloads,
/// Metadata: string keys -> various scalar values
Metadata,
/// Live chain index: (slot || root) -> parent_root
Expand All @@ -33,15 +27,13 @@ pub enum Table {
}

/// All table variants.
pub const ALL_TABLES: [Table; 10] = [
pub const ALL_TABLES: [Table; 8] = [
Table::BlockHeaders,
Table::BlockBodies,
Table::BlockSignatures,
Table::States,
Table::GossipSignatures,
Table::AttestationDataByRoot,
Table::LatestNewAggregatedPayloads,
Table::LatestKnownAggregatedPayloads,
Table::Metadata,
Table::LiveChain,
];
2 changes: 0 additions & 2 deletions crates/storage/src/backend/rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ fn cf_name(table: Table) -> &'static str {
Table::States => "states",
Table::GossipSignatures => "gossip_signatures",
Table::AttestationDataByRoot => "attestation_data_by_root",
Table::LatestNewAggregatedPayloads => "latest_new_aggregated_payloads",
Table::LatestKnownAggregatedPayloads => "latest_known_aggregated_payloads",
Table::Metadata => "metadata",
Table::LiveChain => "live_chain",
}
Expand Down
Loading