Skip to content

Commit

Permalink
Fix incorrect choices length in attestation packing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mdominykas authored and povi committed Apr 17, 2024
1 parent a223216 commit 717551c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions operation_pools/src/attestation_agg_pool/attestation_packer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ impl<P: Preset> AttestationPacker<P> {
choices.push(attestation_choice);
values.push(weight);
best_weight = weight;
} else {
break;
}
}
}
Expand Down Expand Up @@ -375,14 +377,13 @@ impl<P: Preset> AttestationPacker<P> {
att_selected = prev[groups_analyzed][att_selected];
}

attestations.truncate(P::MaxAttestations::USIZE);

PackOutcome {
attestations: attestations
.into_iter()
.pipe(ContiguousList::try_from_iter)
.expect(
"the call to Iterator::take limits the number \
attestations: attestations.try_into().expect(
"the call to Vec::truncate limits the number \
of attestations to P::MaxAttestations::USIZE",
),
),
deadline_reached: self.deadline_reached(),
}
}
Expand Down

0 comments on commit 717551c

Please sign in to comment.