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, ir: rename morph config to fschain #3028

Merged
merged 6 commits into from
Nov 27, 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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ attribute, which is used for container domain name in NNS contracts (#2954)
- EACL is no longer considered for system role (#2972)
- Deprecate peapod substorage (#3013)
- Node does not stop trying to PUT an object if there are more PUT tasks than configured (#3027)
- `morph` configuration section renamed to `fschain` both in IR and SN (#3028)

### Removed
- Support for node.key configuration (#2959)
Expand All @@ -75,6 +76,10 @@ 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.

The section `morph` in the config has been renamed to `fschain`. This version
still supports the old section name, but this compatibility code will be removed
in the next release. Please rename `morph` to `fschain` in your configuration files.

To migrate data from Peapods to FSTree:
```shell
$ peapod-to-fstree -config </path/to/storage/node/config>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"crypto/elliptic"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"bytes"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"encoding/json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"encoding/json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"bytes"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"bytes"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"bytes"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"errors"
Expand Down Expand Up @@ -43,7 +43,7 @@
ContractPath string
}

func initializeSideChainCmd(cmd *cobra.Command, _ []string) error {
func initializeFSChainCmd(cmd *cobra.Command, _ []string) error {

Check warning on line 46 in cmd/neofs-adm/internal/modules/fschain/initialize.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/fschain/initialize.go#L46

Added line #L46 was not covered by tests
initCtx, err := newInitializeContext(cmd, viper.GetViper())
if err != nil {
return fmt.Errorf("initialization error: %w", err)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"archive/tar"
Expand Down Expand Up @@ -33,8 +33,8 @@ import (

const (
nnsContract = "nns"
neofsContract = "neofs" // not deployed in side-chain.
processingContract = "processing" // not deployed in side-chain.
neofsContract = "neofs" // not deployed in FS chain.
processingContract = "processing" // not deployed in FS chain.
alphabetContract = "alphabet"
auditContract = "audit"
balanceContract = "balance"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"github.com/nspcc-dev/neo-go/pkg/core/native/noderoles"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"encoding/hex"
Expand Down Expand Up @@ -51,7 +51,7 @@ func testInitialize(t *testing.T, committeeSize int) {
v.Set(maxObjectSizeInitFlag, 1024)

setTestCredentials(v, committeeSize)
require.NoError(t, initializeSideChainCmd(initCmd, nil))
require.NoError(t, initializeFSChainCmd(initCmd, nil))

t.Run("force-new-epoch", func(t *testing.T) {
require.NoError(t, forceNewEpochCmd(forceNewEpoch, nil))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"crypto/elliptic"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"fmt"
Expand Down Expand Up @@ -63,13 +63,14 @@ const (
var (
// RootCmd is a root command of config section.
RootCmd = &cobra.Command{
Use: "morph",
Short: "Section for morph network configuration commands",
Use: "fschain",
Short: "Section FS chain network configuration commands",
Aliases: []string{"morph"},
}

generateAlphabetCmd = &cobra.Command{
Use: "generate-alphabet",
Short: "Generate alphabet wallets for consensus nodes of the morph network",
Short: "Generate alphabet wallets for consensus nodes of FS chain network",
PreRun: func(cmd *cobra.Command, _ []string) {
// PreRun fixes https://github.com/spf13/viper/issues/233
_ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag))
Expand All @@ -79,7 +80,7 @@ var (

initCmd = &cobra.Command{
Use: "init",
Short: "Initialize side chain network with smart-contracts and network settings",
Short: "Initialize FS chain network with smart-contracts and network settings",
PreRun: func(cmd *cobra.Command, _ []string) {
_ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag))
_ = viper.BindPFlag(endpointFlag, cmd.Flags().Lookup(endpointFlag))
Expand All @@ -95,12 +96,12 @@ var (
_ = viper.BindPFlag(protoConfigPath, cmd.Flags().Lookup(protoConfigPath))
_ = viper.BindPFlag(localDumpFlag, cmd.Flags().Lookup(localDumpFlag))
},
RunE: initializeSideChainCmd,
RunE: initializeFSChainCmd,
}

generateStorageCmd = &cobra.Command{
Use: "generate-storage-wallet",
Short: "Generate storage node wallet for the morph network",
Short: "Generate storage node wallet for FS chain network",
PreRun: func(cmd *cobra.Command, _ []string) {
_ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag))
_ = viper.BindPFlag(endpointFlag, cmd.Flags().Lookup(endpointFlag))
Expand All @@ -111,7 +112,7 @@ var (

refillGasCmd = &cobra.Command{
Use: "refill-gas",
Short: "Refill GAS of storage node's wallet in the morph network",
Short: "Refill GAS of storage node's wallet in FS chain network",
PreRun: func(cmd *cobra.Command, _ []string) {
_ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag))
_ = viper.BindPFlag(endpointFlag, cmd.Flags().Lookup(endpointFlag))
Expand Down Expand Up @@ -152,7 +153,7 @@ var (

mintBalanceCmd = &cobra.Command{
Use: "mint-balance",
Short: "Mint new NEOFS tokens in the morph network",
Short: "Mint new NEOFS tokens in FS chain network",
PreRun: func(cmd *cobra.Command, _ []string) {
_ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag))
_ = viper.BindPFlag(endpointFlag, cmd.Flags().Lookup(endpointFlag))
Expand Down Expand Up @@ -182,7 +183,7 @@ var (

forceNewEpoch = &cobra.Command{
Use: "force-new-epoch",
Short: "Create new NeoFS epoch event in the side chain",
Short: "Create new NeoFS epoch event in FS chain",
PreRun: func(cmd *cobra.Command, _ []string) {
_ = viper.BindPFlag(alphabetWalletsFlag, cmd.Flags().Lookup(alphabetWalletsFlag))
_ = viper.BindPFlag(endpointFlag, cmd.Flags().Lookup(endpointFlag))
Expand Down Expand Up @@ -375,7 +376,7 @@ func init() {
initCmd.Flags().String(alphabetWalletsFlag, "", "Path to alphabet wallets dir")
initCmd.Flags().StringP(endpointFlag, "r", "", "N3 RPC node endpoint")
initCmd.Flags().String(contractsInitFlag, "", "Path to archive with compiled NeoFS contracts (default fetched from latest github release)")
initCmd.Flags().Uint(epochDurationCLIFlag, 240, "Amount of side chain blocks in one NeoFS epoch")
initCmd.Flags().Uint(epochDurationCLIFlag, 240, "Amount of FS chain blocks in one NeoFS epoch")
initCmd.Flags().Uint(maxObjectSizeCLIFlag, 67108864, "Max single object size in bytes")
initCmd.Flags().Bool(homomorphicHashDisabledCLIFlag, false, "Disable object homomorphic hashing")
// Defaults are taken from neo-preodolenie.
Expand Down Expand Up @@ -497,7 +498,7 @@ func init() {

cmd := verifiedNodesDomainAccessListCmd
fs := cmd.Flags()
fs.StringP(endpointFlag, "r", "", "NeoFS Sidechain RPC endpoint")
fs.StringP(endpointFlag, "r", "", "FS chain RPC endpoint")
_ = cmd.MarkFlagRequired(endpointFlag)
fs.StringP(domainFlag, "d", "", "Verified domain of the storage nodes. Must be a valid NeoFS NNS domain (e.g. 'nodes.some-org.neofs')")
_ = cmd.MarkFlagRequired(domainFlag)
Expand All @@ -510,7 +511,7 @@ func init() {
_ = cmd.MarkFlagRequired(walletFlag)
fs.StringP(walletAccountFlag, "a", "", "Optional Neo address of the wallet account for signing transactions. "+
"If omitted, default change address from the wallet is used")
fs.StringP(endpointFlag, "r", "", "NeoFS Sidechain RPC endpoint")
fs.StringP(endpointFlag, "r", "", "FS chain RPC endpoint")
_ = cmd.MarkFlagRequired(endpointFlag)
fs.StringP(domainFlag, "d", "", "Verified domain of the storage nodes. Must be a valid NeoFS NNS domain (e.g. 'nodes.some-org.neofs')")
_ = cmd.MarkFlagRequired(domainFlag)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package morph
package fschain

import (
"errors"
Expand Down
9 changes: 7 additions & 2 deletions cmd/neofs-adm/internal/modules/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import (
"os"
"slices"

"github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/config"
"github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph"
"github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/fschain"
"github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/storagecfg"
"github.com/nspcc-dev/neofs-node/misc"
"github.com/nspcc-dev/neofs-node/pkg/util/autocomplete"
Expand Down Expand Up @@ -39,11 +40,15 @@
rootCmd.Flags().Bool("version", false, "Application version")

rootCmd.AddCommand(config.RootCmd)
rootCmd.AddCommand(morph.RootCmd)
rootCmd.AddCommand(fschain.RootCmd)

Check warning on line 43 in cmd/neofs-adm/internal/modules/root.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/root.go#L43

Added line #L43 was not covered by tests
rootCmd.AddCommand(storagecfg.RootCmd)

rootCmd.AddCommand(autocomplete.Command("neofs-adm"))
rootCmd.AddCommand(gendoc.Command(rootCmd))

if slices.Contains(os.Args, "morph") {
rootCmd.Println("Warning: 'morph' is deprecated, use 'fschain' instead")
}

Check warning on line 51 in cmd/neofs-adm/internal/modules/root.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/root.go#L48-L51

Added lines #L48 - L51 were not covered by tests
}

func Execute() error {
Expand Down
8 changes: 4 additions & 4 deletions cmd/neofs-adm/internal/modules/storagecfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ control:
grpc:
endpoint: {{.ControlEndpoint}} # endpoint that is listened by the Control Service

morph:
dial_timeout: 20s # timeout for side chain NEO RPC client connection
cache_ttl: 15s # use TTL cache for side chain GET operations
endpoints: # side chain N3 RPC endpoints
fschain:
dial_timeout: 20s # timeout for FS chain NEO RPC client connection
cache_ttl: 15s # use TTL cache for FS chain GET operations
endpoints: # FS chain N3 RPC endpoints
{{- range .MorphRPC }}
- wss://{{.}}/ws{{end}}
{{if not .Relay }}
Expand Down
12 changes: 6 additions & 6 deletions cmd/neofs-adm/internal/modules/storagecfg/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,23 +378,23 @@
}

func depositGas(cmd *cobra.Command, acc *wallet.Account, network string) error {
sideClient, err := initClient(n3config[network].MorphRPC)
fsClient, err := initClient(n3config[network].MorphRPC)

Check warning on line 381 in cmd/neofs-adm/internal/modules/storagecfg/root.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/storagecfg/root.go#L381

Added line #L381 was not covered by tests
if err != nil {
return err
}
balanceHash, _ := util.Uint160DecodeStringLE(n3config[network].BalanceContract)

sideActor, err := actor.NewSimple(sideClient, acc)
fsActor, err := actor.NewSimple(fsClient, acc)

Check warning on line 387 in cmd/neofs-adm/internal/modules/storagecfg/root.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/storagecfg/root.go#L387

Added line #L387 was not covered by tests
if err != nil {
return fmt.Errorf("creating actor over side chain client: %w", err)
return fmt.Errorf("creating actor over FS chain client: %w", err)

Check warning on line 389 in cmd/neofs-adm/internal/modules/storagecfg/root.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/storagecfg/root.go#L389

Added line #L389 was not covered by tests
}

sideGas := nep17.NewReader(sideActor, balanceHash)
fsGas := nep17.NewReader(fsActor, balanceHash)

Check warning on line 392 in cmd/neofs-adm/internal/modules/storagecfg/root.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/storagecfg/root.go#L392

Added line #L392 was not covered by tests
accSH := acc.Contract.ScriptHash()

balance, err := sideGas.BalanceOf(accSH)
balance, err := fsGas.BalanceOf(accSH)

Check warning on line 395 in cmd/neofs-adm/internal/modules/storagecfg/root.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/storagecfg/root.go#L395

Added line #L395 was not covered by tests
if err != nil {
return fmt.Errorf("side chain balance: %w", err)
return fmt.Errorf("FS chain balance: %w", err)

Check warning on line 397 in cmd/neofs-adm/internal/modules/storagecfg/root.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-adm/internal/modules/storagecfg/root.go#L397

Added line #L397 was not covered by tests
}

ok, err := getConfirmation(false, fmt.Sprintf("Current NeoFS balance is %s, make a deposit? y/[n]: ",
Expand Down
Loading
Loading