Skip to content
Merged
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
7 changes: 1 addition & 6 deletions beacon_node/operation_pool/src/attestation_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,12 @@ impl<T: EthSpec> AttestationDataMap<T> {

pub fn stats(&self) -> AttestationStats {
let mut stats = AttestationStats::default();
let mut max_aggregates_per_data = 0;

for (_, aggregates) in self.aggregate_attestations.iter() {
for aggregates in self.aggregate_attestations.values() {
stats.num_attestations += aggregates.len();
stats.num_attestation_data += 1;
stats.max_aggregates_per_data =
std::cmp::max(stats.max_aggregates_per_data, aggregates.len());

if aggregates.len() > max_aggregates_per_data {
max_aggregates_per_data = aggregates.len();
}
}

for (data, unaggregates) in self.unaggregate_attestations.iter() {
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/operation_pool/src/bron_kerbosch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn compute_neighbourhoods<T, F: Fn(&T, &T) -> bool>(
let mut neighbourhoods = vec![];
neighbourhoods.resize_with(vertices.len(), Vec::new);
for (i, vi) in vertices.get(0..vertices.len() - 1)?.iter().enumerate() {
for (j, vj) in vertices.get(i + 1..vertices.len())?.iter().enumerate() {
for (j, vj) in vertices.iter().enumerate().skip(i + 1) {
if is_compatible(vi, vj) {
neighbourhoods.get_mut(i)?.push(j);
neighbourhoods.get_mut(j)?.push(i);
Expand Down
22 changes: 12 additions & 10 deletions beacon_node/operation_pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1309,20 +1309,22 @@ mod release_tests {
}
}

let mut num_valid = 0;
let num_valid = AtomicUsize::new(0);
let (_, curr) = CheckpointKey::keys_for_state(&state);
let all_attestations = op_pool.attestations.read();

complete_state_advance(&mut state, None, Slot::new(1), spec).unwrap();
let clique_attestations = op_pool.get_clique_aggregate_attestations_for_epoch(
&curr,
&all_attestations,
&state,
|_| true,
&mut num_valid,
32,
spec,
);
let clique_attestations = op_pool
.get_clique_aggregate_attestations_for_epoch(
&curr,
&all_attestations,
&state,
|_| true,
&num_valid,
32,
spec,
)
.unwrap();
let best_attestations = op_pool
.get_attestations(&state, |_| true, |_| true, 32, spec)
.unwrap();
Expand Down