Skip to content

Commit

Permalink
disable beacon protocol in epoch 7 (#5083)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
countvonzero committed Sep 27, 2023
1 parent 7572d41 commit ba67e60
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions beacon/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion config/mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 6 additions & 4 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit ba67e60

Please sign in to comment.