From a1c74a0d25dff0af06cc5ca91661197b264f4666 Mon Sep 17 00:00:00 2001 From: k <30611210+countvonzero@users.noreply.github.com> Date: Wed, 27 Sep 2023 19:24:30 +0000 Subject: [PATCH] disable beacon protocol in epoch 7 (#5083) ## Motivation disable beacon protocol until #4989 and #4583 are fixed ## Changes set RoundsNumber == 0 to disable beacon protocol and not listen to beacon gossip ## TODO - [x] Update [changelog](../CHANGELOG.md) as needed - [x] test on devnet-406-short --- CHANGELOG.md | 1 + beacon/beacon.go | 7 +++++-- config/mainnet.go | 2 +- node/node.go | 10 ++++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fa7544711..ab3aefe43e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ In order to enable provide following configuration: * [#5032](https://github.com/spacemeshos/go-spacemesh/pull/5032) Ativeset data pruned from ballots. * [#5035](https://github.com/spacemeshos/go-spacemesh/pull/5035) Fix possible nil pointer panic when node fails to persist nipost builder state. * [#5079](https://github.com/spacemeshos/go-spacemesh/pull/5079) increase atx cache to 50 000 to reduce disk reads. +* [#5083](https://github.com/spacemeshos/go-spacemesh/pull/5083) Disable beacon protocol temporarily. ## v1.1.5 diff --git a/beacon/beacon.go b/beacon/beacon.go index 1dea37dbd7..aca51b944b 100644 --- a/beacon/beacon.go +++ b/beacon/beacon.go @@ -231,13 +231,16 @@ func (pd *ProtocolDriver) setMetricsRegistry(registry *prometheus.Registry) { // Start starts listening for layers and outputs. func (pd *ProtocolDriver) Start(ctx context.Context) { pd.startOnce.Do(func() { - pd.logger.With().Info("starting beacon protocol", log.String("config", fmt.Sprintf("%+v", pd.config))) if pd.sync == nil { pd.logger.Fatal("update sync state provider can't be nil") } - pd.metricsCollector.Start(nil) + if pd.config.RoundsNumber == 0 { + pd.logger.Info("beacon protocol disabled") + return + } + pd.logger.With().Info("starting beacon protocol", log.String("config", fmt.Sprintf("%+v", pd.config))) pd.setProposalTimeForNextEpoch() pd.eg.Go(func() error { pd.listenEpochs(ctx) diff --git a/config/mainnet.go b/config/mainnet.go index c20dfbe475..34b814727d 100644 --- a/config/mainnet.go +++ b/config/mainnet.go @@ -115,7 +115,7 @@ func MainnetConfig() Config { GracePeriodDuration: 10 * time.Minute, ProposalDuration: 4 * time.Minute, FirstVotingRoundDuration: 30 * time.Minute, - RoundsNumber: 300, + RoundsNumber: 0, VotingRoundDuration: 4 * time.Minute, WeakCoinRoundDuration: 4 * time.Minute, VotesLimit: 100, diff --git a/node/node.go b/node/node.go index e21e5e1d73..3cfb44bfbc 100644 --- a/node/node.go +++ b/node/node.go @@ -916,10 +916,12 @@ func (app *App) initServices(ctx context.Context) error { return errors.New("not synced for gossip") } - app.host.Register(pubsub.BeaconWeakCoinProtocol, pubsub.ChainGossipHandler(syncHandler, beaconProtocol.HandleWeakCoinProposal), pubsub.WithValidatorInline(true)) - app.host.Register(pubsub.BeaconProposalProtocol, pubsub.ChainGossipHandler(syncHandler, beaconProtocol.HandleProposal), pubsub.WithValidatorInline(true)) - app.host.Register(pubsub.BeaconFirstVotesProtocol, pubsub.ChainGossipHandler(syncHandler, beaconProtocol.HandleFirstVotes), pubsub.WithValidatorInline(true)) - app.host.Register(pubsub.BeaconFollowingVotesProtocol, pubsub.ChainGossipHandler(syncHandler, beaconProtocol.HandleFollowingVotes), pubsub.WithValidatorInline(true)) + if app.Config.Beacon.RoundsNumber > 0 { + app.host.Register(pubsub.BeaconWeakCoinProtocol, pubsub.ChainGossipHandler(syncHandler, beaconProtocol.HandleWeakCoinProposal), pubsub.WithValidatorInline(true)) + app.host.Register(pubsub.BeaconProposalProtocol, pubsub.ChainGossipHandler(syncHandler, beaconProtocol.HandleProposal), pubsub.WithValidatorInline(true)) + app.host.Register(pubsub.BeaconFirstVotesProtocol, pubsub.ChainGossipHandler(syncHandler, beaconProtocol.HandleFirstVotes), pubsub.WithValidatorInline(true)) + app.host.Register(pubsub.BeaconFollowingVotesProtocol, pubsub.ChainGossipHandler(syncHandler, beaconProtocol.HandleFollowingVotes), pubsub.WithValidatorInline(true)) + } app.host.Register(pubsub.ProposalProtocol, pubsub.ChainGossipHandler(syncHandler, proposalListener.HandleProposal)) app.host.Register(pubsub.AtxProtocol, pubsub.ChainGossipHandler(atxSyncHandler, atxHandler.HandleGossipAtx)) app.host.Register(pubsub.TxProtocol, pubsub.ChainGossipHandler(syncHandler, app.txHandler.HandleGossipTransaction))