From a59afa8ea350f9c76733dbeeda36cccd1c0a04f1 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 9 Oct 2023 22:49:12 +0300 Subject: [PATCH] config: drop obsolete SecondsPerBlock protocol configuration Signed-off-by: Roman Khimov --- ROADMAP.md | 10 ---------- docs/node-configuration.md | 1 - pkg/config/protocol_config.go | 7 +------ pkg/core/blockchain.go | 12 +++--------- pkg/network/server_config.go | 6 +----- 5 files changed, 5 insertions(+), 31 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index eeab55fc8..9b8cfe2a5 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -26,16 +26,6 @@ APIs/commands/configurations will be removed and here is a list of scheduled breaking changes. Consider changing your code/scripts/configurations if you're using anything mentioned here. -## SecondsPerBlock protocol configuration - -With 0.100.0 version SecondsPerBlock protocol configuration setting was -deprecated and replaced by a bit more generic and precise TimePerBlock -(allowing for subsecond time). An informational message is printed on node -startup to inform about this, it's very easy to deal with this configuration -change, just replace one line. - -Removal of SecondsPerBlock is scheduled for May-June 2023 (~0.103.0 release). - ## Services/node address and port configuration Version 0.100.0 of NeoGo introduces a multiple binding addresses capability to diff --git a/docs/node-configuration.md b/docs/node-configuration.md index 81b9862d3..e6948ce24 100644 --- a/docs/node-configuration.md +++ b/docs/node-configuration.md @@ -363,7 +363,6 @@ protocol-related settings described in the table below. | RemoveUntraceableBlocks | `bool`| `false` | Denotes whether old blocks should be removed from cache and database. If enabled, then only the last `MaxTraceableBlocks` are stored and accessible to smart contracts. Old MPT data is also deleted in accordance with `GarbageCollectionPeriod` setting. If enabled along with `P2PStateExchangeExtensions`, then old blocks and MPT states will be removed up to the second latest state synchronisation point (see `StateSyncInterval`). | This setting is deprecated in favor of the same setting in the ApplicationConfiguration and will be removed in future node versions. If both settings are used, setting any of them to true enables the function. | | ReservedAttributes | `bool` | `false` | Allows to have reserved attributes range for experimental or private purposes. | | SaveStorageBatch | `bool` | `false` | Enables storage batch saving before every persist. It is similar to StorageDump plugin for C# node. | This setting is deprecated in favor of the same setting in the ApplicationConfiguration and will be removed in future node versions. If both settings are used, setting any of them to true enables the function. | -| SecondsPerBlock | `int` | `15` | Minimal time that should pass before next block is accepted. Deprecated: please use TimePerBlock setting (which overrides anything set here), SecondsPerBlock will be removed in future versions. | | SeedList | `[]string` | [] | List of initial nodes addresses used to establish connectivity. | | StandbyCommittee | `[]string` | [] | List of public keys of standby committee validators are chosen from. | | StateRootInHeader | `bool` | `false` | Enables storing state root in block header. | Experimental protocol extension! | diff --git a/pkg/config/protocol_config.go b/pkg/config/protocol_config.go index a75cc4edd..df2d81296 100644 --- a/pkg/config/protocol_config.go +++ b/pkg/config/protocol_config.go @@ -67,11 +67,7 @@ type ( // SaveStorageBatch enables storage batch saving before every persist. // // Deprecated: please use the same setting in the ApplicationConfiguration, this field will be removed in future versions. - SaveStorageBatch bool `yaml:"SaveStorageBatch"` - // SecondsPerBlock is the time interval (in seconds) between blocks that consensus nodes work with. - // - // Deprecated: replaced by TimePerBlock, to be removed in future versions. - SecondsPerBlock int `yaml:"SecondsPerBlock"` + SaveStorageBatch bool `yaml:"SaveStorageBatch"` SeedList []string `yaml:"SeedList"` StandbyCommittee []string `yaml:"StandbyCommittee"` // StateRooInHeader enables storing state root in block header. @@ -260,7 +256,6 @@ func (p *ProtocolConfiguration) Equals(o *ProtocolConfiguration) bool { p.RemoveUntraceableBlocks != o.RemoveUntraceableBlocks || p.ReservedAttributes != o.ReservedAttributes || p.SaveStorageBatch != o.SaveStorageBatch || - p.SecondsPerBlock != o.SecondsPerBlock || p.StateRootInHeader != o.StateRootInHeader || p.StateSyncInterval != o.StateSyncInterval || p.TimePerBlock != o.TimePerBlock || diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index c2f3e9e00..692fda594 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -257,15 +257,9 @@ func NewBlockchain(s storage.Store, cfg config.Blockchain, log *zap.Logger) (*Bl zap.Uint16("MaxTransactionsPerBlock", cfg.MaxTransactionsPerBlock)) } if cfg.TimePerBlock <= 0 { - if cfg.SecondsPerBlock > 0 { //nolint:staticcheck // SA1019: cfg.SecondsPerBlock is deprecated - cfg.TimePerBlock = time.Duration(cfg.SecondsPerBlock) * time.Second //nolint:staticcheck // SA1019: cfg.SecondsPerBlock is deprecated - log.Info("TimePerBlock is not set, using deprecated SecondsPerBlock setting, consider updating your config", - zap.Duration("TimePerBlock", cfg.TimePerBlock)) - } else { - cfg.TimePerBlock = defaultTimePerBlock - log.Info("TimePerBlock is not set or wrong, using default value", - zap.Duration("TimePerBlock", cfg.TimePerBlock)) - } + cfg.TimePerBlock = defaultTimePerBlock + log.Info("TimePerBlock is not set or wrong, using default value", + zap.Duration("TimePerBlock", cfg.TimePerBlock)) } if cfg.MaxValidUntilBlockIncrement == 0 { const timePerDay = 24 * time.Hour diff --git a/pkg/network/server_config.go b/pkg/network/server_config.go index 15aa47b4b..b8ba1325e 100644 --- a/pkg/network/server_config.go +++ b/pkg/network/server_config.go @@ -84,10 +84,6 @@ type ( func NewServerConfig(cfg config.Config) (ServerConfig, error) { appConfig := cfg.ApplicationConfiguration protoConfig := cfg.ProtocolConfiguration - timePerBlock := protoConfig.TimePerBlock - if timePerBlock == 0 && protoConfig.SecondsPerBlock > 0 { //nolint:staticcheck // SA1019: protoConfig.SecondsPerBlock is deprecated - timePerBlock = time.Duration(protoConfig.SecondsPerBlock) * time.Second //nolint:staticcheck // SA1019: protoConfig.SecondsPerBlock is deprecated - } dialTimeout := appConfig.P2P.DialTimeout if dialTimeout == 0 && appConfig.DialTimeout > 0 { //nolint:staticcheck // SA1019: appConfig.DialTimeout is deprecated dialTimeout = time.Duration(appConfig.DialTimeout) * time.Second //nolint:staticcheck // SA1019: appConfig.DialTimeout is deprecated @@ -141,7 +137,7 @@ func NewServerConfig(cfg config.Config) (ServerConfig, error) { MaxPeers: maxPeers, AttemptConnPeers: attemptConnPeers, MinPeers: minPeers, - TimePerBlock: timePerBlock, + TimePerBlock: protoConfig.TimePerBlock, OracleCfg: appConfig.Oracle, P2PNotaryCfg: appConfig.P2PNotary, StateRootCfg: appConfig.StateRoot,