Commit graph

35 commits

Author SHA1 Message Date
Alex Vanin
086b4c632c [#74] neofs: Check alphabet multi signature and don't use ballots
Ballots are inefficient to collect invocations of contract methods.
Instead contract can check multi signature collected outside of the
contract, e.g. with notary service.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-05-05 12:27:24 +03:00
Alex Vanin
be6c280032 [#74] neofs: Add AlphabetAddress method
This method returns multi signature address of alphabet
nodes in NeoFS contract.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-05-05 12:27:24 +03:00
Alex Vanin
ef0d6f02fd [#73] neofs: Do not store cheques
Cheques increase execution costs but provide which is
quite important for main chain execution.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-04-19 17:56:37 +03:00
Alex Vanin
23f5f1e0e7 [#63] Fix threshold number calculation
`x*2/3` is not equal to `x/3*2` with integers.
The only correct way to calculate threshold is
the first one.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-03-25 21:22:27 +03:00
Alex Vanin
80eadb4e5e [#58] neofs: Allow alphabet nodes to remove candidates
When alphabet nodes update inner ring list with new candidate,
then they remove it from neofs contract.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-03-25 18:19:47 +03:00
Alex Vanin
e74d8bf48d [#58] neofs: Store alphabet keys instead of inner ring
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-03-25 18:19:47 +03:00
Alex Vanin
d5e230e031 [#58] neofs: Do not limit initial inner ring key amount
Environment with single inner ring node is legal.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-03-25 18:19:47 +03:00
Alex Vanin
5e28938286 [#62] Remove methods with notifications from safe list
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-03-22 18:10:42 +03:00
Alex Vanin
97a5e27403 [#59] Update to pre-released version of neo-go v0.94.0
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-03-17 11:23:11 +03:00
Pavel Karpy
8af80e67aa [#37] Use readonly context
Delete initializing of R/W context in `init()`
and start using readonly storage context in
methods where it is possible.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-03-12 10:36:15 +03:00
Pavel Karpy
8d8482a88e [#26] Add safemethods fields
Fill in `safemethods` fields in contract config files
with methods that do not change contract storages.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-03-09 19:25:47 +03:00
Pavel Karpy
508369be75 [#25] Use go aliases
Change []byte type to interop.*aliasName*
types in contracts where it is suitable to
improve the readability of the contracts.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-03-05 17:13:49 +03:00
Alex Vanin
88c738b736 [#49] Support contract migration
At initialization contract saves master script hash
that allows to re-initialize or migrate contract.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-12 18:33:55 +03:00
Alex Vanin
a4a9a49a76 [#49] Remove trigger check from contracts
This check was useful when there was a single
entry point in contract. But right now there is
no point in this.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-12 18:33:55 +03:00
Alex Vanin
59d11af046 [#49] Revert "Do not read context in init with OnNEP17Payment"
This reverts commit 76c63b7d

It was workaround for neo-go#1725 but now it is fixed
so we don't need that anymore.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-12 18:33:55 +03:00
Alex Vanin
9cdfcd438e [#48] Add contract names
It is required field in contract config for deployment.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-11 15:50:01 +03:00
Alex Vanin
79e42fc31b [#47] Use native GAS and NEO contract wrappers
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-11 15:31:57 +03:00
Alex Vanin
76c63b7d5c [#47] Do not read context in init with OnNEP17Payment
There is an issue with native contract callback functions
and getting storage context: nspcc-dev/neo-go#1725.

This should fix it for now.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-11 15:31:57 +03:00
Alex Vanin
cff7688486 [#47] Remove legacy config records
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-11 15:31:57 +03:00
Alex Vanin
8abdf796f3 [#47] Update native contract hashes
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-11 15:31:57 +03:00
Alex Vanin
27ca675869 [#47] Update contract.Call invocations
Now contract calls require call flags.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-11 15:31:57 +03:00
Alex Vanin
fd803ef639 [#47] Update iterator interface
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-11 15:31:57 +03:00
Alex Vanin
75c696a555 [#47] Rename onPayment to onNEP17Payment
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-11 15:31:57 +03:00
Leonard Lyubich
3395a886fc [#42] Share InnerRingInvoker function between contracts
Define IRNode structure in common package. Replace innerRingInvoker function
in common package and export it. Reuse this function in all contracts.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-04 10:31:24 +03:00
Leonard Lyubich
c3efe152d6 [#42] Share Vote/RemoteVotes between contracts
Replace vote/remoteVotes functions from all contracts (except alphabet) to
common package. Additionally replace setSerialized and bytesEqual. Create
InitVote function and use it in NeoFS and Netmap contracts.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-04 10:31:24 +03:00
Leonard Lyubich
f9f2a03078 [#42] Share ballot structure between contracts
Create common package. Define Ballot struct in common package. Use new type
in all contracts with ballots.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-04 10:31:24 +03:00
Alex Vanin
e87765b733 [#44] Fix processing order in voting
Remove old ballots first so there won't be any
interference with votes of the same tx in the
future after `blockDiff` blocks.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-02 19:02:56 +03:00
Alex Vanin
c6fd4dc77c [#23] *: Update script hashes of native contracts
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-29 14:15:26 +03:00
Alex Vanin
5fc9ed999d [#23] *: Update script hashes of native contracts
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-29 14:15:26 +03:00
Alex Vanin
37d8905d55 [#23] neofs: Implement OnPayment method for asset deposit
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-29 14:15:26 +03:00
Alex Vanin
29f2f0ef17 [#23] *: Support NEP-17 in native asset transfers
Now `transfer()` requires 4 arguments.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-29 14:15:26 +03:00
Alex Vanin
806dbbb487 [#23] *: Update notification types
- rename ByteString to ByteArray type
- use Hash256 on transaction hashes

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-29 14:15:26 +03:00
Alex Vanin
189a83d9d6 [#23] *: Replace engine.AppCall with contract.Call 2020-12-29 14:15:26 +03:00
Alex Vanin
76f5943c14 [#24] neofs: Fix for iterator on updated inner ring list
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-14 10:59:49 +03:00
Alex Vanin
df27e859c9 [#18] Move neofs contract to separate dir
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-10-27 17:33:56 +03:00