From 9f7b19f88676e3a3630fa498195fcd2d8fef2636 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 9 Oct 2023 23:18:00 +0300 Subject: [PATCH] config: drop implicit consensus config via UnlockWallet Signed-off-by: Roman Khimov --- ROADMAP.md | 10 ---------- cli/server/cli_server_test.go | 3 ++- docs/node-configuration.md | 1 - pkg/config/application_config.go | 15 +++++++-------- pkg/config/config.go | 5 ----- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 9166176fc..578da9d14 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. -## Direct UnlockWallet consensus configuration - -Top-level UnlockWallet section in ApplicationConfiguration was used as an -implicit consensus service configuration, now this setting (with Enabled flag) -is moved into a section of its own (Consensus). Old configurations are still -supported, but this support will eventually be removed. - -Removal of this compatibility code is scheduled for May-June 2023 (~0.103.0 -release). - ## Node-specific configuration moved from Protocol to Application GarbageCollectionPeriod, KeepOnlyLatestState, RemoveUntraceableBlocks, diff --git a/cli/server/cli_server_test.go b/cli/server/cli_server_test.go index 2170ec85c..927b138ec 100644 --- a/cli/server/cli_server_test.go +++ b/cli/server/cli_server_test.go @@ -77,7 +77,8 @@ func TestServerStart(t *testing.T) { }) t.Run("invalid consensus config", func(t *testing.T) { saveCfg(t, func(cfg *config.Config) { - cfg.ApplicationConfiguration.UnlockWallet.Path = "bad_consensus_wallet.json" + cfg.ApplicationConfiguration.Consensus.Enabled = true + cfg.ApplicationConfiguration.Consensus.UnlockWallet.Path = "bad_consensus_wallet.json" }) e.RunWithError(t, baseCmd...) }) diff --git a/docs/node-configuration.md b/docs/node-configuration.md index da12f0bc7..55747070c 100644 --- a/docs/node-configuration.md +++ b/docs/node-configuration.md @@ -33,7 +33,6 @@ node-related settings described in the table below. | SaveStorageBatch | `bool` | `false` | Enables storage batch saving before every persist. It is similar to StorageDump plugin for C# node. | | SkipBlockVerification | `bool` | `false` | Allows to disable verification of received/processed blocks (including cryptographic checks). | | StateRoot | [State Root Configuration](#State-Root-Configuration) | | State root module configuration. See the [State Root Configuration](#State-Root-Configuration) section for details. | -| UnlockWallet | [Unlock Wallet Configuration](#Unlock-Wallet-Configuration) | | Node wallet configuration used for consensus (dBFT) operation. See the [Unlock Wallet Configuration](#Unlock-Wallet-Configuration) section for details. This section is deprecated and replaced by Consensus, it only exists for compatibility with old configuration files, but will be removed in future node versions. | ### P2P Configuration diff --git a/pkg/config/application_config.go b/pkg/config/application_config.go index fe93b5b4c..2e94961d7 100644 --- a/pkg/config/application_config.go +++ b/pkg/config/application_config.go @@ -23,17 +23,16 @@ type ApplicationConfiguration struct { Pprof BasicService `yaml:"Pprof"` Prometheus BasicService `yaml:"Prometheus"` - Relay bool `yaml:"Relay"` - Consensus Consensus `yaml:"Consensus"` - RPC RPC `yaml:"RPC"` - UnlockWallet Wallet `yaml:"UnlockWallet"` - Oracle OracleConfiguration `yaml:"Oracle"` - P2PNotary P2PNotary `yaml:"P2PNotary"` - StateRoot StateRoot `yaml:"StateRoot"` + Relay bool `yaml:"Relay"` + Consensus Consensus `yaml:"Consensus"` + RPC RPC `yaml:"RPC"` + Oracle OracleConfiguration `yaml:"Oracle"` + P2PNotary P2PNotary `yaml:"P2PNotary"` + StateRoot StateRoot `yaml:"StateRoot"` } // EqualsButServices returns true when the o is the same as a except for services -// (Oracle, P2PNotary, Pprof, Prometheus, RPC, StateRoot and UnlockWallet sections) +// (Oracle, P2PNotary, Pprof, Prometheus, RPC and StateRoot sections) // and LogLevel field. func (a *ApplicationConfiguration) EqualsButServices(o *ApplicationConfiguration) bool { if len(a.P2P.Addresses) != len(o.P2P.Addresses) { diff --git a/pkg/config/config.go b/pkg/config/config.go index 086f23704..4e8fe06bd 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -88,11 +88,6 @@ func LoadFile(configPath string) (Config, error) { return Config{}, fmt.Errorf("failed to unmarshal config YAML: %w", err) } - if len(config.ApplicationConfiguration.UnlockWallet.Path) > 0 && len(config.ApplicationConfiguration.Consensus.UnlockWallet.Path) == 0 { - config.ApplicationConfiguration.Consensus.UnlockWallet = config.ApplicationConfiguration.UnlockWallet - config.ApplicationConfiguration.Consensus.Enabled = true - } - err = config.ProtocolConfiguration.Validate() if err != nil { return Config{}, err