Commit graph

197 commits

Author SHA1 Message Date
Evgenii Stratonikov
95893927aa *: replace neofs-api-go with neofs-sdk-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-12 17:29:09 +03:00
Pavel Karpy
b492201a84 [#936] morph/nns: Add record existence check
Also, add ErrNNSRecordNotFound error that
indicates that required hash is not presented
in `NNS` contract.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-11-10 16:11:57 +03:00
Pavel Karpy
8956f015fc [#941] morph/notary: Delete useless "low till" check
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-10-25 19:16:05 +03:00
Pavel Karpy
78aab096fb [#941] morph/notary: Add dynamic notary deposit till calculation
Do not set `till` as some constant:
use maximum of two values instead:
1. currentDepositTill;
2. currentHeight+epochDuration+constant.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-10-25 19:16:05 +03:00
Alex Vanin
eaecc438f8 [#932] neofs-cli: Support ContainerAliasFee global config parameter
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-10-19 19:15:56 +03:00
Leonard Lyubich
e0f0188466 [#907] container/put: Work with named containers
Add name and zone arguments to `Put` method of wrapper over the Container
contract client. Pass result of `container.GetNativeNameWithZone` function
to the method in `Put` helper function. Due to this, the storage node will
call the method depending on the presence of the container name in the
attributes.

Make IR to listen `putNamed` notification event. The event is processed like
`put` event, but with sanity check of the container attributes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-10-18 11:54:34 +03:00
Leonard Lyubich
7db47c88bf [#907] morph/container: Add native name and zone to PutArgs
Add `PutArgs.SetNativeNameWithZone` method which sets native name and zone
for container. Call `putNamed` method of Container contract if name is set,
otherwise call `put` method.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-10-18 11:54:34 +03:00
Leonard Lyubich
7582689de4 [#833] morph/netmap: Support ListConfig contract method
Implement `Client.ListConfig` method which calls `listConfig` method of
Netmap contract. Implement `Wrapper.IterateConfigParameters` method which
uses previous one. Implement `wrapper.WriteConfig` helper function which
allows to interpret parameters by names.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-10-15 13:56:19 +03:00
Leonard Lyubich
cb22e2bf29 [#833] morph/client: Implement MsPerBlock method
Add `Client.MsPerBlock` method which reads MillisecondsPerBlock network
parameter.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-10-15 13:56:19 +03:00
Pavel Karpy
505d92bb06 [#873] morph/notary: Not warn at "low till value" notary deposit error
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-10-15 12:22:25 +03:00
Pavel Karpy
d2096b392c [#873] morph/client: Add function that calculates notary deposit
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-10-15 12:22:25 +03:00
Evgenii Stratonikov
d55456f3ac [#905] morph/client: handle latest NNS version
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-10-14 15:21:12 +03:00
Leonard Lyubich
d6c0307431 [#627] morph: Inherit internal.StaticClient interface in all wrappers
There is a need to provide contract address getter from all contract client
wrappers.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-30 14:47:04 +03:00
Leonard Lyubich
1860f5040c [#627] morph: Define partial interface of StaticClient type
There is a need to inherit some methods of `StaticClient` type. In order to
not inherit all method via type embedding we can group sub-set of methods
and inherit it.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-30 14:47:04 +03:00
Leonard Lyubich
6ce30c959c [#627] morph: Add contract address getter to StaticClient
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-30 14:47:04 +03:00
Pavel Karpy
e3c0288e50 [#846] morph/notary: Add nonce parameter to notary invocation method
This prevents notary requests collisions
for TXs that contains equals hashable fields.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-27 11:10:15 +03:00
Pavel Karpy
5e74830c38 [#837] morph: Add WithSingleClient client constructor option
`WithSingleClient` allows Morph client
creation with existing raw neo-go client.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-24 19:14:28 +03:00
Alex Vanin
f43f389399 [#786] morph/client: Add NNS contract address getter
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-09-13 14:51:35 +03:00
Alex Vanin
a7f6a3df78 [#812] morph/client: Add underline client getter in reputation wrapper
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-09-13 14:51:07 +03:00
Pavel Karpy
74afcbe409 [#815] pkg/morph/netmap: Add Morph() method
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-13 14:50:52 +03:00
Pavel Karpy
1ed5323850 [#801] morph/wrappers: Sync commentary and struct names
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-09 14:07:57 +03:00
Pavel Karpy
425c02b0ec [#801] morph/netmap: Add wrapper options
Add constructor options on wrapper level
of `netmap` contract.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-09 14:07:57 +03:00
Pavel Karpy
9921358f09 [#770] pkg/morph: Add NotarySignAndInvokeTX
Add `NotarySignAndInvokeTX` method to morph
client. This function allows invoking notary
request with passed main TX(not creating a
new one). It signs passed main TX with
client's key.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00
Pavel Karpy
79b350b628 [#770] morph: Support non-alpha notary request by wrappers
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00
Pavel Karpy
94d431e56e [#770] morph/client: Support non-alpha notary request
Add `NotaryInvokeNotAlpha` to low-level
client. It creates and sends notary request
that must be signed by Alphabet nodes, but
does not sign it by current node's private
key.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00
Pavel Karpy
b46adf188c [#770] pkg/morph/container: Add Morph() method
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00
Pavel Karpy
46df288d33 [#770] pkg/morph: Add Morph() method
Add access to low-level morph client in
wrappers

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00
Pavel Karpy
c0e25d1706 [#770] morph/client: Fix comment for fallbackTime
`fallbackTime` is delta b/w `ValidUntilBlock` of
the main transaction and block when `fallback`
transaction is sent.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-09-07 12:55:01 +03:00
Leonard Lyubich
81722c373b [#746] morph/client: Don't cache GAS contract address on NeoFS-side
Caching is performed inside `GetNativeContractHash` method of neo-go client,
so the additional cache level is redundant.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-02 11:04:38 +03:00
Leonard Lyubich
18c49c2cb9 [#746] morph/client: Break loop in iterateClients on NeoFS error
There is no need to continue iterating over Neo RPC endpoints in case of
some address-independent error (e.g. NeoFS logic error).

Unwrap and immediately return `neofsError` errors from loop in
`iterateClients`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-02 11:04:38 +03:00
Leonard Lyubich
a2b81f13b0 [#746] morph/client: Simplify loop control in iterateClients
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-02 11:04:38 +03:00
Leonard Lyubich
3b7e884e74 [#746] morph/client: Distinguish between neo-go errors and NeoFS logic
Implement `error` interface on new `neofsError` type which is a wrapper over
NeoFS-specific error. Wrap all `Client` errors except neo-go client API ones
into `neofsError`. Wrapped errors are going to be used for multi-endpoint
loop control.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-09-02 11:04:38 +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
Alex Vanin
43dfccd9b3 [#751] morph/client: Add custom signer scope support
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-08-06 17:29:27 +03:00
Pavel Karpy
896c749b92 [#720] pkg/innerring: Check Notary availability automatically
Do not read `without_notary` config value from env.
Make morph client constructor return client without
notary support. Enabling notary support should be done
with public `EnableNotarySupport` method separately.

Notary availability is deducted with client. Further,
if notary is presented on chain its support is
enabled at the corresponding client.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-08-03 09:30:11 +03:00
Alex Vanin
bba470570f [#708] morph/client: Update last epoch block method name
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-07-22 20:40:09 +03:00
Alex Vanin
3561cf5873 [#712] moprh/client: Log VUB in notary invocations
For easier debug when notary transaction didn't execute.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-07-22 15:46:48 +03:00
Alex Vanin
7146afcd28 [#708] morph/client: Add epoch block getter from netmap
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-07-22 15:20:34 +03:00
Alex Vanin
7e43af3de3 [#708] morph/client: Add BlockCount method
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-07-22 15:20:34 +03:00
Pavel Karpy
8ea5744326 [#705] pkg/morph/netmap: Fix updateInnerRing method
Add initialization of `updateInnerRing` method name
in config on startup.
Rename var `setInnerRing` => `updateInnerRing`.
Rename method `SetInnerRing` => `UpdateInnerRing`

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-07-22 15:12:06 +03:00
Pavel Karpy
84361beada [#705] pkg/morph/netmap/wrapper: Add GetInnerRingList method
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-07-22 15:12:06 +03:00
Pavel Karpy
b3c81116b9 [#705] pkg/morph/netmap: Add innerRingList method
Add `innerRingList` method to `netmap` client
wrapper. Method parses current IR nodes list.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-07-22 15:12:06 +03:00
Pavel Karpy
00b487e3c3 [#705] morph/notary: Add ProbeNotary method to Client
`ProbeNotary` method checks if native `Notary`
contract is presented on chain.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-07-22 15:12:06 +03:00
Alex Vanin
c90f054f35 [#658] morph/neofs: Add TryNotary() option
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-07-02 09:53:34 +03:00
Alex Vanin
c0093b2b79 [#658] morph/neofsid: Add TryNotary() option
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-07-02 09:53:34 +03:00
Pavel Karpy
a2b622d62e [#647] pkg/morph/netmap/wrapper: GetCandidates method
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-29 22:29:23 +03:00
Pavel Karpy
d664a00e94 [#647] pkg/morph/netmap: Add netmapCandidates method
Add `netmapCandidates` method to `netmap` client
wrapper. Method parses node storages candidates
for the next epoch.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-29 22:29:23 +03:00
Pavel Karpy
403f836968 [#647] pkg/morph: Add constant var to err message
Use defined constant variable instead of
hardcoded number in error message.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-29 22:29:23 +03:00
Alex Vanin
5df55bcfaf [#648] morph/client: Fix method name in NewEpoch
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-06-25 16:29:00 +03:00