Skip to content

Commit

Permalink
config: mark block_sync key as deprecated (#414)
Browse files Browse the repository at this point in the history
* Mark BlockSyncMode as deprecated; log warning message

* Add comments

* Update message

* Add changelog

* Fix message

* Update test/e2e/pkg/manifest.go

Co-authored-by: Sergio Mena <[email protected]>

* Update .changelog/unreleased/breaking-changes/409-deprecate-blocksyncmode

Co-authored-by: Sergio Mena <[email protected]>

* Update config/config.go

Co-authored-by: Sergio Mena <[email protected]>

* Update config/config.go

Co-authored-by: Sergio Mena <[email protected]>

* Update config/toml.go

Co-authored-by: Sergio Mena <[email protected]>

* Update docs/core/configuration.md

Co-authored-by: Sergio Mena <[email protected]>

* Be more explicit about removing key

* Update test/e2e/pkg/manifest.go

Co-authored-by: Daniel <[email protected]>

---------

Co-authored-by: Sergio Mena <[email protected]>
Co-authored-by: Daniel <[email protected]>
  • Loading branch information
3 people authored Mar 6, 2023
1 parent 6a6eb5a commit 2dd008d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [config] The boolean key `fastsync` is deprecated and replaced by
`block_sync`. ([\#9259](https://github.com/tendermint/tendermint/pull/9259))
At the same time, `block_sync` is also deprecated. In the next release,
BlocSync will always be enabled and `block_sync` will be removed.
([\#409](https://github.com/cometbft/cometbft/issues/409))
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ func (cfg *Config) CheckDeprecated() []string {
if cfg.Mempool.TTLDuration != 0 {
warnings = append(warnings, "prioritized mempool key detected. This key, together with this version of the mempool, will be removed in the next major release.")
}
if !cfg.BaseConfig.BlockSyncMode {
warnings = append(warnings, "disabled block_sync key detected. BlockSync will be enabled unconditionally in the next major release and this key will be removed.")
}
if cfg.DeprecatedFastSyncConfig != nil {
warnings = append(warnings, "[fastsync] table detected. This section has been renamed to [blocksync]. The values in this deprecated section will be disregarded.")
}
Expand Down Expand Up @@ -196,6 +199,7 @@ type BaseConfig struct { //nolint: maligned
// If this node is many blocks behind the tip of the chain, Blocksync
// allows them to catchup quickly by downloading blocks in parallel
// and verifying their commits
// Deprecated: BlockSync will be enabled unconditionally in the next major release.
BlockSyncMode bool `mapstructure:"block_sync"`

//TODO(williambanfield): remove this field once v0.37 is released.
Expand Down
3 changes: 3 additions & 0 deletions config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ moniker = "{{ .BaseConfig.Moniker }}"
# If this node is many blocks behind the tip of the chain, BlockSync
# allows them to catchup quickly by downloading blocks in parallel
# and verifying their commits
#
# Deprecated: this key will be removed and BlockSync will be enabled
# unconditionally in the next major release.
block_sync = {{ .BaseConfig.BlockSyncMode }}
# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb
Expand Down
3 changes: 3 additions & 0 deletions docs/core/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ moniker = "anonymous"
# If this node is many blocks behind the tip of the chain, BlockSync
# allows them to catchup quickly by downloading blocks in parallel
# and verifying their commits
#
# Deprecated: this key will be removed and BlockSync will be enabled
# unconditionally in the next major release.
block_sync = true

# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb
Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ func createBlockchainReactor(config *cfg.Config,
case "v1", "v2":
return nil, fmt.Errorf("block sync version %s has been deprecated. Please use v0", config.BlockSync.Version)
default:
return nil, fmt.Errorf("unknown fastsync version %s", config.BlockSync.Version)
return nil, fmt.Errorf("unknown block sync version %s", config.BlockSync.Version)
}

bcReactor.SetLogger(logger.With("module", "blockchain"))
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/pkg/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ type ManifestNode struct {

// BlockSync specifies the block sync mode: "" (disable), "v0" or "v2".
// Defaults to disabled.
//
// Note that BlockSync will always be enabled in the next major release and the
// `block_sync` key will be removed from the config file.
BlockSync string `toml:"block_sync"`

// Mempool specifies which version of mempool to use. Either "v0" or "v1"
Expand Down

0 comments on commit 2dd008d

Please sign in to comment.