Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature flag to disable head update on attestation basis #4802

Merged
merged 4 commits into from Feb 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions beacon-chain/blockchain/process_attestation.go
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/sync/rpc_goodbye.go
Expand Up @@ -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)
}
Expand Down
5 changes: 5 additions & 0 deletions shared/featureconfig/config.go
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
5 changes: 5 additions & 0 deletions shared/featureconfig/flags.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down