Commit graph

7692 commits

Author SHA1 Message Date
Anna Shaleva
8f70d05f85 docs: add a note about System.Runtime.GetNotifications refcounting
Add a note about System.Runtime.GetNotifications refcounting to Domovoi
hardfork. Ref. https://github.com/neo-project/neo/pull/3301 and
https://github.com/nspcc-dev/neo-go/pull/3485.

Although NeoGo doesn't have anything to be updated, there's a
behaviour difference between C# and Go nodes before Domovoi hardfork, it
deserves a comment.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-06-11 19:26:11 +03:00
Roman Khimov
21aaadc4b7
Merge pull request #3473 from nspcc-dev/fix-call-check 2024-06-11 19:21:44 +03:00
Anna Shaleva
a7aceca74a interop: use currently executing contract state for permissions check
It's not correct to use an updated contract state got from Management to
check for the allowed method call. We need to use manifest from the
currently executing context for that. It may be critical for cases when
executing contract is being updated firstly, and after that calls
another contract. So we need an old (executing) contract manifest for
this check.

This change likely does not affect the mainnet's state since it's hard
to meet the trigger criteria, but I'd put it under the hardfork anyway.

Ref. https://github.com/neo-project/neo/pull/3290.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-06-11 19:13:17 +03:00
Roman Khimov
02627e948f
Merge pull request #3485 from nspcc-dev/test-maxstacksize 2024-06-11 19:04:26 +03:00
Roman Khimov
cffef71be7
Merge pull request #3476 from nspcc-dev/D-hardfork 2024-06-11 19:01:40 +03:00
Anna Shaleva
d156cea24d vm: improve stack size related errors
No functional changes, just add more details to the error.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-06-11 18:34:22 +03:00
Anna Shaleva
effba1fa47 core: ensure System.Runtime.GetNotifications can't break MaxStackSize
This test ensures that NeoGo node doesn't have the DeepCopy problem
described in https://github.com/neo-project/neo/issues/3300 and fixed in
https://github.com/neo-project/neo/pull/3301. This problem leads to the
fact that Notifications items are not being properly refcounted by C#
node which leads to possibility to build an enormously large object on
stack. Go node doesn't have this problem.

The reason (at least, as I understand it) is in the fact that C# node
performs objects refcounting inside the DeepCopy even if the object
itself is not yet on stack. I.e. System.Runtime.Notify handler
immediately adds references to the notification argumetns inside
DeepCopy:
b1d27f0189/src/Neo.VM/Types/Array.cs (L108)
b1d27f0189/src/Neo.VM/Types/Array.cs (L75)

Whereas Go node just performs the honest DeepCopy without references counting:
b66cea5ccc/pkg/vm/stackitem/item.go (L1223)

Going further, C# node clears refs for notification arguments (for array
and underlying array items). System.Runtime.GetNotifications pushes the
notificaiton args array back on stack and increments counter only for
the external array, not for its arguments. Which results in negative
refcounter once notificaiton is removed from the stack. The fix itself
(f471c0542d/src/Neo/SmartContract/NotifyEventArgs.cs (L84))
doesn't need to be ported to NeoGo because Go node adds object to the
refcounter only at the moment when it's being pushed to stack by
System.Runtime.GetNotifications handler. This object is treated as new
object since it was deepcopied earlier by System.Runtime.Notify handler:
b66cea5ccc/pkg/vm/stack.go (L178).

Thus, no functoinal changes from the NeoGo side. And we won't
intentionally break our node to follow C# pre-Domovoi invalid behaviour.

Close #3484, close #3482.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-06-11 17:51:41 +03:00
Anna Shaleva
55fa12355e stackitem: extend Make() with []string
Allow []string to be converted to stackitem.Item.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-06-11 17:50:53 +03:00
Anna Shaleva
b66cea5ccc
Merge pull request #3483 from nspcc-dev/bump-neofs-sdk
go.mod: update NeoFS SDK to RC12
2024-06-07 16:37:04 +03:00
Roman Khimov
e5eb20bbae go.mod: update NeoFS SDK to RC12
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-06-07 15:08:25 +03:00
Anna Shaleva
e5a6e9ca32 core: introduce D hardfork
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-06-05 19:20:04 +03:00
Anna Shaleva
cf4d4a2611
Merge pull request #3469 from nspcc-dev/warn
logs: distinguish WARN and INFO for `peer disconnected`
2024-06-05 15:39:52 +03:00
Anna Shaleva
7a7a5d0322
Merge pull request #3470 from nspcc-dev/contract-acc
wallet: do not store deployed contract script inside `Contract` account field
2024-06-05 15:35:04 +03:00
Ekaterina Pavlova
4d6333866d network: extend errInvalidInvType error
Add type to the errInvalidInvType.

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-06-05 15:32:43 +03:00
Ekaterina Pavlova
4a5e8f8592 logs: distinguish WARN and INFO for peer disconnected
Peer disconnections are not warnings in some cases.

Close #3182

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-06-05 15:32:42 +03:00
Ekaterina Pavlova
b4fdf8c3c9 wallet: do not store deployed contract script inside Contract account
`Contract` account field should not contain deployed contract script.

Close #3348

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-06-05 15:27:20 +03:00
Anna Shaleva
3c471f0b7e
Merge pull request #3455 from nspcc-dev/sast
Adjust minor SAST warnings
2024-06-05 12:21:42 +03:00
Ekaterina Pavlova
41109f442a oracle: add length check o.MainCfg.NeoFS.Nodes
Prevent the risk of a division by zero error when accessing the
`o.MainCfg.NeoFS.Nodes[index]` array.

Close #3419

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-06-05 11:53:52 +03:00
Ekaterina Pavlova
5c408f7fe4 core: adjust prevHeader nil check
prevHeader is never nil.

Refs #3419

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-06-05 11:53:52 +03:00
Anna Shaleva
cd525a1df5
Merge pull request #3468 from nspcc-dev/logs
logs: hide timestamp if the program is run not in TTY
2024-06-05 10:46:13 +03:00
Roman Khimov
836183ecb6
Merge pull request #3475 from nspcc-dev/rel-0.106.1 2024-06-03 17:15:44 +03:00
Anna Shaleva
3c1c650ddf CHANGELOG: release 0.106.1
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-06-03 16:12:36 +03:00
Anna Shaleva
45b8af359d
Merge pull request #3472 from nspcc-dev/pick-proper-exe-context
interop: use executing contract state for permissions checks
2024-06-03 16:10:39 +03:00
Anna Shaleva
4945145b09 interop: use executing contract state for permissions checks
Do not use the updated contract state from native Management to perform
permissions checks. We need to use the currently executing state
instead got from the currently executing VM context until context is
unloaded.

Close #3471.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-06-03 12:32:10 +03:00
Ekaterina Pavlova
f48e992a78 logs: hide timestamp if the program is run not in TTY
If the program is run in TTY then logger adds timestamp to its entries.

Close #3358

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-06-03 11:49:54 +03:00
Roman Khimov
0b136c1c9c
Merge pull request #3463 from nspcc-dev/fool-protection 2024-05-25 00:59:23 +03:00
Anna Shaleva
f4aeaa6387 workflows: protect go.mod from unexpected imports
Avoid situations like #3458.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-24 21:11:39 +03:00
Roman Khimov
0ae5e7ea83
Merge pull request #3458 from nspcc-dev/remove-contract-deps
go.mod: remove unused dependency
2024-05-21 21:46:15 +03:00
Anna Shaleva
228052360e go.mod: remove unused dependency
Was accidentally added in
aa5a0cb49b.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-21 20:40:38 +03:00
Roman Khimov
5cbfe215a4
Merge pull request #3453 from nspcc-dev/rel-0.106.0
CHANGELOG: release 0.106.0
2024-05-21 15:48:52 +03:00
Anna Shaleva
72161fe902 CHANGELOG: release 0.106.0
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-21 15:44:22 +03:00
Anna Shaleva
aceaabe9d6 ROADMAP: update roadmap
Reschedule deprecated functionality removal for 0.107.0 release.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-21 14:26:05 +03:00
Anna Shaleva
9ba532ce9c docs: adjust release instructions
Add a note about checking NeoFS networks for compatibility.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-21 14:26:05 +03:00
Roman Khimov
2aa3c93acd
Merge pull request #3452 from nspcc-dev/p2pnotary-role
core: move P2PNotary node role out of P2PSigExtensions
2024-05-21 13:53:52 +03:00
Anna Shaleva
aa5a0cb49b *: update interop deps
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-21 12:36:51 +03:00
Anna Shaleva
7868578571 core: move P2PNotary node role out of P2PSigExtensions
Port https://github.com/neo-project/neo/pull/3172.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-21 12:10:47 +03:00
Roman Khimov
6a5833759c
Merge pull request #3448 from nspcc-dev/migrate-to-hf
Bind 0.106.0 protocol chages to Cockatrice hardfork
2024-05-20 15:51:26 +03:00
Roman Khimov
6be757af3e
Merge pull request #3444 from nspcc-dev/fix-native-init
native: perform initialisation for the set of hardforks
2024-05-17 16:34:00 +03:00
Roman Khimov
67b6d5da31
Merge pull request #3446 from nspcc-dev/enable-cockatrice
config: enable Cockatrice hardfork
2024-05-17 16:33:16 +03:00
Anna Shaleva
b5bb605651
Merge pull request #3443 from nspcc-dev/fix-blocked-accounts
native: fix Policy's IsBlocked behaviour
2024-05-17 16:10:59 +03:00
Anna Shaleva
d91a0945df config: enable Cockatrice hardfork
Close #3434.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-17 16:01:48 +03:00
Anna Shaleva
c90f6785b9 native: perform initialisation for the set of hardforks
Close #3433.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-17 15:58:02 +03:00
Anna Shaleva
c30e7ec8d7 native: bind CryptoLib's verifyWithECDsa changes to Cockatrice
A part of #3440.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-17 15:52:00 +03:00
Anna Shaleva
ce442a1942 rpcsrv: remove test for Koblitz-based witness verification
It will be built properly in #3447.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-17 15:45:04 +03:00
Anna Shaleva
e92606a7ae native: bind Neo's CommitteeChanged event to Cockatrice
A part of #3440.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-17 15:22:29 +03:00
Anna Shaleva
df1ed68d98 native: support native method/event removal
Port a part of https://github.com/neo-project/neo/issues/3210.
A part of #3440.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-17 15:22:26 +03:00
Anna Shaleva
82a7c1bd9c native: adjust test helper behaviour
Supply the account with expected balance.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-17 12:33:59 +03:00
Anna Shaleva
c43cfae24c native: fix Policy's IsBlocked behaviour
Account is blocked when it's in the Policy's storage, not when it's
missing from the Policy storage. Introduced in
bbbc6805a8.

This bug leads to the fact that during native Neo cache initialization
at the last block in the dBFT epoch, all candidates accounts are
"blocked", and thus, stand-by committee and validators are used in the
subsequent new epoch. Close #3424.

This bug may lead to the consequences described in #3273, but it needs
to be confirmed.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-17 12:33:51 +03:00
Anna Shaleva
2d4993a837
Merge pull request #3438 from nspcc-dev/unwrap-fault-exception
unwrap: implement Exception type for better exception handling
2024-05-17 10:24:26 +03:00
Anna Shaleva
647b8c7fb1
Merge pull request #3439 from nspcc-dev/getnativecontracts
state: drop NativeContract, fix #3430
2024-05-17 10:23:45 +03:00