Commit graph

7791 commits

Author SHA1 Message Date
Roman Khimov
f21edef43b *: bump min Go to 1.21, use 1.23 by default
Fixes #3089.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-23 19:11:06 +03:00
Anna Shaleva
dc6c195637
Merge pull request #3462 from NeoGoBros/add-coverage-support
Add initial coverage support to neotest
2024-08-21 11:40:16 +03:00
Roman Khimov
dfd4566a04
Merge pull request #3556 from nspcc-dev/adjust-waiter
Make PollingBased waiter more flexible
2024-08-20 12:32:51 +03:00
Anna Shaleva
42555668da rpcclient: add Waiter.Config
Include Waiter.PollConfig into Waiter.Config and use extended Waiter
configuration where needed.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-20 10:13:20 +03:00
Anna Shaleva
92c6361be8 rpcclient: integrate customizable Waiter with Actor
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-20 10:13:20 +03:00
Anna Shaleva
afbb51e78c rpcsrv: add test for Waiter constructor
Ensure that WSClient-based Actor is able to create EventBased waiter.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-20 10:13:20 +03:00
Anna Shaleva
027d726b65 rpcclient: allow to tune PollingBased waiter
Some clients need more flexible awaiting options (e.g. for short-blocks
networks). The default behaviour is not changed, all exported APIs are
compatible. Ref. https://github.com/nspcc-dev/neofs-node/issues/2864.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-20 10:13:19 +03:00
Anna Shaleva
3e3991cef8 rpcclient: remove default PolingBased poll interval
pollTime is never 0 since MillisecondsPerBlock protocol configuration value
is present in `getversion` RPC response since 0.97.3 release. We don't have such
old RPC servers in the network anymore, thus this fallback code may be
safely removed.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-20 10:10:59 +03:00
Slava0135
d0c45477f5 neotest: implement coverage collection
Test coverage is automatically enabled when go test is running with coverage
enabled. It can be disabled for any Executor by using relevant methods.
Coverage is gathered by capturing VM OPs during test contract execution and
mapping them to the contract source code using the DebugInfo information.

Signed-off-by: Slava0135 <super.novalskiy_0135@inbox.ru>
2024-08-19 14:39:18 +03:00
Roman Khimov
7766168c19
Merge pull request #3557 from nspcc-dev/fix-lint
*: fix linter issues
2024-08-14 15:02:20 +03:00
Anna Shaleva
c06543cf50 *: fix linter issues
Linter is updated up to v1.60.1, the following issue is fixed:
```
predeclared  variable max has same name as predeclared identifier
```

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-14 12:36:15 +03:00
Roman Khimov
8ea0bc6e58
Merge pull request #3554 from nspcc-dev/add-echidna 2024-08-12 13:48:20 +03:00
Anna Shaleva
2c24cb342e core: introduce Echidna hardfork
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-12 11:10:26 +03:00
Anna Shaleva
79e78980c4
Merge pull request #3552 from nspcc-dev/fix-wsclient-limit
rpcsrv: fix failing TestWSClientsLimit
2024-08-09 16:44:27 +03:00
Anna Shaleva
b27e4f4309
Merge pull request #3540 from nspcc-dev/rpc-getversion
rpcsrv: add seedlist and standbycommittee to `getversion`
2024-08-09 15:18:12 +03:00
Anna Shaleva
9ba6db491e rpcsrv: fix failing TestWSClientsLimit
64 connections is too much for slow GA runners, we have to keep all of
them alive to avoid failures in the test, but it's impossible since
runners are too slow to iterate through all of them in time.

Close #3442.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-09 15:14:52 +03:00
Roman Khimov
f0266a9973
Merge pull request #3551 from nspcc-dev/neotest-fixes 2024-08-09 15:09:30 +03:00
Ekaterina Pavlova
9fb6d3266e rpcsrv: add seedlist and standbycommittee to getversion
Port neo-project/neo#3443.

Close #3538

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-08-09 12:53:31 +03:00
Anna Shaleva
72d1427109 neotest: calculate system fee for deployment transactions
1. Bind NewDeployTxBy to Executor to be able to use
   (*Executor).AddSystemFee.
2. Replace pre-defined constant deployment fee by calculated one.

This change is needed to be able to properly collect coverage for
_deploy method of a contract via neotest coverage. Ref.
https://github.com/nspcc-dev/neo-go/pull/3462#pullrequestreview-2229601870.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-09 11:55:22 +03:00
Anna Shaleva
5799397034 neotest: bind AddSystemFee and TestInvoke to Executor
These methods need Executor's context to properly process coverage, thus
these methods are not independent anymore. Ref.
https://github.com/nspcc-dev/neo-go/pull/3462#pullrequestreview-2219332436.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-09 11:49:31 +03:00
Roman Khimov
ffcbe6a10d
Merge pull request #3547 from nspcc-dev/docker-upd 2024-08-07 08:24:46 +03:00
Anna Shaleva
cbc2f73a0c *: migrate to Docker Compose V2
Docker Compose V1 is deprecated since June 2023, ref.
https://docs.docker.com/compose/migrate/ and
https://github.com/nspcc-dev/neo-bench/issues/166.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-06 15:51:17 +03:00
Anna Shaleva
7e8fda6b6d
Merge pull request #3541 from nspcc-dev/up-dbft
dbft: update to AMEV-enabled version
2024-08-06 15:44:56 +03:00
Roman Khimov
39e0d60221
Merge pull request #3544 from nspcc-dev/fix-permission-extension 2024-08-05 16:17:19 +03:00
Anna Shaleva
2c7430583c smartcontrct: take care of manifest permission descriptor wildcardness
Starting from b10af1ed31
(*WildPermissionDescs).Add method's call is not enough to construct a
proper restricted permission descriptor, because Wildcard field should
be set properly at the same time. Ref. #3523.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-05 16:05:59 +03:00
Anna Shaleva
c46dfee214
Merge pull request #3537 from nspcc-dev/fix-mempool-fees
Fix mempool fees
2024-08-05 15:59:11 +03:00
Roman Khimov
5d1d7b104e mempool: properly remove fees when removing tx during Add
Fixes #3488.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-05 15:36:14 +03:00
Anna Shaleva
6651b683a0
Merge pull request #3539 from nspcc-dev/netmode
netmode: add constant MainNetNeoFS and TestNetNeoFS
2024-08-05 15:30:32 +03:00
Roman Khimov
c950891298
Merge pull request #3545 from nspcc-dev/fix-cfg-doc
docs: adjust DB compatibility notes
2024-08-05 15:14:29 +03:00
Anna Shaleva
7e277fa948 docs: adjust DB compatibility notes
It's dangerous to change `Max*` ProtocolConfiguration settings:

* Changes in MaxBlockSize, MaxBlockSystemFee and MaxTransactionsPerBlock
  may lead to the fact that accepted block or transaction becomes invalid.
  I agree that these settings are not written in the DB, but at the same
  time it's not correct to compare databases that have these settings
  mismatched.
* Changes in MaxTraceableBlocks may lead to the fact that some
  transaction will be processed differently, it's a possible contract
  state mismatch.
* Changes in MaxValidUntilBlockIncrement may lead to the fact that
  `setMaxNotValidBeforeDelta` method of native Notary contract may be
  processed in a different way which is also a possible contract state
  mismatch.

Ref. 5d29a3fdab.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-08-05 12:33:11 +03:00
Roman Khimov
ee0d92c6d2 dbft: update to AMEV-enabled version
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-01 22:29:51 +03:00
Ekaterina Pavlova
ef20ba3701 netmode: add constant MainNetNeoFS and TestNetNeoFS
Extend netmode package with NeoFS chains IDs.

Close #3503

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-07-31 11:02:17 +08:00
Roman Khimov
a11e433754 mempool: move metrics out of removeInternal, simplify it
Metrics should be updated once per action, currently removeInternal is
used by Add and Remove, the first one updates them in the end anyway and
remove should do the same.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-07-30 17:43:14 +03:00
Roman Khimov
6334192a95 mempool: remove Feer from Remove()
It's not used and not needed for removal.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-07-30 17:37:18 +03:00
Roman Khimov
d8e3e57f88
Merge pull request #3536 from nspcc-dev/rel-0.106.3
CHANGELOG: release 0.106.3
2024-07-29 19:01:16 +03:00
Roman Khimov
7fe176ac27 CHANGELOG: release 0.106.3
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-07-29 18:35:16 +03:00
Roman Khimov
c2a1c4af53
Merge pull request #3535 from nspcc-dev/fix/possible-WS-deadlock-on-connection-loss 2024-07-29 17:56:39 +03:00
Pavel Karpy
9fadfef0d7 rpcclient/WS: do not deadlock on connection loss
`makeWsRequest` creates a channel for response and waits for it. If between
creating the channel and starting the reading `select` connection is lost
(`writerDone` channel is closed), nothing reads from the channel and a
deadlock appears. Looking at "done" channels when transferring RPC data
solves the issue. Closes #3530.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2024-07-29 17:39:11 +03:00
Roman Khimov
8d4e8b6047
Merge pull request #3527 from nspcc-dev/dump-fixes
Dump help/error fixes
2024-07-29 15:08:07 +03:00
Roman Khimov
07da75c254
Merge pull request #3526 from nspcc-dev/improve-doc 2024-07-29 15:07:54 +03:00
Roman Khimov
54fd70fc32
Merge pull request #3523 from nspcc-dev/fix-null-handling-in-manifest
Fix null handling in manifest
2024-07-29 13:11:20 +03:00
Roman Khimov
5d29a3fdab docs: document DB incompatibilities, fix #3456
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-07-29 13:09:16 +03:00
Roman Khimov
8bc06eceb8
Merge pull request #3534 from nspcc-dev/fix-missing-block-field
Fix missing block field
2024-07-29 10:08:11 +03:00
Roman Khimov
19aad75242 *: update interops
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-07-27 12:56:56 +03:00
Roman Khimov
1a48f1ce43 block: add PrimaryIndex to the stack item of block
This is a bad one.

$ ./bin/neo-go contract testinvokefunction -r https://rpc10.n3.nspcc.ru:10331 0xda65b600f7124ce6c79950c1772a36403104f2be getBlock 5762000
{
  "state": "HALT",
  "gasconsumed": "202812",
  "script": "AtDrVwARwB8MCGdldEJsb2NrDBS+8gQxQDYqd8FQmcfmTBL3ALZl2kFifVtS",
  "stack": [
    {
      "type": "Array",
      "value": [
        {
          "type": "ByteString",
          "value": "vq5IPTPEDRhz0JA4cQKIa6/o97pnJt/HfVkDRknd1rg="
        },
        {
          "type": "Integer",
          "value": "0"
        },
        {
          "type": "ByteString",
          "value": "zFYF3LGaTKdbqVX99shaBUzTq9YjXb0jaPMjk2jdSP4="
        },
        {
          "type": "ByteString",
          "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
        },
        {
          "type": "Integer",
          "value": "1722060076994"
        },
        {
          "type": "Integer",
          "value": "5293295626238767595"
        },
        {
          "type": "Integer",
          "value": "5762000"
        },
        {
          "type": "ByteString",
          "value": "LIt05Fpxhl/kXMX3EAGIASyOSQs="
        },
        {
          "type": "Integer",
          "value": "0"
        }
      ]
    }
  ],
  "exception": null,
  "notifications": []
}

$ ./bin/neo-go contract testinvokefunction -r http://seed3.neo.org:10332 0xda65b600f7124ce6c79950c1772a36403104f2be getBlock 5762000
{
  "state": "HALT",
  "gasconsumed": "202812",
  "script": "AtDrVwARwB8MCGdldEJsb2NrDBS+8gQxQDYqd8FQmcfmTBL3ALZl2kFifVtS",
  "stack": [
    {
      "type": "Array",
      "value": [
        {
          "type": "ByteString",
          "value": "vq5IPTPEDRhz0JA4cQKIa6/o97pnJt/HfVkDRknd1rg="
        },
        {
          "type": "Integer",
          "value": "0"
        },
        {
          "type": "ByteString",
          "value": "zFYF3LGaTKdbqVX99shaBUzTq9YjXb0jaPMjk2jdSP4="
        },
        {
          "type": "ByteString",
          "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
        },
        {
          "type": "Integer",
          "value": "1722060076994"
        },
        {
          "type": "Integer",
          "value": "5293295626238767595"
        },
        {
          "type": "Integer",
          "value": "5762000"
        },
        {
          "type": "Integer",
          "value": "6"
        },
        {
          "type": "ByteString",
          "value": "LIt05Fpxhl/kXMX3EAGIASyOSQs="
        },
        {
          "type": "Integer",
          "value": "0"
        }
      ]
    }
  ],
  "exception": null,
  "notifications": []
}

9 fields vs 10, notice the primary index right after the block number.

Back when ac527650eb initially added Ledger I've
used https://github.com/neo-project/neo/pull/2215 as a reference and it was
correct (no primary index). But then https://github.com/neo-project/neo/pull/2296
came into the C# codebase and while it looked like a pure refactoring it
actually did add the primary index as well and this wasn't noticed. It wasn't
noticed even when 3a4e0caeb8 had touched some
nearby code. In short, we had a completely wrong implementation of this call
for more than three years. But looks like it's not a very popular one.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-07-27 12:35:19 +03:00
Roman Khimov
c6ed92a169
Merge pull request #3532 from nspcc-dev/fix/ws-client-subscription-panic
rpcclient/WS: fix data race on concurrent (un)subscription
2024-07-26 19:29:38 +03:00
Pavel Karpy
d6eaf6efc2 rpcclient/WS: fix data race on concurrent (un)subscription
Every client's (Un)Subscription call does two things: an RPC call and a
subscription map lock (two of maps currently). If we imagine that there is
one routine that tries to subscribe (A) and one routine that tries to
unsubscribe (B), the following sequence can happen:

0. Current number of subscriptions is X
1. B does an RPC and makes number of subscriptions X-1
2. A does an RPC and makes number of subscriptions X again
3. A holds subscription locks and rewrites client's subscription state
   (subscription with ID X now points to a different channel; channel that
   was registered by B is lost and is not related to any real subscription
   but is still included in the `receivers` map)
4. B holds subscription locks and drops subscription X (first, it is an
   error and we have just lost a subscription that we think was made
   successfully second, we have lost a channel in the `receivers` map, and
   no corresponding subscription points to it)
5. X subscription is received by the WS client (in practice it is a new
   block, 100ms, quite often to be sure this issue happens every hour), we
   range through the receivers, see no corresponding subscription, and
   panic.

Closes #3093.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2024-07-26 18:19:50 +03:00
Roman Khimov
4fe9597dd5
Merge pull request #3529 from nspcc-dev/fix-sessionexpiration-default 2024-07-26 17:24:14 +03:00
Roman Khimov
f4b61b5a77 rpcsrv: set minimal default SessionExpirationTime to 5s, fix #3509
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-07-26 17:17:37 +03:00
Roman Khimov
e5dd2b2ad6 cli: extend error message for restore failure, fix #3499
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-07-26 17:07:27 +03:00