Skip to content

Commit

Permalink
remove subset attestations
Browse files Browse the repository at this point in the history
  • Loading branch information
GeemoCandama committed Sep 28, 2023
1 parent 5c0d77c commit af26f34
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions beacon_node/operation_pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,35 @@ impl<T: EthSpec> OperationPool<T> {
let cliques = bron_kerbosch(&aggregates, is_compatible);

// aggregate each cliques corresponding attestaiions
let mut clique_aggregates = cliques.iter().map(|clique| {
let mut res_att = aggregates[clique[0]].clone();
for ind in clique.iter().skip(1) {
res_att.aggregate(&aggregates[*ind]);
let mut clique_aggregates: Vec<CompactIndexedAttestation<_>> = cliques
.iter()
.map(|clique| {
let mut res_att = aggregates[clique[0]].clone();
for ind in clique.iter().skip(1) {
res_att.aggregate(&aggregates[*ind]);
}
res_att
})
.collect();

let mut indices_to_remove = Vec::new();
clique_aggregates
.sort_by(|a, b| a.attesting_indices.len().cmp(&b.attesting_indices.len()));
for (index, clique) in clique_aggregates.iter().enumerate() {
for bigger_clique in clique_aggregates.iter().skip(index + 1) {
if clique
.aggregation_bits
.is_subset(&bigger_clique.aggregation_bits)
{
indices_to_remove.push(index);
break;
}
}
res_att
});
}
for index in indices_to_remove.iter().rev() {
clique_aggregates.remove(*index);
}
let mut clique_aggregates = clique_aggregates.into_iter();

// aggregate unaggregate attestations into the clique aggregates
// if compatible
Expand Down

0 comments on commit af26f34

Please sign in to comment.