Commit graph

5839 commits

Author SHA1 Message Date
Roman Khimov
edb6ca8926
Merge pull request #2531 from nspcc-dev/perf
Minor performance improvements
2022-06-03 10:40:56 +03:00
Roman Khimov
400cbde32c state: optimize allocations in (*NEP17Transfer).EncodeBinary 2022-06-02 15:38:39 +03:00
Roman Khimov
54f75bb999 consensus: don't use WriteArray for PrepareRequests
It's convenient, but it's not efficient due to reflection use.
2022-06-02 15:38:39 +03:00
Roman Khimov
b0744c2b21 util: optimize MarshalJSON allocations
name                  old time/op    new time/op    delta
Uint256MarshalJSON-8     230ns ± 6%      83ns ±13%  -63.78%  (p=0.000 n=8+10)

name                  old alloc/op   new alloc/op   delta
Uint256MarshalJSON-8      320B ± 0%       80B ± 0%  -75.00%  (p=0.000 n=10+10)

name                  old allocs/op  new allocs/op  delta
Uint256MarshalJSON-8      5.00 ± 0%      1.00 ± 0%  -80.00%  (p=0.000 n=10+10)
2022-06-02 15:38:39 +03:00
Roman Khimov
9a06995460 bigint: don't allocate in ToPreallocatedBytes
Turns out, it's almost always allocating because we're mostly dealing with
small integers while the buffer size is calculated in 8-byte chunks here, so
preallocated buffer is always insufficient.

name                   old time/op    new time/op    delta
ToPreallocatedBytes-8    28.5ns ± 7%    19.7ns ± 5%   -30.72%  (p=0.000 n=10+10)

name                   old alloc/op   new alloc/op   delta
ToPreallocatedBytes-8     16.0B ± 0%      0.0B       -100.00%  (p=0.000 n=10+10)

name                   old allocs/op  new allocs/op  delta
ToPreallocatedBytes-8      1.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)

Fix StorageItem reuse at the same time. We don't copy when getting values from
the storage, but we don when we're putting them, so buffer reuse could corrupt
old values.
2022-06-02 15:38:39 +03:00
Roman Khimov
c3d989ebda stackitem: reusable serialization context
We serialize items a lot and this allows to avoid a number of allocations.
2022-06-02 15:38:39 +03:00
Roman Khimov
80823c58d9
Merge pull request #2380 from nspcc-dev/notary-tunes
*: several Notary subsystem adjustments, part 2
2022-06-01 15:34:07 +03:00
Roman Khimov
5a92ed339b
Merge pull request #2530 from nspcc-dev/enable-hf
config: adjust HF enabled height
2022-06-01 15:31:10 +03:00
Anna Shaleva
3d242a01ca config: adjust HF enabled height 2022-06-01 15:22:55 +03:00
Anna Shaleva
808d8a281e examples: update neo-go dependency 2022-06-01 15:12:30 +03:00
Anna Shaleva
3c2fc165b6 gomod: update interop dependency 2022-06-01 15:10:43 +03:00
Anna Shaleva
3bec6657f5 core: adjust notary-related attributes encoding 2022-06-01 15:09:06 +03:00
Anna Shaleva
1b80215415 core: adjust types of NVB, Conflicts and NotaryAssisted attributes 2022-06-01 15:09:06 +03:00
Anna Shaleva
c4f3a92485 rpc: regenerate testchain 2022-06-01 15:09:02 +03:00
Anna Shaleva
d540f16e37 core: adjust noderoles package usages
Don't use interop roles package for internal tests.
2022-06-01 15:03:29 +03:00
Anna Shaleva
56d5839a72 core: log stateroot N20 hash inside TestCreateBasicChain 2022-06-01 15:03:29 +03:00
AnnaShaleva
4291efc8f0 services: fix typo in method description 2022-06-01 15:03:29 +03:00
AnnaShaleva
50157b31cd core: add maximum constraint to setNotaryServiceFeePerKey 2022-06-01 15:03:29 +03:00
AnnaShaleva
d7afb7bb2f core: adjust value of P2PNotary node role 2022-06-01 15:03:29 +03:00
AnnaShaleva
9008cc500c core: adjust Notary contract ID 2022-06-01 15:03:29 +03:00
Roman Khimov
3d4076ca36 vm: microoptimize new estack creation
Subslice won't reach element -1, but it can reuse the same buffer space more
effectively.
2022-05-31 18:53:05 +03:00
Roman Khimov
10110d4e70 bigint: correct MaxBytesLen
It can't be 33, positive signed int256 all fit into 32 bytes (no need for
leading zero), negative ones fit into 32 bytes as well.
2022-05-31 16:51:19 +03:00
Roman Khimov
3945e81857 bigint: don't allocate in ToPreallocatedBytes() for negative numbers
In-place modifications are somewhat dangerous, but yet another allocation is
quite costly.
2022-05-31 12:45:34 +03:00
Roman Khimov
3509523baf contract: tune isolation logic
Wrap when we have outer exception handler and the method is not
safe. Otherwise we wrap almost always, since non-readonly methods are very
common.
2022-05-31 11:44:12 +03:00
Roman Khimov
e1607e23c2
Merge pull request #2525 from nspcc-dev/immutable-items
vm: implement immutable stackitems
2022-05-31 10:36:56 +03:00
Anna Shaleva
42a051e55a core: DeepCopy notifiction event args inside System.Runtime.Notify 2022-05-31 08:07:53 +03:00
Anna Shaleva
7296f0c913 vm: support immutable compound types 2022-05-31 08:07:50 +03:00
Anna Shaleva
107f5e0793 vm: adjust refcount operations order
Perform add/set/remove operations with VM type firstly, and with
refcounter after that. It is needed to be able to extend add/set/remove
operations with extra checks.
2022-05-31 08:02:13 +03:00
Roman Khimov
270dfbe241
Merge pull request #2526 from nspcc-dev/rpc-err
rpc: do not allow empty error's Cause
2022-05-30 17:12:57 +03:00
Anna Shaleva
ebc3974545 rpc: do not allow empty error's Cause
Server logger is broken after #2496:
```
2022-05-30T10:35:06.096Z        ERROR   Error encountered with rpc request
```
2022-05-30 15:58:46 +03:00
Roman Khimov
9d0215985f
Merge pull request #2527 from nspcc-dev/yaml-v3
gomod: upgrade yaml package from v2 to v3
2022-05-30 15:39:39 +03:00
Evgeniy Stratonikov
ec21c14ca9 gomod: upgrade yaml package from v2 to v3
Close #2085.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-05-30 15:26:17 +03:00
Roman Khimov
ee82e297fe
Merge pull request #2523 from nspcc-dev/add-vote-events
native: emit vote/candidate events
2022-05-30 08:16:07 +03:00
Roman Khimov
8007f7be92
Merge pull request #2524 from nspcc-dev/codeql
.github: update codeql version, fix #2522
2022-05-30 08:15:56 +03:00
Roman Khimov
e8a876a73b .github: update codeql version, fix #2522 2022-05-28 22:54:50 +03:00
Roman Khimov
5e013311e6 native: emit vote/candidate events
Follow neo-project/neo#2754.
2022-05-28 18:44:20 +03:00
Roman Khimov
502cdd68ab
Merge pull request #2508 from nspcc-dev/snapshot-isolation
core, vm: implement snapshot isolation
2022-05-27 12:44:06 +03:00
Roman Khimov
fdc1593da2
Merge pull request #2520 from nspcc-dev/preliminary-mainnet-hf
config: set Aspidochelone hard fork for mainnet
2022-05-27 09:30:18 +03:00
Roman Khimov
c605cfb580 config: set Aspidochelone hard fork for mainnet
See neo-project/neo-node#862. It's not yet official, but this change makes
testing against mainnet dumps easier for node.
2022-05-26 23:52:57 +03:00
Roman Khimov
0111cd8ae7
Merge pull request #2519 from nspcc-dev/fix-getrand
core:  adjust System.Runtime.GetRandom
2022-05-26 15:34:07 +03:00
Anna Shaleva
8055952bbc core: rename hardfork HF_2712_FixSyscallFees
Fantastic Beasts and Where to Find Them
2022-05-26 14:20:48 +03:00
Anna Shaleva
c4ad434f20 core: adjust System.Runtime.GetRandom
1. Make seed dependant on the GetRandom invocations counter.
2. Adjust syscall price.
2022-05-26 14:20:12 +03:00
Anna Shaleva
a79c80cb8d vm: wrap cross-contract exceptions 2022-05-26 11:44:26 +03:00
Anna Shaleva
a39b7cc3fd core, vm: move all isolation-related logic out of VM
Keep it inside the interop context.
2022-05-26 09:26:31 +03:00
Anna Shaleva
f79f62dab4 vm: use single function instead of committer/discarder 2022-05-26 09:26:31 +03:00
Anna Shaleva
08b68e9b82 vm, core: push Null return value only if no exception occurs
Close https://github.com/nspcc-dev/neo-go/issues/2509.
2022-05-26 09:26:31 +03:00
Anna Shaleva
ce226f6b76 vm: optimize context wrapping code
We can omit DAO wrapping for safe methods and for those methods that are not
wrapped into try-catch block. However, we still need to persist
notificationsCount changes for these methods to the parent context.
2022-05-26 09:26:31 +03:00
Anna Shaleva
0cd19f550e core, vm: implement snapshot isolation
Initial implementation without optimisations, but it should work.
2022-05-26 09:26:25 +03:00
Roman Khimov
c6666c52bc
Merge pull request #2515 from nspcc-dev/interop-marshalling
vm: stringify InteropInterface stackitem type as `InteropInterface`
2022-05-25 13:38:26 +03:00
Anna Shaleva
a3285eae04 vm: stringify InteropInterface stackitem type as InteropInterface 2022-05-25 13:20:21 +03:00