Commit graph

5205 commits

Author SHA1 Message Date
Anna Shaleva
15b4e0a8cd services: adjust StateRoot service initialisation
Perform initialisation of StateRoot service with designated
StateValidator's node list in the service constructor. There's no need
to wait until the next role update event, and it may lead to inaccuraces
in service work on SIGHUP/server restart.

A part of #3228.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-24 15:25:51 +03:00
Anna Shaleva
11ec0db350 core, services: fix Designation-dependant service initialisation
Initialise services dependant on roles designation based on N+1
block so that Genesis roles extension work properly. There's not
much sence to fetch node roles information for the latest persisted
block because Designation contract itself makes designated nodes
responsible since the next subsequent block.

A part of #3228.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-24 15:25:51 +03:00
Anna Shaleva
5d1e0192f1
Merge pull request #3206 from nspcc-dev/relative_path_flag
cli: add --relative-path option
2023-11-24 08:16:16 +03:00
Roman Khimov
1f84756c21
Merge pull request #3222 from nspcc-dev/doc/contracts-storage-seek-call-improvement
doc/Mention prefix trimming in `Seek` operations where applicable
2023-11-23 23:03:20 +03:00
Roman Khimov
61d5b6eb0c
Merge pull request #3221 from nspcc-dev/json-limits
Anti-DOS RPC limitations
2023-11-23 23:02:50 +03:00
Ekaterina Pavlova
f457d50773 cli: add --relative-path option
To be able running the node from any working directory by simply
pointing the relative-path as prefix for relative parameters set in
config.

Closes #3179.

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2023-11-23 21:41:50 +04:00
Anna Shaleva
d511f6e5a9 confi: add MaxRequestHeaderBytes RPC configuration option
A part of #3131, follow the notion of https://github.com/neo-project/neo-modules/pull/827,
but don't restrict request line size due to https://github.com/golang/go/issues/15494.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-23 20:17:49 +03:00
Anna Shaleva
802d8d24b9 config: add MaxRequestBodySize RPC configuration option
A part of #3131, follow the https://github.com/neo-project/neo-modules/pull/827.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-23 20:17:49 +03:00
Pavel Karpy
62b710868b *: mention prefix trimming in Seek operations where applicable
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2023-11-23 18:44:19 +03:00
Roman Khimov
341d978e5b compiler: walk over functions in reproducible order, fix #3219
It affects both Debug data and bindings, otherwise two unnamed structures can
get any of unnamed/unnamedx names depending on particular invocation.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-11-23 13:21:51 +03:00
Anna Shaleva
22c654b200 neorpc: restrict maximum subitems number in SignerWithWitness
Restrict the number of Rules, Contracts and Groups. A part of #3131.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-23 12:12:34 +03:00
Anna Shaleva
2f6ba1fded rpcsrv: define GetSignersWithWitnesses on a pointer
Nil receiver can be properly handled and all other `Param`'s mathods
are defined on a pointer.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-23 11:44:29 +03:00
Roman Khimov
25ef2c7f16
Merge pull request #3218 from nspcc-dev/serialization-limits
Introduce stackitem serialization limits
2023-11-22 21:28:25 +03:00
Anna Shaleva
910d53b27b core: do not check manifest size on deploy/update
Manifest will be a part of the state.Contract which will be checked on its
way to the storage. Tiny optimisation which allows not to serialize manifest
twice. Ref. https://github.com/nspcc-dev/neo-go/pull/3218#discussion_r1402374232.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-22 20:17:09 +03:00
Anna Shaleva
1d189fd90c Revert "native: ignore decoding errors during cache init"
This reverts commit 822722bd2e.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-22 19:39:03 +03:00
Anna Shaleva
6824bd9f40 smartcontract: require manifest serialization in (*Manifest).IsValid
Port the restrictive part of https://github.com/neo-project/neo/pull/2948.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-22 19:39:03 +03:00
Anna Shaleva
387c411da0 vm: add default limit to SI serialization context
Follow the notion of https://github.com/neo-project/neo/pull/2948.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-22 19:39:01 +03:00
Roman Khimov
00c6a811ab
Merge pull request #3215 from nspcc-dev/tiny-compiler-fixes
Tiny compiler fixes
2023-11-22 19:29:37 +03:00
Roman Khimov
4c9cd438f8 rpcbinding: sort named types to stabilize output
Same input -> same output, otherwise tests fail and @AnnaShaleva is annoyed.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-11-21 21:47:51 +03:00
Roman Khimov
eade327b9b compiler: check for pkg nilness, fix #3202
Unfortunately, when import cycle happens somewhere deep in the import chain we
dont't get an error from packages.Load(). But it leaves some imports
uninitialized, so at least we can check for them.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-11-21 21:47:51 +03:00
Roman Khimov
fced6a27ba compiler: iterate over autoguessed events in reproducible way
Otherwise it's undertermined which of two unnamed structures will get "Unnamed"
and "UnnamedX" which can break the test from time to time.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-11-21 18:43:40 +03:00
Roman Khimov
5370034955 compiler: deduplicate autoguessed event names, fix #3088
Make them stable wrt parameter order and use proper names in event structures
as well.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-11-21 18:35:26 +03:00
Roman Khimov
a5d041a1ac compiler: check range first, analyze funcs then
Type data is added while walking through function ins/outs even if we're to
throw this function away. But we don't need it, these types are not used, so
we can deal with the main part of #3071 by optimizing this out.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-11-21 17:52:17 +03:00
Roman Khimov
2ae44e074d docs: canceltransaction is not going to be supported
Refs. neo-project/neo-modules#837.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-11-21 16:11:58 +03:00
Roman Khimov
ff958706f4
Merge pull request #3212 from nspcc-dev/drop-history
Move NativeUpdateHistory logic uner hardforks
2023-11-21 15:46:16 +03:00
Roman Khimov
28ee1621b8
Merge pull request #3155 from nspcc-dev/apptr-pricing
*: introduce Policy attributes pricing
2023-11-21 15:44:40 +03:00
Anna Shaleva
58102a9a80 *: move NativeUpdateHistory logic under Hardforks management
Close #3196.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-21 14:05:28 +03:00
Anna Shaleva
64b5ba24e9 *: fix less then typos everywhere
My poor grammar...

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-21 13:47:59 +03:00
Anna Shaleva
3b11f98cd0 core: review usages of (*intero.Context).BlockHeight method
This method returns persisted block height and doesn't take into account
persisting block height. Some of the callers of this method relay on
the wrong assumption that BlockHeight() returns persisting block index.

Fix improper usages of this method and adjust tests. Ref.
61a066583e/src/Neo/SmartContract/ApplicationEngine.cs (L634).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-21 13:46:13 +03:00
Anna Shaleva
474225d425 core, rpcsrv: apply generic attributes fee logic to NotaryServiceFeePerKey
Remove related methods from native Notary and add relevant code to native
Policy.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-21 13:42:56 +03:00
Anna Shaleva
82cb2e718d native: introduce attribute pricing
Port the https://github.com/neo-project/neo/pull/2916.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-21 13:42:56 +03:00
Roman Khimov
80fcf81102
Merge pull request #3209 from nspcc-dev/strict-cfg
Forbid unknown YAML node configuration fields
2023-11-21 13:20:57 +03:00
Anna Shaleva
59baecd39b wallet: provide more detailed errors on failed NewWalletFromFile
Close #3180.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-21 13:07:11 +03:00
Anna Shaleva
63de821ff4 config: forbid unknown YAML configuration fields
Close #3128 and fix one of the privnet configurations along the way.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 20:04:09 +03:00
Anna Shaleva
a4779de375 core: improve TestConfigNativeUpdateHistory subtests naming
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 20:03:28 +03:00
Anna Shaleva
0fef119f5f rpcsrv: update test data
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 19:41:45 +03:00
Anna Shaleva
406c9f8b92 core, interop: add strLen method for native StdLib contract
Close #3195.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 19:23:33 +03:00
Roman Khimov
f6cb698cd1 rpcsrv/params: limit tx signers/witnesses
Inspired by https://github.com/neo-project/neo-modules/pull/845.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-11-20 16:01:14 +03:00
Roman Khimov
7fb077e999
Merge pull request #3186 from nspcc-dev/reduce-max-nef-size
Restrict maximum serialized NEF file size
2023-11-20 15:19:40 +03:00
Anna Shaleva
90705e37e9 compiler: perform NEF size check on serialization
Retun an error if the serialized NEF size exceeds stackitem.MaxSize.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 15:14:05 +03:00
Anna Shaleva
e63a93b8a0 compiler: add tests for System.Runtime.CurrentSigners
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 14:49:07 +03:00
Anna Shaleva
2fba04490a core: add System.Runtime.CurrentSigners syscall
Port the https://github.com/neo-project/neo/pull/2827.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 14:46:27 +03:00
Anna Shaleva
90b01bcea6 core: move SignersToStackItem to transaction package
It will be reused from interops.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 14:46:27 +03:00
Anna Shaleva
14d98811a5 smartcontract: restrict maximum NEF file size on deserialisation
Port https://github.com/neo-project/neo/pull/2939.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 14:32:32 +03:00
Anna Shaleva
fdcc369d60 manifest: add compatibility test for Permissions and Trust serialization
We already have tests for Permission deserialisation, so port the first
part of https://github.com/neo-project/neo/pull/2948.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-18 13:32:28 +03:00
Roman Khimov
de2a445088
Merge pull request #3185 from nspcc-dev/fix-stackitem-limits
vm: reduce maximum stckitem size
2023-11-13 22:53:19 +03:00
Anna Shaleva
b0cdae4666 vm: reduce maximum stckitem size
To prevent possible DoS. Port the https://github.com/neo-project/neo-vm/pull/514,
close #3170.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-13 20:40:30 +03:00
Anna Shaleva
963a22e280 neorpc: adjust common error messages
According to the initial proposal and
https://github.com/neo-project/proposals/pull/156/files#diff-2b5f7c12a23f7dbe4cb46bbf4be6936882f8e0f0b3a4db9d8c58eb294b02e6ed.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-13 20:29:13 +03:00
Roman Khimov
7045d3bd63
Merge pull request #3192 from nspcc-dev/rpc-err
neorpc: ensure errors.Is and errors.As work properly with neorpc.Error
2023-11-08 09:34:05 +03:00
Anna Shaleva
fca7eb35a1 neorpc: ensure errors.Is and errors.As work properly with neorpc.Error
Close #3188.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-07 23:59:53 +03:00