Skip to content

Commit

Permalink
Ignore errors from hasSeenBit and don't pack unaggregated attestations
Browse files Browse the repository at this point in the history
  • Loading branch information
rkapka committed Feb 28, 2025
1 parent fd41691 commit 6dafce5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion beacon-chain/operations/attestations/kv/aggregated.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (c *AttCaches) SaveAggregatedAttestation(att ethpb.Att) error {

seen, err := c.hasSeenBit(att)
if err != nil {
return err
log.WithError(err).Debug("Could not check if attestations bits have been seen")
}
if seen {
return nil
Expand Down
11 changes: 8 additions & 3 deletions beacon-chain/operations/attestations/kv/unaggregated.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/attestation"
"github.com/prysmaticlabs/prysm/v5/runtime/version"
log "github.com/sirupsen/logrus"
)

// SaveUnaggregatedAttestation saves an unaggregated attestation in cache.
Expand All @@ -22,7 +23,7 @@ func (c *AttCaches) SaveUnaggregatedAttestation(att ethpb.Att) error {

seen, err := c.hasSeenBit(att)
if err != nil {
return err
log.WithError(err).Debug("Could not check if attestations bits have been seen")
}
if seen {
return nil
Expand Down Expand Up @@ -60,7 +61,7 @@ func (c *AttCaches) UnaggregatedAttestations() ([]ethpb.Att, error) {
for _, att := range unAggregatedAtts {
seen, err := c.hasSeenBit(att)
if err != nil {
return nil, err
log.WithError(err).Debug("Could not check if attestations bits have been seen")

This comment has been minimized.

Copy link
@nisdas

nisdas Feb 28, 2025

Member

We shouldnt continue and clone here as seen will be false

}
if !seen {
atts = append(atts, att.Clone())
Expand Down Expand Up @@ -163,7 +164,11 @@ func (c *AttCaches) DeleteSeenUnaggregatedAttestations() (int, error) {
if att == nil || att.IsNil() || att.IsAggregated() {
continue
}
if seen, err := c.hasSeenBit(att); err == nil && seen {
seen, err := c.hasSeenBit(att)
if err != nil {
log.WithError(err).Debug("Could not check if attestations bits have been seen")
}
if seen {
delete(c.unAggregatedAtt, r)
count++
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ func (vs *Server) packAttestations(ctx context.Context, latestState state.Beacon
} else {
atts = vs.AttPool.AggregatedAttestations()
atts = vs.validateAndDeleteAttsInPool(ctx, latestState, atts)

uAtts, err := vs.AttPool.UnaggregatedAttestations()
if err != nil {
return nil, errors.Wrap(err, "could not get unaggregated attestations")
}
uAtts = vs.validateAndDeleteAttsInPool(ctx, latestState, uAtts)
atts = append(atts, uAtts...)
}

// Checking the state's version here will give the wrong result if the last slot of Deneb is missed.
Expand Down

0 comments on commit 6dafce5

Please sign in to comment.