Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node: drop support for binary keys #2959

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
err = writeSystemAttributes(c)
fatalOnErr(err)

key := nodeconfig.Key(appCfg)
key := nodeconfig.Wallet(appCfg)

Check warning on line 527 in cmd/neofs-node/config.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/config.go#L527

Added line #L527 was not covered by tests

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
10 changes: 0 additions & 10 deletions cmd/neofs-node/config/node/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ func TestNodeSection(t *testing.T) {
t.Run("defaults", func(t *testing.T) {
empty := configtest.EmptyConfig()

require.Panics(
t,
func() {
Key(empty)
},
)

require.Panics(
t,
func() {
Expand All @@ -42,7 +35,6 @@ func TestNodeSection(t *testing.T) {
const path = "../../../../config/example/node"

var fileConfigTest = func(c *config.Config) {
key := Key(c)
addrs := BootstrapAddresses(c)
attributes := Attributes(c)
relay := Relay(c)
Expand Down Expand Up @@ -72,8 +64,6 @@ func TestNodeSection(t *testing.T) {
},
}

require.Equal(t, "NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM", key.Address())

require.EqualValues(t, len(expectedAddr), addrs.Len())

ind := 0
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
3 changes: 1 addition & 2 deletions docs/storage-node-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,7 @@ node:

| Parameter | Type | Default value | Description |
|-----------------------|---------------------------------------------------------------|---------------|----------------------------------------------------------------------------------------------------------------------|
| `key` | `string` | | Path to the binary-encoded private key. |
| `wallet` | [Wallet config](#wallet-subsection) | | Wallet configuration. Has no effect if `key` is provided. |
| `wallet` | [Wallet config](#wallet-subsection) | | Wallet configuration. |
| `addresses` | `[]string` | | Addresses advertised in the netmap. |
| `attribute` | `[]string` | | Node attributes as a list of key-value pairs in `<key>:<value>` format. See also docs about verified nodes' domains. |
| `relay` | `bool` | | Enable relay mode. |
Expand Down
Loading