Cobra commands don't call `PreRun` functions on parent by default. We
need to do it in `subnet` command of admin utility in order to inherit
viper bindings.
Add `inheritPreRun` function which makes sub-commands to call `PreRun`
functions before its own `PreRun`.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Use persistent flags on parent command in order to inherit flags in
sub-commands. Turn on notary mode of morph client in `subnet` command of
admin utility for notary environments.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Make `deployContracts` method to call `nnsRegisterDomain` in order to
register NNS domain for deployed contracts.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Make `nnsResolveHash` function to return declared error on `token not
found` fault exception. Catch this error in `deployContracts` method,
and switch to deployment if updating contract is missing.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Add `subnet` command which contains all subnet-related commands. Add
sub-commands:
* `create` for creation;
* `remove` for removal;
* `get` for reading;
* `admin` for admin management;
* `client` for client management.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
Assume contracts path is tar.gz archive if it is not a directory.
In theory we could support raw tar but it has little value as our
distribution format is tar.gz and this is the primary use-case for this
feature (download and use).
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Note that we cannot mark `--rpc-endpoint` flag as required because
it can be taken from config.
Before:
```
Error: can't create N3 client: failed to get network magic: Post "": unsupported protocol scheme ""
```
Now:
```
Error: can't create N3 client: missing endpoint
```
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
```
Error: can't to initialize context: can't read alphabet wallets dir: open : no such file or directory
```
It needs neither contracts nor wallets, just N3 client.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Non-alphabet contract are always deployed from committee
so it makes sense to calculate hashes in one place.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Container contract uses actual NNS interface. This also aleviates some
pain related to update as neofs-adm code itself uses current NNS
version.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Container contract now calls NNS contract to register TLD for nice
names. This must be witnessed by a committee.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Contract owners are removed in neofs-contract v0.11.0.
Now side chain committee has rights to update contracts.
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
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>
`--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>
`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>