From 46e6229558bbd6020a43e4a91f3f9e9c6d65049e Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 3 Oct 2024 16:26:49 +0300 Subject: [PATCH] node: drop support for binary keys Why would anyone use them? Signed-off-by: Roman Khimov --- CHANGELOG.md | 6 ++++++ cmd/neofs-node/config.go | 2 +- cmd/neofs-node/config/node/config.go | 29 ---------------------------- config/example/node.env | 1 - config/example/node.json | 1 - config/example/node.yaml | 1 - config/testnet/config.yml | 1 - 7 files changed, 7 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c2f40fd55..e90ccf3be4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ attribute, which is used for container domain name in NNS contracts (#2954) - When an error is returned, no additional help output is displayed in cobra-based programs (#2942) ### Removed +- Support for node.key configuration (#2959) ### Updated - Go to 1.22 version (#2517, #2738) @@ -30,6 +31,11 @@ Metabase version has been increased, auto migrating will be performed once a v0.44.0 Storage Node is started with a v0.43.0 metabase. This action can not be undone. No additional work should be done. +Binary keys are no longer supported by storage node, NEP-6 wallet support was +introduced in version 0.22.3 and support for binary keys was removed from +other components in 0.33.0 and 0.37.0. Please migrate to wallets (see 0.37.0 +notes) if you've not done it previously. + ## [0.43.0] - 2024-08-20 - Jukdo ### Added diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 84644053b1..a7ae8ea03c 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -524,7 +524,7 @@ func initCfg(appCfg *config.Config) *cfg { err = writeSystemAttributes(c) fatalOnErr(err) - key := nodeconfig.Key(appCfg) + key := nodeconfig.Wallet(appCfg) var netAddr network.AddressGroup diff --git a/cmd/neofs-node/config/node/config.go b/cmd/neofs-node/config/node/config.go index e01ac44b22..6bacbb5d25 100644 --- a/cmd/neofs-node/config/node/config.go +++ b/cmd/neofs-node/config/node/config.go @@ -2,7 +2,6 @@ package nodeconfig import ( "fmt" - "os" "strconv" "time" @@ -38,34 +37,6 @@ const ( NotificationTimeoutDefault = 5 * time.Second ) -// Key returns the value of "key" config parameter -// from "node" section. -// -// If the value is not set, fallbacks to Wallet section. -// -// Panics if the value is incorrect filename of binary encoded private key. -func Key(c *config.Config) *keys.PrivateKey { - v := config.StringSafe(c.Sub(subsection), "key") - if v == "" { - return Wallet(c) - } - - var ( - key *keys.PrivateKey - err error - data []byte - ) - if data, err = os.ReadFile(v); err == nil { - key, err = keys.NewPrivateKeyFromBytes(data) - } - - if err != nil { - panic(fmt.Errorf("invalid private key in node section: %w", err)) - } - - return key -} - // Wallet returns the value of a node private key from "node" section. // // Panics if section contains invalid values. diff --git a/config/example/node.env b/config/example/node.env index f8baefb82d..269854897d 100644 --- a/config/example/node.env +++ b/config/example/node.env @@ -9,7 +9,6 @@ NEOFS_PROMETHEUS_ADDRESS=localhost:9090 NEOFS_PROMETHEUS_SHUTDOWN_TIMEOUT=15s # Node section -NEOFS_NODE_KEY=./wallet.key NEOFS_NODE_WALLET_PATH=./wallet.json NEOFS_NODE_WALLET_ADDRESS=NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz NEOFS_NODE_WALLET_PASSWORD=password diff --git a/config/example/node.json b/config/example/node.json index c295be9cd3..1bb1b8c759 100644 --- a/config/example/node.json +++ b/config/example/node.json @@ -13,7 +13,6 @@ "shutdown_timeout": "15s" }, "node": { - "key": "./wallet.key", "wallet": { "path": "./wallet.json", "address": "NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz", diff --git a/config/example/node.yaml b/config/example/node.yaml index b46f946e99..9b794820a5 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -12,7 +12,6 @@ prometheus: shutdown_timeout: 15s # timeout for metrics HTTP server graceful shutdown node: - key: ./wallet.key # path to a binary private key wallet: path: "./wallet.json" # path to a NEO wallet; ignored if key is presented address: "NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz" # address of a NEO account in the wallet; ignored if key is presented diff --git a/config/testnet/config.yml b/config/testnet/config.yml index dc52abb6ef..6372d059c1 100644 --- a/config/testnet/config.yml +++ b/config/testnet/config.yml @@ -19,7 +19,6 @@ contracts: reputation: 376c23a2ae1fad088c82046abb59984e3c4519d9 node: - key: /node.key attribute_0: Deployed:SelfHosted attribute_1: User-Agent:NeoFS\/0.27