mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
Filter Canonical Attestation by Default (#2626)
* exclusive of finalized block * filter canonical attestations by default
This commit is contained in:
parent
dd734f23c3
commit
b9fe8b172c
@ -171,20 +171,19 @@ func (ps *ProposerServer) PendingAttestations(ctx context.Context, req *pb.Pendi
|
||||
}
|
||||
continue
|
||||
}
|
||||
if featureconfig.FeatureConfig().EnableCanonicalAttestationFilter {
|
||||
canonical, err := ps.operationService.IsAttCanonical(ctx, att)
|
||||
if err != nil {
|
||||
// Delete attestation that failed to verify as canonical.
|
||||
if err := ps.beaconDB.DeleteAttestation(att); err != nil {
|
||||
return nil, fmt.Errorf("could not delete failed attestation: %v", err)
|
||||
}
|
||||
return nil, fmt.Errorf("could not verify canonical attestation: %v", err)
|
||||
}
|
||||
// Skip the attestation if it's not canonical.
|
||||
if !canonical {
|
||||
continue
|
||||
canonical, err := ps.operationService.IsAttCanonical(ctx, att)
|
||||
if err != nil {
|
||||
// Delete attestation that failed to verify as canonical.
|
||||
if err := ps.beaconDB.DeleteAttestation(att); err != nil {
|
||||
return nil, fmt.Errorf("could not delete failed attestation: %v", err)
|
||||
}
|
||||
return nil, fmt.Errorf("could not verify canonical attestation: %v", err)
|
||||
}
|
||||
// Skip the attestation if it's not canonical.
|
||||
if !canonical {
|
||||
continue
|
||||
}
|
||||
|
||||
validAtts = append(validAtts, att)
|
||||
}
|
||||
|
||||
|
@ -25,15 +25,14 @@ var log = logrus.WithField("prefix", "flags")
|
||||
|
||||
// FeatureFlagConfig is a struct to represent what features the client will perform on runtime.
|
||||
type FeatureFlagConfig struct {
|
||||
VerifyAttestationSigs bool // VerifyAttestationSigs declares if the client will verify attestations.
|
||||
EnableComputeStateRoot bool // EnableComputeStateRoot implementation on server side.
|
||||
EnableCrosslinks bool // EnableCrosslinks in epoch processing.
|
||||
EnableCheckBlockStateRoot bool // EnableCheckBlockStateRoot in block processing.
|
||||
EnableCanonicalAttestationFilter bool // EnableCanonicalAttestationFilter for RPC server.
|
||||
DisableHistoricalStatePruning bool // DisableHistoricalStatePruning when updating finalized states.
|
||||
DisableGossipSub bool // DisableGossipSub in p2p messaging.
|
||||
EnableCommitteesCache bool // EnableCommitteesCache for state transition.
|
||||
CacheTreeHash bool // CacheTreeHash determent whether tree hashes will be cached.
|
||||
VerifyAttestationSigs bool // VerifyAttestationSigs declares if the client will verify attestations.
|
||||
EnableComputeStateRoot bool // EnableComputeStateRoot implementation on server side.
|
||||
EnableCrosslinks bool // EnableCrosslinks in epoch processing.
|
||||
EnableCheckBlockStateRoot bool // EnableCheckBlockStateRoot in block processing.
|
||||
DisableHistoricalStatePruning bool // DisableHistoricalStatePruning when updating finalized states.
|
||||
DisableGossipSub bool // DisableGossipSub in p2p messaging.
|
||||
EnableCommitteesCache bool // EnableCommitteesCache for state transition.
|
||||
CacheTreeHash bool // CacheTreeHash determent whether tree hashes will be cached.
|
||||
}
|
||||
|
||||
var featureConfig *FeatureFlagConfig
|
||||
@ -83,10 +82,6 @@ func ConfigureBeaconFeatures(ctx *cli.Context) {
|
||||
log.Info("Disabled gossipsub, using floodsub")
|
||||
cfg.DisableGossipSub = true
|
||||
}
|
||||
if ctx.GlobalBool(EnableCanonicalAttestationFilter.Name) {
|
||||
log.Info("Enabled canonical attestation filter")
|
||||
cfg.EnableCanonicalAttestationFilter = true
|
||||
}
|
||||
InitFeatureConfig(cfg)
|
||||
}
|
||||
|
||||
|
@ -35,11 +35,6 @@ var (
|
||||
Name: "enable-check-block-state-root",
|
||||
Usage: "Enable check block state root in block processing, default is disabled.",
|
||||
}
|
||||
// EnableCanonicalAttestationFilter filters and sends canonical attestation to RPC requests.
|
||||
EnableCanonicalAttestationFilter = cli.BoolFlag{
|
||||
Name: "enable-canonical-attestation-filter",
|
||||
Usage: "Enable filtering and sending canonical attestations to RPC request, default is disabled.",
|
||||
}
|
||||
// DisableHistoricalStatePruningFlag allows the database to keep old historical states.
|
||||
DisableHistoricalStatePruningFlag = cli.BoolFlag{
|
||||
Name: "disable-historical-state-pruning",
|
||||
@ -62,7 +57,6 @@ var BeaconChainFlags = []cli.Flag{
|
||||
EnableComputeStateRootFlag,
|
||||
EnableCrosslinksFlag,
|
||||
EnableCheckBlockStateRootFlag,
|
||||
EnableCanonicalAttestationFilter,
|
||||
DisableHistoricalStatePruningFlag,
|
||||
DisableGossipSubFlag,
|
||||
CacheTreeHashFlag,
|
||||
|
Loading…
Reference in New Issue
Block a user