Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/vvarg229/neofs-node
Browse files Browse the repository at this point in the history
  • Loading branch information
vvarg229 committed Jul 3, 2023
2 parents ed160df + c408b57 commit 3d9bd72
Show file tree
Hide file tree
Showing 78 changed files with 2,324 additions and 3,394 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @roman-khimov @notimetoname @cthulhu-rider
* @roman-khimov @carpawell @cthulhu-rider
8 changes: 0 additions & 8 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

- name: Cache go mod
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go }}-
- name: Run go test
run: go test -coverprofile=coverage.txt -covermode=atomic ./...

Expand Down
69 changes: 47 additions & 22 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ Changelog for NeoFS Node

### Added
- Embedded Neo contracts in `contracts` dir (#2391)
- `dump-names` command for adm
- `renew-domain` command for adm

### Fixed
- `neo-go` RPC connection lost handling by IR (#1337)

### Removed
- Deprecated `morph.rpc_endpoint` SN and `morph.endpoint.client` IR config sections (#2400)
- `neofs_node_object_epoch` metric for IR and SN (#2347)
- Subnets support (#2411)

### Changed
- CLI `--timeout` flag configures whole execution timeout from now (#2124)
Expand All @@ -24,6 +30,18 @@ execution of commands with the `--await` flag and without an explicitly
specified time period is now limited to 1 minute. This value can be changed with
`--timeout` flag.

Deprecated `morph.rpc_endpoint` SN and `morph.endpoint.client` IR configurations
have been removed. Use `morph.endpoints` for both instead.
Deprecated `neofs_node_object_epoch` metric for IR and SN (the same for both)
has been removed. Use `neofs_node_state_epoch` for SN and `neofs_ir_state_epoch`
for IR instead.

Subnets support has been removed:
- IR's `workers.subnet` and `contracts.subnet` configs are not used anymore.
- SN's `node.subnet` config section is not used anymore.
- `neoofs-amd morph` does not have `subnet` subcommand anymore.
- `neofs-cli container create` does not have `--subnet` flag anymore.

## [0.37.0] - 2023-06-15 - Sogado

### Added
Expand Down Expand Up @@ -56,21 +74,25 @@ specified time period is now limited to 1 minute. This value can be changed with
- BoltDB (`go.etcd.io/bbolt`) to 1.3.7

### Updating from v0.36.1
- `neofs_node_object_epoch` metric for IR and SN (the same for both) has been deprecated and will be removed with the
`neofs_node_object_epoch` metric for IR and SN (the same for both) has been deprecated and will be removed with the
next minor release. Use `neofs_node_state_epoch` for SN and `neofs_ir_state_epoch` for IR instead.
- Storage and Inner-ring nodes exposes their version via the `neofs_[node|ir]_version` metric now.
- In the local consensus mode (IR) it is allowed to provide additional TLS setup addresses now, see

Storage and Inner-ring nodes exposes their version via the `neofs_[node|ir]_version` metric now.

In the local consensus mode (IR) it is allowed to provide additional TLS setup addresses now, see
`morph.consensus.rpc.tls` section.
- `morph.switch_interval` IR and SN config value is not used anymore.
- `morph.rpc_endpoint` SN config value and `morph.endpoint.client` IR config value has been deprecated and will be
`morph.switch_interval` IR and SN config value is not used anymore.
`morph.rpc_endpoint` SN config value and `morph.endpoint.client` IR config value has been deprecated and will be
removed with the next minor release. Use `morph.endpoints` for both instead (NOTE: it does not have priorities now).
- If you're using binary keys with neofs-cli (`-w`), convert them to proper

If you're using binary keys with neofs-cli (`-w`), convert them to proper
NEP-6 wallets like this:
$ xxd -p < path_to_binary.wallet # outputs hex-encoded key
$ neofs-cli util keyer <hex_key> # outputs WIF
$ neo-go wallet import -w <wallet_file> --wif <wif_key>
or just generate/use new keys.
- In local consensus mode `morph.validators` in IR's config can be omitted now, `morph.consensus.committee` will be used instead.

In local consensus mode `morph.validators` in IR's config can be omitted now, `morph.consensus.committee` will be used instead.
For detached consensus, it is a required config parameter now.

## [0.36.1] - 2023-04-26
Expand Down Expand Up @@ -455,10 +477,11 @@ Provide `--no-precheck` flag to `neofs-cli container set-eacl` for unconditional
- `google.golang.org/grpc` to `v1.48.0`

### Updating from v0.30.0
1. Change `morph.endpoint.client` priority values using the following rule:
Change `morph.endpoint.client` priority values using the following rule:
the higher the priority the lower the value (non-specified or `0` values are
interpreted as the highest priority -- `1`).
2. Deprecated `profiler` and `metrics` configuration sections are dropped,

Deprecated `profiler` and `metrics` configuration sections are dropped,
use `pprof` and `prometheus` instead.

## [0.30.2] - 2022-08-01
Expand Down Expand Up @@ -513,12 +536,13 @@ use `pprof` and `prometheus` instead.
- `github.com/spf13/cobra` to v1.5.0

### Updating from v0.29.0
1. Change morph endpoints from simple string to a pair of `address` and `priority`. The second can be omitted.
Change morph endpoints from simple string to a pair of `address` and `priority`. The second can be omitted.
For inner ring node this resides in `morph.endpoint.client` section,
for storage node -- in `morph.rpc_endpoint` section. See `config/example` for an example.

2. Move `storage.default` section to `storage.shard.default`.
3. Rename `metrics` and `profiler` sections to `prometheus` and `pprof` respectively, though old versions are supported.
Move `storage.default` section to `storage.shard.default`.

Rename `metrics` and `profiler` sections to `prometheus` and `pprof` respectively, though old versions are supported.
In addition, these sections must now be explicitly enabled with `enabled: true` flag.

## [0.29.0] - 2022-07-07 - Yeonpyeongdo (연평도, 延坪島)
Expand Down Expand Up @@ -767,7 +791,7 @@ See example config for more details.
- `--generate-key` flag in CLI control commands (#1103)
- Various unused code (#1123)

### Upgrading from v0.27.4
### Updating from v0.27.4
Use `--wallet` key in CLI to provide WIF or binary key file instead of `--wif`
and `--binary-key`.

Expand All @@ -793,7 +817,7 @@ Specify `password: xxx` in config file for NeoFS CLI to avoid password input.
- Factor out autocomplete command in CLI and Adm (#1041)
- Single crypto rand source (#851)

### Upgrading from v0.27.3
### Updating from v0.27.3
To disable compression for object with specific content-types, specify them
as a string array in blobstor section:
`NEOFS_STORAGE_SHARD_N_BLOBSTOR_COMPRESSION_EXCLUDE_CONTENT_TYPES`. Use
Expand Down Expand Up @@ -874,7 +898,7 @@ NeoFS API v2.11.0 support with response status codes and storage subnetworks.
- Alphabet nodes now invoke `netmap.Register` to add node to the network map
candidates in notary enabled environment (#1008)

### Upgrading from v0.26.1
### Updating from v0.26.1
`NEOFS_IR_CONTRACTS_ALPHABET_AMOUNT` is not mandatory env anymore. If it
is not set, Inner Ring would try to read maximum from config and NNS contract.
However, that parameter still can be set in order to require the exact number
Expand Down Expand Up @@ -923,7 +947,7 @@ with `NEOFS_IR_FEE_NAMED_CONTAINER_REGISTER`.
- LOCODE generator tries to find the closest continent if there are
no exact match (#955)

### Upgrading from v0.26.0
### Updating from v0.26.0
You can specify default section in storage engine configuration.
See [example](./config/example/node.yaml) for more details.

Expand Down Expand Up @@ -972,11 +996,12 @@ NeoFS API v2.10 support
command (#810).
- Interactive mode in docker run command (#916)

### Upgrading from v0.25.1
### Updating from v0.25.1
Deleted `NEOFS_IR_NOTARY_SIDE_DEPOSIT_AMOUNT`, `NEOFS_IR_NOTARY_MAIN_DEPOSIT_AMOUNT`
and `NEOFS_IR_TIMERS_SIDE_NOTARY`, `NEOFS_IR_TIMERS_MAIN_NOTARY` Inner Ring envs.
Deleted `NEOFS_MORPH_NOTARY_DEPOSIT_AMOUNT` and `NEOFS_MORPH_NOTARY_DEPOSIT_DURATION`
Storage Node envs.

`control` CLI command does not have `--rpc-endpoint`/`r` flag, use `endpoint`
instead.

Expand Down Expand Up @@ -1031,7 +1056,7 @@ instead.
### Removed
- Dockerfile for AllInOne image moved to a separate repository (#796)

### Upgrading from v0.24.1
### Updating from v0.24.1
Added `NEOFS_CONTRACTS_PROXY` env for Storage Node; mandatory in
notary enabled environments only. It should contain proxy contract's
scripthash in side chain.
Expand Down Expand Up @@ -1061,7 +1086,7 @@ Object service pool size now split into `NEOFS_OBJECT_PUT_POOL_SIZE_REMOTE` and
- Storage and Inner Ring will not start until Neo RPC node will have the height
of the latest processed block by the nodes (#795)

### Upgrading from v0.24.0
### Updating from v0.24.0
Specify path to the local state DB in Inner Ring node config with
`NEOFS_IR_NODE_PERSISTENT_STATE_PATH`. Specify path to the local state DB in
Storage node config with `NEOFS_NODE_PERSISTENT_STATE_PATH`.
Expand Down Expand Up @@ -1093,7 +1118,7 @@ Storage node config with `NEOFS_NODE_PERSISTENT_STATE_PATH`.
### Removed
- Unused `DB_SIZE` parameter of writecache (#773)

### Upgrading from v0.23.1
### Updating from v0.23.1
Storage Node does not read unused `NEOFS_STORAGE_SHARD_XXX_WRITECACHE_DB_SIZE`
config parameter anymore.

Expand Down Expand Up @@ -1121,7 +1146,7 @@ N3 Mainnet launch release with minor fixes.
- Handle context shutdown at NeoFS multi client group address switching (#737)
- Scope for main chain invocations from Inner Ring nodes (#751)

### Upgrading from v0.23.0
### Updating from v0.23.0
Added `NEOFS_MORPH_DISABLE_CACHE` env. If `true`, none of
the `eACL`/`netmap`/`container` RPC responses cached.

Expand Down Expand Up @@ -1149,7 +1174,7 @@ Improved stability for notary disabled environment.
- Inner Ring node does not require proxy and processing contracts if notary
disabled (#701, #714)

### Upgrading from v0.22.3
### Updating from v0.22.3
To upgrade Storage node or Inner Ring node from v0.22.3, you don't need to
change configuration files. Make sure, that NEO RPC nodes, specified in config,
are connected to N3 RC4 (Testnet) network.
Expand Down
33 changes: 21 additions & 12 deletions cmd/neofs-adm/internal/modules/morph/dump_hashes.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,20 +269,29 @@ func fillContractExpiration(cmd *cobra.Command, c Client, infos []contractDumpIn
if err != nil {
continue // OK for NNS itself, for example.
}
elems := props.Value().([]stackitem.MapElement)
for _, e := range elems {
k, err := e.Key.TryBytes()
if err != nil {
continue
}
exp, err := expirationFromProperties(props)
if err != nil {
continue // Should be there, but who knows.
}
infos[i].expiration = exp
}
}

func expirationFromProperties(props *stackitem.Map) (int64, error) {
elems := props.Value().([]stackitem.MapElement)
for _, e := range elems {
k, err := e.Key.TryBytes()
if err != nil {
continue
}

if string(k) == "expiration" {
v, err := e.Value.TryInteger()
if err != nil || !v.IsInt64() {
continue
}
infos[i].expiration = v.Int64()
if string(k) == "expiration" {
v, err := e.Value.TryInteger()
if err != nil || !v.IsInt64() {
continue
}
return v.Int64(), nil
}
}
return 0, errors.New("not found")
}
90 changes: 90 additions & 0 deletions cmd/neofs-adm/internal/modules/morph/dump_names.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package morph

import (
"bytes"
"fmt"
"sort"
"strings"
"text/tabwriter"
"time"

"github.com/nspcc-dev/neo-go/pkg/rpcclient/invoker"
"github.com/nspcc-dev/neo-go/pkg/rpcclient/nep11"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

const (
nameDomainFlag = "domain"
)

type nameExp struct {
name string
exp int64
}

func dumpNames(cmd *cobra.Command, _ []string) error {
c, err := getN3Client(viper.GetViper())
if err != nil {
return fmt.Errorf("can't create N3 client: %w", err)
}
cs, err := c.GetContractStateByID(1) // NNS.
if err != nil {
return err
}
var n11r = nep11.NewNonDivisibleReader(invoker.New(c, nil), cs.Hash)
tokIter, err := n11r.Tokens()
if err != nil {
return err
}
zone, _ := cmd.Flags().GetString(nameDomainFlag)
var res = make([]nameExp, 0)
for toks, err := tokIter.Next(10); len(toks) != 0 && err == nil; toks, err = tokIter.Next(10) {
for i := range toks {
var name = string(toks[i])
if zone != "" && name != zone && !strings.HasSuffix(name, "."+zone) {
continue
}
props, err := n11r.Properties(toks[i])
if err != nil {
cmd.PrintErrf("Error getting properties for %s: %v\n", name, err)
continue
}
exp, err := expirationFromProperties(props)
if err != nil {
cmd.PrintErrf("Error getting expiration from properties for %s: %v\n", name, err)
continue
}
res = append(res, nameExp{name: name, exp: exp})
}
}

sort.Slice(res, func(i, j int) bool {
var (
iParts = strings.Split(res[i].name, ".")
jParts = strings.Split(res[j].name, ".")
)
if len(iParts) != len(jParts) {
return len(iParts) < len(jParts)
}
for k := len(iParts) - 1; k >= 0; k-- {
var c = strings.Compare(iParts[k], jParts[k])
if c != 0 {
return c == -1
}
}
return false
})

buf := bytes.NewBuffer(nil)
tw := tabwriter.NewWriter(buf, 0, 2, 2, ' ', 0)
for i := range res {
_, _ = tw.Write([]byte(fmt.Sprintf("%s\t%s\n",
res[i].name, time.UnixMilli(res[i].exp).String())))
}
_ = tw.Flush()

cmd.Print(buf.String())

return nil
}
3 changes: 0 additions & 3 deletions cmd/neofs-adm/internal/modules/morph/initialize_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const (
netmapContract = "netmap"
proxyContract = "proxy"
reputationContract = "reputation"
subnetContract = "subnet"
)

const (
Expand Down Expand Up @@ -77,7 +76,6 @@ var (
netmapContract,
proxyContract,
reputationContract,
subnetContract,
}

fullContractList = append([]string{
Expand Down Expand Up @@ -597,7 +595,6 @@ func (c *initializeContext) getContractDeployData(ctrHash util.Uint160, ctrName
case proxyContract:
items = nil
case reputationContract:
case subnetContract:
default:
panic(fmt.Sprintf("invalid contract name: %s", ctrName))
}
Expand Down
Loading

0 comments on commit 3d9bd72

Please sign in to comment.