Commit graph

548 commits

Author SHA1 Message Date
Pavel Karpy
2ef5e86aaf [#770] node/config: Add uint32 casting
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00
Pavel Karpy
d77b2d1b76 [#770] node/config: Add proxy contract to config
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00
Pavel Karpy
d252aa4a3e [#770] pkg/morph: Rename all parsers and handlers structs/interfaces
Prepare all listening structures for notary events:
rename(add prefix/suffix 'notification') all
notification specific handlers/parsers.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00
Leonard Lyubich
358e3ed8c4 [#645] *: Change the locality condition of the node from the placement
Some software components regulate the way of working with placement arrays
when a local node enters it. In the previous implementation, the locality
criterion was the correspondence between the announced network address
(group) and the address with which the node was configured. However, by
design, network addresses are not unique identifiers of storage nodes in the
system.

Change comparisons by network addresses to comparisons by keys in all
packages with the logic described above. Implement `netmap.AnnouncedKeys`
interface on `cfg` type in the storage node application.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-07 09:53:18 +03:00
Pavel Karpy
3c848b2cad [#788] cli: Wrap/sync errors
Add context to error messages. Sync error
messages for errors with the same context.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 09:52:53 +03:00
Leonard Lyubich
85bd2a1cdf [#746] morph: Add error return of MagicNumber method
Since morph `Client` works in multi-client mode, there is an error case when
we can not get network magic when all endpoints are unavailable.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-02 11:04:38 +03:00
Leonard Lyubich
ad7ad12a0c [#746] morph: Implement and use multi-client
There is a need to work with a set of Neo RPC nodes in order not to depend
on the failure of some nodes while others are active.

Support "multi-client" mode of morph `Client` entity. If instance is not
"multi-client", it works as before. Constructor `New` creates multi-client,
and each method performs iterating over the fixed set of endpoints until
success. Opened client connections are cached (without eviction for now).

Storage (as earlier) and IR (from now) nodes can be configured with multiple
Neo endpoints. As above, `New` creates multi-client instance, so we don't
need initialization changes on app-side.

`Wait` and `GetDesignateHash` methods of `Client` return an error from now
to detect connection errors. `NotaryEnabled` method is removed as unused.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-02 11:04:38 +03:00
Leonard Lyubich
e738699fcc [#676] services/container: Cache the results of read operations
In previous implementation Container service handlers didn't cache the
results of `Get` / `GetEACL` / `List` operations. As a consequence of this,
high load on the service caused neo-go client's connection errors. To avoid
this there is a need to use cache. Object service already uses `Get` and
`GetEACL` caches.

Implement cache of `List` results. Share already implemented cache of Object
service with the Container one. Provide new instance of read-only container
storage (defined as an interface)to morph executor's constructor on which
container service is based. Write operations remained unchanged.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-08-30 18:01:26 +03:00
Pavel Karpy
c54f524df9 [#773] writecache: Delete unused dbSize param
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-08-27 15:05:53 +03:00
Pavel Karpy
9b32b5523d [#760] cli: Support COMMON_PREFIX matchtype
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-08-27 15:03:15 +03:00
Leonard Lyubich
7a5729ea2b [#761] cmd/node: Do not perform bootstrap procedure in relay mode
Storage node should not try to register itself in network in relay mode.

Implement `needBootstrap` method which checks if node need to bootstrap.
Call `bootstrap` method in `bootstrapNode` function only on true return.
Skip re-bootstrap logic in new epoch event handler on false return.
Return an error if `ControlService.SetNetmapStatus` is called on relay
node.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-08-26 18:54:55 +03:00
Leonard Lyubich
05d5b724a9 [#761] cmd/node: Rename reBootstrapEnabled to needBootstrap
`reBootstrapEnabled` state var is not used. It is going to be used to decide
whether to bootstrap node or not.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-08-26 18:54:55 +03:00
Leonard Lyubich
3c78890b97 [#761] cmd/node: Add bootstrap method docs
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-08-26 18:54:55 +03:00
Alex Vanin
cadd94f08f [#766] Fix stylecheck import linter error
Remove redundant imports

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-08-26 17:57:15 +03:00
Alex Vanin
53f031e98c [#766] Fix misspell linter error
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-08-26 17:57:15 +03:00
Leonard Lyubich
4b7cc6e293 [#758] cmd/neofs-adm: Implement command to refill storage node's GAS
Add `refill-gas` sub-command to `morph` command which provides the ability
to refill storage node's GAS.

Command performs some actions from `generate-storage-wallet` runner, so
common code is moved to a separate function `refillGas`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-08-25 17:07:23 +03:00
Evgenii Stratonikov
f9d9f33461 neofs-adm: use nnsResolveHash instead of custom code
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-24 12:35:52 +03:00
Evgenii Stratonikov
72b8d919fe [#755] neofs-adm: allow to filter containers by ID
`--cid <cid1> --cid <cid2>` as well as `--cid <cid1>,<cid2>` is supported.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-24 12:35:52 +03:00
Evgenii Stratonikov
00a299c1a4 [#755] neofs-adm: add contract hash flag to dump-containers
`--container-contract` flag must be used for deployments without NNS.
Our current testnet sidechain is like this, for example.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-24 12:35:52 +03:00
Evgenii Stratonikov
5072b703bc [#755] neofs-adm: allow to restore containers
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-24 12:35:52 +03:00
Evgenii Stratonikov
a013dcbab5 [#755] neofs-adm: allow to dump active containers
`morph dump-containers` will dump all containers from the
contaner contract. JSON format is chosen to allow manual intervention.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-24 12:35:52 +03:00
Evgenii Stratonikov
58e8d6e1fd [#755] neofs-adm: print NNS records during initialization
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-24 12:35:52 +03:00
Pavel Karpy
53036276e5 #759] node: Log notary status on startup
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-08-23 15:26:10 +03:00
Evgenii Stratonikov
8178c5e69b [#757] neofs-adm: ensure notary contract is enabled
This is the only case we support, it makes sense to fail early.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-19 17:46:10 +03:00
Evgenii Stratonikov
33c3f18b4f [#748] neofs-adm: allow to update contracts
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-10 12:03:10 +03:00
Pavel Karpy
aa0955f15d [#747] neofs-adm: Support ~ for paths in config
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-08-05 14:44:42 +03:00
Pavel Karpy
b5cadff2c3 [#745] node: Add more debug logs on shutdown
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-08-05 14:44:05 +03:00
Alex Vanin
d8e47e60a7 [#738] neofs-adm: Use constants and reduce code in dump-config
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-08-03 21:03:36 +03:00
Alex Vanin
ddbfb09560 [#738] neofs-adm: Add command to dump NeoFS network config
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-08-03 21:03:36 +03:00
Alex Vanin
37cc702271 [#738] neofs-adm: Set more network configuration values
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-08-03 21:03:36 +03:00
Pavel Karpy
e8665f6cef [#730] node/morph: Use disable_cache config param
Do not init caches for eACL, containers and netmap
if `disable_cache` config options is `true`, use
direct RPC calls instead.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-08-03 09:40:10 +03:00
Pavel Karpy
c423aa432a [#730] node/config/morph: Add disable_cache
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-08-03 09:40:10 +03:00
Pavel Karpy
cb842096d4 [#720] ir: Delete without_notary defaults
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-08-03 09:30:11 +03:00
Evgenii Stratonikov
e2cef00497 [#732] neofs-adm: read contract path only on init
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-02 14:28:23 +03:00
Evgenii Stratonikov
a2f6e07b1d [#732] neofs-adm: read alphabet contract once
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-02 14:28:23 +03:00
Evgenii Stratonikov
8e71773c4a [#732] neofs-adm: fetch single accounts during the initialization
Simplify code and perform error checking before the actual work.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-02 14:28:23 +03:00
Evgenii Stratonikov
018256def8 [#732] neofs-adm: remove debug output
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-02 14:28:23 +03:00
Evgenii Stratonikov
c81008764a [#732] neofs-adm: fetch native hashes once
Retrieve list of native contracts during initialization
in a single query.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-02 14:28:23 +03:00
Evgenii Stratonikov
6a40adcfca [#732] neofs-adm: get contract path on initialization
Simplifies code a bit.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-08-02 14:28:23 +03:00
Pavel Karpy
67b17cfb02 [#727] config: Use 0660 as default permissions
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-07-30 16:42:22 +03:00
Pavel Karpy
7a10d902be [#727] Use util.MkdirAllX instead of os.MkdirAll
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-07-30 16:42:22 +03:00
Evgenii Stratonikov
c332188341 [#685] neofs-adm: generate storage node wallets
Initial GAS can be provided both in config and as a CLI argument.
Generating wallet with 0 GAS is currently prohibited.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-07-30 14:09:51 +03:00
Evgenii Stratonikov
90259b5cc7 [#685] neofs-adm: reduce amount of logs
If `init` is run on a dirty network (i.e. with some stages already
done), no transactions are really sent so clean up logs a bit.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-07-30 14:09:51 +03:00
Evgenii Stratonikov
b95c16879d [#686] neofs-adm: implement morph force-new-epoch
Allow to force epoch change.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-07-30 14:08:56 +03:00
Evgenii Stratonikov
9c1fb0b55e [#728] neofs-adm: update to neofs-contract@v0.10.1
Add config parameters to netmap and neofs contracts.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-07-30 12:45:21 +03:00
Evgenii Stratonikov
2290109849 [#726] neofs-adm: use NNSIsAvailable from neo-go
There is no need in writing another wrapper.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-07-29 10:50:32 +03:00
Evgenii Stratonikov
9e56012760 [#726] neofs-adm: set alphabet contract addresses in NNS
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-07-29 10:50:32 +03:00
Evgenii Stratonikov
4d65e138f5 [#726] neofs-adm: allow to dump deployed contract hashes
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-07-29 10:50:32 +03:00
Evgenii Stratonikov
9ef2579afa [#726] neofs-adm: remove alphabet contract from contract list
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-07-29 10:50:32 +03:00
Evgenii Stratonikov
cf5f8a8f78 [#684] neofs-adm: transfer gas to the proxy contract
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-07-26 16:04:05 +03:00