From f8d15fc6828f45694870d23da5f54d2bcd037e2e Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Thu, 14 Jul 2022 13:19:12 -0400 Subject: [PATCH] blocksync: drop support for enabled=false (#8912) --- cmd/tendermint/commands/run_node.go | 3 --- node/node.go | 37 +++++++++++++---------------- node/setup.go | 4 ++++ test/e2e/generator/generate.go | 4 +--- test/e2e/networks/ci.toml | 5 ---- test/e2e/pkg/testnet.go | 2 +- 6 files changed, 22 insertions(+), 33 deletions(-) diff --git a/cmd/tendermint/commands/run_node.go b/cmd/tendermint/commands/run_node.go index 435ce9ea4..dcd62c491 100644 --- a/cmd/tendermint/commands/run_node.go +++ b/cmd/tendermint/commands/run_node.go @@ -34,9 +34,6 @@ func AddNodeFlags(cmd *cobra.Command) { config.PrivValidator.ListenAddr, "socket address to listen on for connections from external priv-validator process") - // node flags - cmd.Flags().Bool("blocksync.enable", config.BlockSync.Enable, "enable fast blockchain syncing") - // TODO (https://github.com/tendermint/tendermint/issues/6908): remove this check after the v0.35 release cycle // This check was added to give users an upgrade prompt to use the new flag for syncing. // diff --git a/node/node.go b/node/node.go index bea42b338..fcdc547a5 100644 --- a/node/node.go +++ b/node/node.go @@ -250,7 +250,7 @@ func makeNode(cfg *config.Config, // Determine whether we should do block sync. This must happen after the handshake, since the // app may modify the validator set, specifying ourself as the only validator. - blockSync := cfg.BlockSync.Enable && !onlyValidatorIsUs(state, pubKey) + blockSync := !onlyValidatorIsUs(state, pubKey) logNodeStartupInfo(state, pubKey, logger, consensusLogger, cfg.Mode) @@ -777,30 +777,25 @@ func (n *nodeImpl) OnStart() error { n.consensusReactor.SetStateSyncingMetrics(0) - d := types.EventDataStateSyncStatus{Complete: true, Height: state.LastBlockHeight} - if err := n.eventBus.PublishEventStateSyncStatus(d); err != nil { + if err := n.eventBus.PublishEventStateSyncStatus( + types.EventDataStateSyncStatus{Complete: true, Height: state.LastBlockHeight}, + ); err != nil { n.eventBus.Logger.Error("failed to emit the statesync start event", "err", err) } - // TODO: Some form of orchestrator is needed here between the state - // advancing reactors to be able to control which one of the three - // is running - if n.config.BlockSync.Enable { - // FIXME Very ugly to have these metrics bleed through here. - n.consensusReactor.SetBlockSyncingMetrics(1) - if err := bcR.SwitchToBlockSync(state); err != nil { - n.Logger.Error("failed to switch to block sync", "err", err) - return - } - - d := types.EventDataBlockSyncStatus{Complete: false, Height: state.LastBlockHeight} - if err := n.eventBus.PublishEventBlockSyncStatus(d); err != nil { - n.eventBus.Logger.Error("failed to emit the block sync starting event", "err", err) - } - - } else { - n.consensusReactor.SwitchToConsensus(state, true) + // FIXME Very ugly to have these metrics bleed through here. + n.consensusReactor.SetBlockSyncingMetrics(1) + if err := bcR.SwitchToBlockSync(state); err != nil { + n.Logger.Error("failed to switch to block sync", "err", err) + return } + + if err := n.eventBus.PublishEventBlockSyncStatus( + types.EventDataBlockSyncStatus{Complete: false, Height: state.LastBlockHeight}, + ); err != nil { + n.eventBus.Logger.Error("failed to emit the block sync starting event", "err", err) + } + }() } diff --git a/node/setup.go b/node/setup.go index f4bd0f13c..3dad14991 100644 --- a/node/setup.go +++ b/node/setup.go @@ -338,6 +338,10 @@ func createBlockchainReactor( metrics *consensus.Metrics, ) (*p2p.ReactorShim, service.Service, error) { + if !cfg.BlockSync.Enable { + logger.Error("blocksync.enable = false, but Tendermint no longer allows blocksync to be disabled. This setting is now ignored and will be removed in the next version.") + } + logger = logger.With("module", "blockchain") switch cfg.BlockSync.Version { diff --git a/test/e2e/generator/generate.go b/test/e2e/generator/generate.go index 4a17ddf3a..c66c32e03 100644 --- a/test/e2e/generator/generate.go +++ b/test/e2e/generator/generate.go @@ -47,8 +47,6 @@ var ( "tcp": 20, "unix": 10, } - // FIXME: v2 disabled due to flake - nodeBlockSyncs = uniformChoice{"v0"} // "v2" nodeMempools = uniformChoice{"v0", "v1"} nodeStateSyncs = weightedChoice{ e2e.StateSyncDisabled: 10, @@ -397,7 +395,7 @@ func generateNode( StartAt: startAt, Database: nodeDatabases.Choose(r), PrivvalProtocol: nodePrivvalProtocols.Choose(r), - BlockSync: nodeBlockSyncs.Choose(r).(string), + BlockSync: "v0", Mempool: nodeMempools.Choose(r).(string), StateSync: e2e.StateSyncDisabled, PersistInterval: ptrUint64(uint64(nodePersistIntervals.Choose(r).(int))), diff --git a/test/e2e/networks/ci.toml b/test/e2e/networks/ci.toml index 7e07febd5..bf835df35 100644 --- a/test/e2e/networks/ci.toml +++ b/test/e2e/networks/ci.toml @@ -43,7 +43,6 @@ persist_interval = 0 perturb = ["restart"] privval_protocol = "tcp" seeds = ["seed01"] -block_sync = "v0" [node.validator03] database = "badgerdb" @@ -52,7 +51,6 @@ abci_protocol = "grpc" persist_interval = 3 perturb = ["kill"] privval_protocol = "grpc" -block_sync = "v0" retain_blocks = 10 [node.validator04] @@ -61,11 +59,9 @@ snapshot_interval = 5 database = "rocksdb" persistent_peers = ["validator01"] perturb = ["pause"] -block_sync = "v0" [node.validator05] database = "cleveldb" -block_sync = "v0" state_sync = "p2p" seeds = ["seed01"] start_at = 1005 # Becomes part of the validator set at 1010 @@ -76,7 +72,6 @@ privval_protocol = "tcp" [node.full01] mode = "full" start_at = 1010 -block_sync = "v0" persistent_peers = ["validator01", "validator02", "validator03", "validator04"] perturb = ["restart"] retain_blocks = 10 diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index fe085dd1d..d1bbc7cb1 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -178,7 +178,7 @@ func LoadTestnet(file string) (*Testnet, error) { ABCIProtocol: Protocol(testnet.ABCIProtocol), PrivvalProtocol: ProtocolFile, StartAt: nodeManifest.StartAt, - BlockSync: nodeManifest.BlockSync, + BlockSync: "v0", Mempool: nodeManifest.Mempool, StateSync: nodeManifest.StateSync, PersistInterval: 1,