mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-05-02 03:02:54 -04:00
Feature flag to disable head update on attestation basis (#4802)
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/flags"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
|
||||
@@ -128,9 +129,11 @@ func (s *Service) onAttestation(ctx context.Context, a *ethpb.Attestation) ([]ui
|
||||
// Update forkchoice store with the new attestation for updating weight.
|
||||
s.forkChoiceStore.ProcessAttestation(ctx, indexedAtt.AttestingIndices, bytesutil.ToBytes32(a.Data.BeaconBlockRoot), a.Data.Target.Epoch)
|
||||
|
||||
// Update fork choice head after updating weight.
|
||||
if err := s.updateHead(ctx, baseState.Balances()); err != nil {
|
||||
return nil, err
|
||||
if !featureconfig.Get().DisableUpdateHeadPerAttestation {
|
||||
// Update fork choice head after updating weight.
|
||||
if err := s.updateHead(ctx, baseState.Balances()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return indexedAtt.AttestingIndices, nil
|
||||
|
||||
@@ -27,7 +27,7 @@ func (r *Service) goodbyeRPCHandler(ctx context.Context, msg interface{}, stream
|
||||
defer cancel()
|
||||
setRPCStreamDeadlines(stream)
|
||||
|
||||
m, ok:= msg.(uint64)
|
||||
m, ok := msg.(uint64)
|
||||
if !ok {
|
||||
return fmt.Errorf("wrong message type for goodbye, got %T, wanted uint64", msg)
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ type Flags struct {
|
||||
ProtectAttester bool // ProtectAttester prevents the validator client from signing any attestations that would be considered a slashable offense.
|
||||
ForkchoiceAggregateAttestations bool // ForkchoiceAggregateAttestations attempts to aggregate attestations before processing in fork choice.
|
||||
DisableStrictAttestationPubsubVerification bool // DisableStrictAttestationPubsubVerification will disabling strict signature verification in pubsub.
|
||||
DisableUpdateHeadPerAttestation bool // DisableUpdateHeadPerAttestation will disabling update head on per attestation basis.
|
||||
|
||||
// DisableForkChoice disables using LMD-GHOST fork choice to update
|
||||
// the head of the chain based on attestations and instead accepts any valid received block
|
||||
@@ -148,6 +149,10 @@ func ConfigureBeaconChain(ctx *cli.Context) {
|
||||
log.Warn("Disabled strict attestation signature verification in pubsub")
|
||||
cfg.DisableStrictAttestationPubsubVerification = true
|
||||
}
|
||||
if ctx.GlobalBool(disableUpdateHeadPerAttestation.Name) {
|
||||
log.Warn("Disabled update head on per attestation basis")
|
||||
cfg.DisableUpdateHeadPerAttestation = true
|
||||
}
|
||||
|
||||
Init(cfg)
|
||||
}
|
||||
|
||||
@@ -98,6 +98,10 @@ var (
|
||||
Name: "disable-strict-attestation-pubsub-verification",
|
||||
Usage: "Disable strict signature verification of attestations in pubsub. See PR 4782 for details.",
|
||||
}
|
||||
disableUpdateHeadPerAttestation = cli.BoolFlag{
|
||||
Name: "disable-update-head-attestation",
|
||||
Usage: "Disable update fork choice head on per attestation. See PR 4802 for details.",
|
||||
}
|
||||
)
|
||||
|
||||
// Deprecated flags list.
|
||||
@@ -249,6 +253,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
|
||||
cacheFilteredBlockTreeFlag,
|
||||
forkchoiceAggregateAttestations,
|
||||
disableStrictAttestationPubsubVerificationFlag,
|
||||
disableUpdateHeadPerAttestation,
|
||||
}...)
|
||||
|
||||
// E2EBeaconChainFlags contains a list of the beacon chain feature flags to be tested in E2E.
|
||||
|
||||
Reference in New Issue
Block a user