Files
prysm/beacon-chain/sync/subscriber_beacon_aggregate_proof.go
terence 774b9a7159 Migrate Prysm repo to Offchain Labs organization ahead of Pectra V6 (#15140)
* Migrate Prysm repo to Offchain Labs organization ahead of Pectra upgrade v6

* Replace prysmaticlabs with OffchainLabs on general markdowns

* Update mock

* Gazelle and add mock.go to excluded generated mock file
2025-04-10 15:40:39 +00:00

37 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package sync
import (
"context"
"errors"
"fmt"
"github.com/OffchainLabs/prysm/v6/config/features"
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
"google.golang.org/protobuf/proto"
)
// beaconAggregateProofSubscriber forwards the incoming validated aggregated attestation and proof to the
// attestation pool for processing.
func (s *Service) beaconAggregateProofSubscriber(_ context.Context, msg proto.Message) error {
a, ok := msg.(ethpb.SignedAggregateAttAndProof)
if !ok {
return fmt.Errorf("message was not type ethpb.SignedAggregateAttAndProof, type=%T", msg)
}
aggregate := a.AggregateAttestationAndProof().AggregateVal()
if aggregate == nil || aggregate.GetData() == nil {
return errors.New("nil aggregate")
}
if features.Get().EnableExperimentalAttestationPool {
return s.cfg.attestationCache.Add(aggregate)
} else {
// An unaggregated attestation can make it here. Its valid, the aggregator it just itself, although it means poor performance for the subnet.
if !aggregate.IsAggregated() {
return s.cfg.attPool.SaveUnaggregatedAttestation(aggregate)
}
return s.cfg.attPool.SaveAggregatedAttestation(aggregate)
}
}