Skip to content

Commit

Permalink
node: drop support for binary keys
Browse files Browse the repository at this point in the history
Why would anyone use them?

Signed-off-by: Roman Khimov <[email protected]>
  • Loading branch information
roman-khimov committed Oct 3, 2024
1 parent f33949e commit 46e6229
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 34 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
29 changes: 0 additions & 29 deletions cmd/neofs-node/config/node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package nodeconfig

import (
"fmt"
"os"
"strconv"
"time"

Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion config/example/node.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion config/example/node.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"shutdown_timeout": "15s"
},
"node": {
"key": "./wallet.key",
"wallet": {
"path": "./wallet.json",
"address": "NcpJzXcSDrh5CCizf4K9Ro6w4t59J5LKzz",
Expand Down
1 change: 0 additions & 1 deletion config/example/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion config/testnet/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ contracts:
reputation: 376c23a2ae1fad088c82046abb59984e3c4519d9

node:
key: /node.key
attribute_0: Deployed:SelfHosted
attribute_1: User-Agent:NeoFS\/0.27

Expand Down

0 comments on commit 46e6229

Please sign in to comment.