Anna Shaleva
ef114d6274
rpc: fail invoke.Result unmarshalling on stack unmarshalling error
2022-07-08 17:05:18 +03:00
Anna Shaleva
445cca114a
rpc: restrict the amount of concurrently running iterator sessions
2022-07-08 17:05:18 +03:00
Anna Shaleva
8f73ce08c8
rpc: move session maintenance related code out of the result.Invoke
...
It's server who should be responsible for iterator ID creation and
iterator registration.
2022-07-08 17:05:18 +03:00
Anna Shaleva
4581cc386b
rpc: restrict max number of iterator items for createIteratorUnwrapperScript
2022-07-08 17:05:18 +03:00
Anna Shaleva
9bdd8151af
rpc: restrict (*Client).TraverseIterator with single RPC call
...
Do not unwrap the whole set of iterator values even on demand.
2022-07-08 17:05:18 +03:00
Anna Shaleva
fad061f3d9
rpc: extend iterator-related client functionality
...
Create a set of functions that are able to work with both session-based
iterators, default unpacked iterators and client-side unpacked
iterators.
2022-07-08 17:05:18 +03:00
Anna Shaleva
47ffc1f3e8
rpc: restrict default SessionExpirationTime
2022-07-08 17:05:18 +03:00
Anna Shaleva
b5d39a3ffd
rpc: add configuration extension for MPT-backed iterator sessions
...
Add ability to switch between current blockchain storage and MPT-backed
storage for iterator traversing process. It may be useful because
iterator implementation traverses underlying backed storage (BoltDB,
LevelDB) inside DB's Seek which is blocking operation for BoltDB:
```
Opening a read transaction and a write transaction in the same goroutine
can cause the writer to deadlock because the database periodically needs
to re-mmap itself as it grows and it cannot do that while a read transaction
is open.
If a long running read transaction (for example, a snapshot transaction)
is needed, you might want to set DB.InitialMmapSize to a large enough
value to avoid potential blocking of write transaction.
```
So during bbolt re-mmaping, standard blockchain DB operations (i.e. persist)
can be blocked until iterator resourses release. The described behaviour
is tested and confirmed on four-nodes privnet with BoltDB and
`SessionExpirationTime` set to be 180 seconds. After new iterator session
is added to the server, the subsequent persist took ~5m21s, see the log
record `2022-06-17T18:58:21.563+0300`:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ ./bin/neo-go node -p
2022-06-17T18:52:21.535+0300 INFO initial gas supply is not set or wrong, setting default value {"InitialGASSupply": "52000000"}
2022-06-17T18:52:21.535+0300 INFO MaxBlockSize is not set or wrong, setting default value {"MaxBlockSize": 262144}
2022-06-17T18:52:21.535+0300 INFO MaxBlockSystemFee is not set or wrong, setting default value {"MaxBlockSystemFee": 900000000000}
2022-06-17T18:52:21.535+0300 INFO MaxTransactionsPerBlock is not set or wrong, using default value {"MaxTransactionsPerBlock": 512}
2022-06-17T18:52:21.535+0300 INFO MaxValidUntilBlockIncrement is not set or wrong, using default value {"MaxValidUntilBlockIncrement": 5760}
2022-06-17T18:52:21.535+0300 INFO Hardforks are not set, using default value
2022-06-17T18:52:21.543+0300 INFO no storage version found! creating genesis block
2022-06-17T18:52:21.546+0300 INFO ExtensiblePoolSize is not set or wrong, using default value {"ExtensiblePoolSize": 20}
2022-06-17T18:52:21.546+0300 INFO service is running {"service": "Prometheus", "endpoint": ":2112"}
2022-06-17T18:52:21.547+0300 INFO starting rpc-server {"endpoint": ":20331"}
2022-06-17T18:52:21.547+0300 INFO rpc-server iterator sessions are enabled
2022-06-17T18:52:21.547+0300 INFO service hasn't started since it's disabled {"service": "Pprof"}
2022-06-17T18:52:21.547+0300 INFO node started {"blockHeight": 0, "headerHeight": 0}
_ ____________ __________
/ | / / ____/ __ \ / ____/ __ \
/ |/ / __/ / / / /_____/ / __/ / / /
/ /| / /___/ /_/ /_____/ /_/ / /_/ /
/_/ |_/_____/\____/ \____/\____/
/NEO-GO:0.99.1-pre-53-g7ccb646e/
2022-06-17T18:52:21.548+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 1}
2022-06-17T18:52:21.550+0300 INFO started protocol {"addr": "127.0.0.1:20336", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 1475228436}
2022-06-17T18:52:22.575+0300 INFO persisted to disk {"blocks": 65, "keys": 1410, "headerHeight": 65, "blockHeight": 65, "took": "28.193409ms"}
2022-06-17T18:52:24.548+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 2}
2022-06-17T18:52:24.548+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 3}
2022-06-17T18:52:24.548+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 4}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 5}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 6}
2022-06-17T18:52:24.549+0300 INFO started protocol {"addr": "127.0.0.1:20333", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 3444438498}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 7}
2022-06-17T18:52:24.549+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 8}
2022-06-17T18:52:24.550+0300 INFO node reached synchronized state, starting services
2022-06-17T18:52:24.550+0300 INFO started protocol {"addr": "127.0.0.1:20334", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 2435677826}
2022-06-17T18:52:24.550+0300 INFO starting state validation service
2022-06-17T18:52:24.550+0300 INFO RPC server already started
2022-06-17T18:52:24.550+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 9}
2022-06-17T18:52:24.550+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 10}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 9}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 8}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 7}
2022-06-17T18:52:24.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 6}
2022-06-17T18:52:24.550+0300 INFO started protocol {"addr": "127.0.0.1:20335", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 65, "id": 970555896}
2022-06-17T18:52:24.551+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 7}
2022-06-17T18:52:24.551+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 6}
2022-06-17T18:52:24.551+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 5}
2022-06-17T18:52:24.551+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 4}
2022-06-17T18:52:29.564+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 66, "blockHeight": 66, "took": "12.51808ms"}
2022-06-17T18:52:44.558+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 67, "blockHeight": 67, "took": "1.563137ms"}
2022-06-17T18:55:21.549+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "ping/pong timeout", "peerCount": 3}
2022-06-17T18:55:21.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "ping/pong timeout", "peerCount": 2}
2022-06-17T18:55:21.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "ping/pong timeout", "peerCount": 1}
2022-06-17T18:55:21.550+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "ping/pong timeout", "peerCount": 0}
2022-06-17T18:55:21.553+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 1}
2022-06-17T18:55:21.554+0300 INFO started protocol {"addr": "127.0.0.1:20335", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 77, "id": 970555896}
2022-06-17T18:55:24.554+0300 INFO new peer connected {"addr": "172.200.0.4:20333", "peerCount": 2}
2022-06-17T18:55:24.555+0300 INFO new peer connected {"addr": "172.200.0.3:20334", "peerCount": 3}
2022-06-17T18:55:24.555+0300 INFO new peer connected {"addr": "10.78.13.84:59876", "peerCount": 4}
2022-06-17T18:55:24.555+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 5}
2022-06-17T18:55:24.556+0300 INFO new peer connected {"addr": "172.200.0.254:20332", "peerCount": 6}
2022-06-17T18:55:24.556+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 7}
2022-06-17T18:55:24.556+0300 INFO started protocol {"addr": "172.200.0.4:20333", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 76, "id": 3444438498}
2022-06-17T18:55:24.556+0300 INFO new peer connected {"addr": "172.200.0.1:20335", "peerCount": 8}
2022-06-17T18:55:24.558+0300 INFO started protocol {"addr": "127.0.0.1:20336", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 77, "id": 1475228436}
2022-06-17T18:55:24.559+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 9}
2022-06-17T18:55:24.558+0300 INFO started protocol {"addr": "172.200.0.3:20334", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 77, "id": 2435677826}
2022-06-17T18:55:24.559+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 10}
2022-06-17T18:55:24.559+0300 WARN peer disconnected {"addr": "172.200.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:55:24.559+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 10}
2022-06-17T18:55:24.560+0300 INFO new peer connected {"addr": "172.200.0.2:20336", "peerCount": 11}
2022-06-17T18:55:24.560+0300 WARN peer disconnected {"addr": "172.200.0.254:20332", "error": "identical node id", "peerCount": 10}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "already connected", "peerCount": 9}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 10}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "10.78.13.84:59876", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "unexpected empty payload: CMDVersion", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "unexpected empty payload: CMDVersion", "peerCount": 8}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "172.200.0.2:20336", "error": "unexpected empty payload: CMDVersion", "peerCount": 7}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 9}
2022-06-17T18:55:24.561+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 8}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 9}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 10}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 11}
2022-06-17T18:55:24.561+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 12}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "already connected", "peerCount": 11}
2022-06-17T18:55:24.562+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 12}
2022-06-17T18:55:24.562+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 13}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 12}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 11}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 10}
2022-06-17T18:55:24.562+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:55:24.563+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 10}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 9}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "unexpected empty payload: CMDVersion", "peerCount": 8}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 7}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "max peers reached", "peerCount": 6}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 5}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "max peers reached", "peerCount": 4}
2022-06-17T18:55:24.563+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 3}
2022-06-17T18:57:21.551+0300 WARN peer disconnected {"addr": "172.200.0.4:20333", "error": "ping/pong timeout", "peerCount": 2}
2022-06-17T18:57:21.552+0300 WARN peer disconnected {"addr": "172.200.0.3:20334", "error": "ping/pong timeout", "peerCount": 1}
2022-06-17T18:57:21.552+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "ping/pong timeout", "peerCount": 0}
2022-06-17T18:57:21.553+0300 INFO new peer connected {"addr": "172.200.0.4:20333", "peerCount": 1}
2022-06-17T18:57:21.554+0300 INFO new peer connected {"addr": "10.78.13.84:20332", "peerCount": 2}
2022-06-17T18:57:21.555+0300 INFO started protocol {"addr": "172.200.0.4:20333", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 3444438498}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 3}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "10.78.13.84:46076", "peerCount": 4}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "172.200.0.1:20335", "peerCount": 5}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "172.200.0.254:20332", "peerCount": 6}
2022-06-17T18:57:21.556+0300 INFO new peer connected {"addr": "10.78.13.84:59972", "peerCount": 7}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 8}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 9}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "172.200.0.2:20336", "peerCount": 10}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 11}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 12}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "172.200.0.3:20334", "peerCount": 13}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 14}
2022-06-17T18:57:21.557+0300 INFO started protocol {"addr": "127.0.0.1:20334", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 2435677826}
2022-06-17T18:57:21.557+0300 WARN peer disconnected {"addr": "172.200.0.2:20336", "error": "max peers reached", "peerCount": 13}
2022-06-17T18:57:21.557+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 14}
2022-06-17T18:57:21.558+0300 INFO started protocol {"addr": "172.200.0.1:20335", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 970555896}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "172.200.0.254:20332", "error": "identical node id", "peerCount": 13}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20334", "peerCount": 14}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "max peers reached", "peerCount": 13}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "10.78.13.84:46076", "error": "identical node id", "peerCount": 12}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20333", "peerCount": 13}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20335", "peerCount": 14}
2022-06-17T18:57:21.558+0300 INFO new peer connected {"addr": "127.0.0.1:20336", "peerCount": 15}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "10.78.13.84:59972", "error": "identical node id", "peerCount": 14}
2022-06-17T18:57:21.558+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 13}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "10.78.13.84:20332", "error": "unexpected empty payload: CMDVersion", "peerCount": 12}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 11}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "172.200.0.3:20334", "error": "unexpected empty payload: CMDVersion", "peerCount": 10}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "unexpected empty payload: CMDVersion", "peerCount": 9}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20334", "error": "already connected", "peerCount": 8}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "unexpected empty payload: CMDVersion", "peerCount": 7}
2022-06-17T18:57:21.559+0300 INFO started protocol {"addr": "127.0.0.1:20336", "userAgent": "/NEO-GO:0.99.1-pre-53-g7ccb646e/", "startHeight": 82, "id": 1475228436}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20333", "error": "already connected", "peerCount": 6}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20335", "error": "already connected", "peerCount": 5}
2022-06-17T18:57:21.559+0300 WARN peer disconnected {"addr": "127.0.0.1:20336", "error": "already connected", "peerCount": 4}
2022-06-17T18:58:21.561+0300 INFO persisted to disk {"blocks": 1, "keys": 20, "headerHeight": 68, "blockHeight": 68, "took": "5m21.993873018s"}
2022-06-17T18:58:21.563+0300 INFO persisted to disk {"blocks": 8, "keys": 111, "headerHeight": 76, "blockHeight": 76, "took": "2.243347ms"}
2022-06-17T18:58:22.567+0300 INFO persisted to disk {"blocks": 10, "keys": 135, "headerHeight": 86, "blockHeight": 86, "took": "5.637669ms"}
2022-06-17T18:58:25.565+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 87, "blockHeight": 87, "took": "1.879912ms"}
2022-06-17T18:58:40.572+0300 INFO persisted to disk {"blocks": 1, "keys": 20, "headerHeight": 88, "blockHeight": 88, "took": "1.560317ms"}
2022-06-17T18:58:55.579+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 89, "blockHeight": 89, "took": "1.925225ms"}
2022-06-17T18:59:10.587+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 90, "blockHeight": 90, "took": "3.118073ms"}
2022-06-17T18:59:25.592+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 91, "blockHeight": 91, "took": "1.607248ms"}
2022-06-17T18:59:40.600+0300 INFO persisted to disk {"blocks": 1, "keys": 20, "headerHeight": 92, "blockHeight": 92, "took": "931.806µs"}
2022-06-17T18:59:55.610+0300 INFO persisted to disk {"blocks": 1, "keys": 19, "headerHeight": 93, "blockHeight": 93, "took": "2.019041ms"}
```
2022-07-08 17:05:18 +03:00
Anna Shaleva
cbd20eb959
rpc: implement iterator sessions
2022-07-08 17:05:18 +03:00
Roman Khimov
251c9bd89b
block: push PrevStateRoot data into stack item, fix #2551
...
And add compiler/interop support for this.
2022-07-07 15:10:29 +03:00
Roman Khimov
6deb77a77a
compiler: make interface{}() conversions possible
2022-07-07 15:10:29 +03:00
Roman Khimov
ec3d1fae59
compiler: allow to find appropriate methods via selectors
...
c.funcs contains function names using base types, while methods can be defined
on pointers and the value returned from c.getFuncNameFromSelector will have an
asterisk. We can't have the same name used for (*T) and (T) methods, so just
stripping the asterisk allows to get the right one.
2022-07-07 15:10:29 +03:00
Roman Khimov
b57dd2cad6
compiler: properly inline methods, use receiver
...
Notice that this doesn't differentiate between (*T) and (T) receivers always
treating them as is. But we have the same problem with arguments now and the
number of inlined calls is limited, usually we want this behavior.
2022-07-07 15:10:29 +03:00
Roman Khimov
6014dd720f
compiler: don't push X onto the stack for inlined method calls
...
Regular methods need this, because it'll be packed into parameters, but
inlined ones should deal with it in inlining code itself because method
receiver will be some local (aliased) variable anyway.
2022-07-06 18:18:21 +03:00
Roman Khimov
2ba9017207
Merge pull request #2581 from nspcc-dev/sym-dec-in-getnep17balances
...
rpc: add decimals/name/symbol data to getNEPXXBalance
2022-07-05 12:45:50 +03:00
Roman Khimov
ccc820505d
Merge pull request #2554 from nspcc-dev/improve-ws-err
...
rpc: adjust cases when WS connection close error is returned
2022-07-05 12:45:31 +03:00
Roman Khimov
3fbc1331aa
Merge pull request #2582 from nspcc-dev/fix-server-sync
...
network: adjust the way (*Server).IsInSync() works
2022-07-05 12:28:20 +03:00
Roman Khimov
9f05009d1a
Merge pull request #2580 from nspcc-dev/service-review
...
Service review
2022-07-05 12:23:25 +03:00
Anna Shaleva
0835581fa9
network: adjust the way (*Server).IsInSync() works
...
Always return true if sync was reached once. Fix #2564 .
2022-07-05 12:20:31 +03:00
Anna Shaleva
8f53c7d78a
rpc: adjust cases when WS connection close error is returned
...
Do not return error in case of (*WSClient).Close() method was the
initiator of connection closing.
2022-07-05 11:23:29 +03:00
Roman Khimov
3e2eda6752
*: add some comments to service Start/Shutdown methods
2022-07-04 23:03:50 +03:00
Roman Khimov
593f4e8734
Merge pull request #2559 from nspcc-dev/cli/wallet-config
...
cli: allow to specify wallet via configuration file
2022-07-04 19:24:23 +03:00
Anna Shaleva
5f36a7ca0f
*: do not call wallet.Close() explicitly
...
NewWallet and NewWalletFromFile close underlying io.Closer by itself,
no need to close it manually. Introduced in #2184 .
2022-07-04 19:09:48 +03:00
Roman Khimov
c356c14741
rpc: add decimals/name/symbol data to getNEPXXBalance
...
See neo-project/neo-modules#738 and neo-project/neo-modules#741 .
2022-07-04 18:28:27 +03:00
Roman Khimov
926b082d39
Merge pull request #2538 from nspcc-dev/restrict-out-of-bounds
...
core: check methods offsets while contract deploying
2022-07-04 12:54:32 +03:00
Roman Khimov
4afdb9fd89
Merge pull request #2578 from nspcc-dev/getcandidates
...
GetCandidates
2022-07-04 11:13:57 +03:00
Roman Khimov
36d4c17a15
stateroot: wait for the service to stop un Shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
58b9ac41e2
stateroot: handle double start/shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
bf462a81fe
notary: wait for the service to finish on Shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
0d627c947f
notary: control start/stop state
...
Don't start/stop twice, don't do anything in callbacks if not started.
2022-07-04 11:12:17 +03:00
Roman Khimov
73e34514a5
oracle: wait for the service to stop during Shutdown
2022-07-04 11:12:17 +03:00
Roman Khimov
cab633ffed
oracle: make double-Shutdown a no-op
2022-07-04 11:12:17 +03:00
Roman Khimov
6b2fc5e056
rpc/client: add Close method
...
Allow to close unused network connections and use it during RPC broadcaster
shutdown, because otherwise we leak them.
2022-07-04 11:12:17 +03:00
Roman Khimov
649fe58550
rpcbroadcaster: properly stop broadcaster
...
Drain channels, wait for everything to stop.
2022-07-04 11:12:17 +03:00
Roman Khimov
c096f32a32
rpc/server: make double Shutdown a no-op
2022-07-01 22:01:04 +03:00
Roman Khimov
527505ea5e
consensus: drain messages and transactions on exit as well
...
There might be some threads blocked on these channels.
2022-07-01 21:55:41 +03:00
Roman Khimov
cd4f46247d
consensus: make double-call to Shutdown a no-op
2022-07-01 21:49:40 +03:00
Roman Khimov
039fcdab5a
rpc: implement getcandidates call, fix #2571
2022-07-01 18:46:44 +03:00
Roman Khimov
0da0bb21ee
rpc: make getnextvalidators behavior compliant with C# node
...
Turns out, our getnextvalidators implementation already works the way
getcandidates is supposed to work, but original getnextvalidators works a bit
differently. It only returns validators, it doesn't return Active flag (all
of them are active) and it represents votes as a number. So for the maximum
compatibility:
* drop non-validator keys from getnextvalidators server-side
* drop Active flag client-side (sorry, it doesn't exist)
* allow unmarshalling old answers along with the new one
This technically breaks `query candidates` CLI command, but it'll be fixed
when getcandidates are to be introduced.
2022-07-01 14:52:02 +03:00
Roman Khimov
c26a962b55
*: use localhost address instead of 127.0.0.1, fix #2575
2022-06-30 16:19:07 +03:00
Anna Shaleva
8ab422da66
*: properly unsubscribe from Blockchain events
2022-06-28 19:09:25 +03:00
Roman Khimov
a748298564
Merge pull request #2567 from nspcc-dev/check-consensus-start
...
consensus: check whether server is started before transaction handling
2022-06-28 18:48:22 +03:00
Anna Shaleva
de203b5c76
consensus: check whether server is started before transaction handling
...
consensus.OnTransaction is a callback, so it can be called at any time.
We need to check whether service (and dBFT) is started before the
subsequent transaction handling like it is done inside the OnPayload
callback.
2022-06-28 18:42:12 +03:00
Roman Khimov
ea69b72cd8
Merge pull request #2560 from nspcc-dev/rpc/extend-logging
...
rpc: extend error log message for failed RPC requests
2022-06-27 09:42:54 +03:00
Roman Khimov
299d55e539
Merge pull request #2558 from nspcc-dev/rpc/fix-signature-decoding
...
rpc: fix compatibility issues of `CreateFunctionInvocationScript`
2022-06-27 08:18:36 +03:00
Anna Shaleva
9488756437
rpc: extend error log message for failed RPC requests
...
Message is always non-empty; Data is allowed to be empty.
2022-06-24 12:44:10 +03:00
Anna Shaleva
a15e52ee3d
rpc: adjust TestInvocationScriptCreationGood testcase
...
Although neo-go can handle both ByteArray and ByteString parameter
types, C# node can't, so let's use the common one for tests. Compat
test:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "ByteString", "value": "AwEtR+diEK7HO+Oas9GG4KQP6Nhr+j1Pq/2le6E7iPlq"}] ]}' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1271 0 1070 100 201 2860 537 --:--:-- --:--:-- --:--:-- 3398
{
"jsonrpc" : "2.0",
"id" : 1,
"error" : {
"message" : "Requested value 'ByteString' was not found.",
"data" : " at System.Enum.TryParseByName(RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt64& result)\n at System.Enum.TryParseUInt32Enum(RuntimeType enumType, ReadOnlySpan`1 value, UInt32 maxInclusive, Boolean ignoreCase, Boolean throwOnFailure, TypeCode type, UInt32& result)\n at System.Enum.TryParse[TEnum](ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, TEnum& result)\n at System.Enum.TryParse[TEnum](String value, Boolean ignoreCase, Boolean throwOnFailure, TEnum& result)\n at Neo.SmartContract.ContractParameter.FromJson(JObject json)\n at Neo.Plugins.RpcServer.<>c.<InvokeFunction>b__43_0(JObject p)\n at System.Linq.Enumerable.SelectIListIterator`2.ToArray()\n at Neo.Plugins.RpcServer.InvokeFunction(JArray _params)\n at Neo.Plugins.RpcServer.ProcessRequestAsync(HttpContext context, JObject request)",
"code" : -2147024809
}
}
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "ByteArray", "value": "AwEtR+diEK7HO+Oas9GG4KQP6Nhr+j1Pq/2le6E7iPlq"}] ]}' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 507 0 307 100 200 161 105 0:00:01 0:00:01 --:--:-- 266
{
"result" : {
"gasconsumed" : "104526",
"notifications" : [],
"stack" : [],
"script" : "DCEDAS1H52IQrsc745qz0YbgpA/o2Gv6PU+r/aV7oTuI+WoRwB8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=",
"state" : "FAULT",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f"
},
"id" : 1,
"jsonrpc" : "2.0"
}
```
2022-06-24 12:37:25 +03:00
Anna Shaleva
aa3a5fc492
rpc: adjust script creation with empty parameters list
...
Always use NEWARRAY0 where possible, see
26d04a642a/src/neo/VM/Helper.cs (L41)
.
Compatibility is tested:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [] ]}' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 370 0 248 100 122 127 62 0:00:01 0:00:01 --:--:-- 190
{
"result" : {
"notifications" : [],
"stack" : [],
"script" : "wh8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=",
"gasconsumed" : "98403",
"state" : "FAULT",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f"
},
"jsonrpc" : "2.0",
"id" : 1
}
```
2022-06-24 12:37:22 +03:00
Anna Shaleva
171af36ead
rpc: fix Signature parameter unmarshalling
...
It is based64 encoded and decoded, see
5108d1c2c7/pkg/smartcontract/parameter.go (L78)
and
26d04a642a/src/neo/SmartContract/ContractParameter.cs (L150)
and
26d04a642a/src/neo/SmartContract/ContractParameter.cs (L79)
.
Also, TestInvocationScriptCreationGood is extended and compatibility
is tested with the following C# node requests:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "Signature", "value": "4edf5005771de04619235d5a4c7a9a11bb78e008541f1da7725f654c33380a3c87e2959a025da706d7255cb3a3fa07ebe9c6559d0d9e6213c68049168eb1056f"}]] }' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 665 0 381 100 284 197 147 0:00:01 0:00:01 --:--:-- 344
{
"jsonrpc" : "2.0",
"id" : 1,
"result" : {
"notifications" : [],
"stack" : [],
"script" : "DGDh51/nTTnvvV17TjrX3bfl3lrhztr1rXVtvvx7TTznjV/V1rvvbl/rnhzfffzRrdzzt7b3n1rTbl1rvTp3vbnlxvdrd9rTt5t71zrnn13R317rbXdzrzTj3Xrx5vXTnp8RwB8MAWEMFG9FkWLO6ySLBx7BV9nk9v0m/b5QQWJ9W1I=",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f",
"state" : "FAULT",
"gasconsumed" : "104526"
}
}
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "invokefunction", "params": ["50befd26fdf6e4d957c11e078b24ebce6291456f", "a", [{"type": "Signature", "value": "Tt9QBXcd4EYZI11aTHqaEbt44AhUHx2ncl9lTDM4CjyH4pWaAl2nBtclXLOj+gfr6cZVnQ2eYhPGgEkWjrEFbw=="}]] }' seed1.neo.org:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 591 0 347 100 244 794 558 --:--:-- --:--:-- --:--:-- 1352
{
"jsonrpc" : "2.0",
"result" : {
"state" : "FAULT",
"exception" : "Called Contract Does Not Exist: 0x50befd26fdf6e4d957c11e078b24ebce6291456f",
"gasconsumed" : "104526",
"notifications" : [],
"stack" : [],
"script" : "DEBO31AFdx3gRhkjXVpMepoRu3jgCFQfHadyX2VMMzgKPIfilZoCXacG1yVcs6P6B+vpxlWdDZ5iE8aASRaOsQVvEcAfDAFhDBRvRZFizuskiwcewVfZ5Pb9Jv2+UEFifVtS"
},
"id" : 1
}
```
2022-06-22 16:05:14 +03:00
Anna Shaleva
464061c7c1
rpc: refactor TestInvocationScriptCreationGood
...
Convert expected script from hex to base64 in order to match
`invokefunction` RPC response script encoding. No functional
changes.
2022-06-22 16:05:14 +03:00
Anna Shaleva
7c48edaccb
core, rpc: fix height-related issue of historic call functionality
...
Specifying a certain stateroot R as `invoke*historic` RPC-call
parameter, we're willing to perform historic call based on the storage
state of root R. Thus, next block should be of the height h(R)+1. This
allows to use historic functionality for the current blockchain height.
2022-06-20 19:05:22 +03:00
Roman Khimov
5108d1c2c7
Merge pull request #2539 from nspcc-dev/rollback-methods-sorting
...
core: sort native methods in ASCII-compatible way
2022-06-14 22:09:23 +03:00
Roman Khimov
6e475856aa
Merge pull request #2544 from nspcc-dev/rpc/remove-cause
...
rpc: remove Cause field from RPC error
2022-06-10 19:12:13 +03:00
Anna Shaleva
ea6ddbee5b
rpc: get rid of erverError type
...
Retrieve error's HTTP code in a separate method.
2022-06-10 16:47:57 +03:00
Anna Shaleva
6434404081
rpc: extend the list of predefined RPC errors
...
Add a few the most common ones.
2022-06-10 16:47:42 +03:00
Anna Shaleva
ef9eca7cce
rpc: unexport ServerError
...
It's internal server thing that is not for the outside users.
2022-06-10 16:38:41 +03:00
Anna Shaleva
0687924e87
rpc: split response.Error into server/client side
2022-06-10 16:35:51 +03:00
Anna Shaleva
5803923f68
rpc: remove Cause field from RPC error
...
We can use Data field for the same purposes.
2022-06-10 16:35:48 +03:00
Roman Khimov
7b88aedb27
transaction: add fuzz-test, refs. #2374
2022-06-09 13:43:22 +03:00
Roman Khimov
9919fd2cc9
Merge pull request #2548 from nspcc-dev/shuffle-tests
...
Shuffle tests and some other code
2022-06-09 12:28:03 +03:00
Evgeniy Stratonikov
0431e26659
wallet: export SavePretty
method
...
Client code can make use of it, see nspcc-dev/neofs-node#1498 .
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-06-09 09:47:18 +03:00
Roman Khimov
1b7c8f262b
core: add some comment for TestDesignate_DesignateAsRole
...
Closes #1472 at last.
2022-06-08 23:11:14 +03:00
Roman Khimov
ef50518b83
core: move notary tests into the notary package
2022-06-08 23:07:28 +03:00
Roman Khimov
5d573895ad
core: move oracle tests into oracle service
2022-06-08 23:04:47 +03:00
Roman Khimov
017cd558cb
core: move statesync tests into the statesync package
2022-06-08 22:57:48 +03:00
Roman Khimov
ff75e67610
core: move stateroot tests into services/stateroot
...
They test both module and service which is a bit wrong, but separating these
tests will lead to some duplication, so it's OK for now to have them in the
higher-order package (service imports module).
2022-06-08 22:53:09 +03:00
Roman Khimov
167bb72424
core: move Policy contract tests to native
2022-06-08 22:44:25 +03:00
Roman Khimov
a1eccc16e6
core: move benchmarks into bench_test.go
...
They share some functions and they're benchmarks, so let's have them here.
2022-06-08 22:39:57 +03:00
Roman Khimov
2e2d886a2f
core: move Management contract test into native
2022-06-08 22:34:09 +03:00
Roman Khimov
8057c096c6
core: move native invocation tests into native
2022-06-08 22:26:24 +03:00
Roman Khimov
2086bca303
core: move storage-related interop code into the storage package
2022-06-08 22:26:24 +03:00
Roman Khimov
f0d7a1da2a
core: move contract-related tests to the contract package
2022-06-08 19:01:34 +03:00
Roman Khimov
e7e80fda64
core: move TestNativeGetMethod to the native package
2022-06-08 18:51:27 +03:00
Roman Khimov
2127cc4146
core: move Runtime tests to runtime package
2022-06-08 18:46:49 +03:00
Roman Khimov
0055b18a8a
core: export CreateGenesisBlock
...
Nothing bad with it being public.
2022-06-08 18:20:34 +03:00
Roman Khimov
d70caf1da1
core: move GetScriptContainer to runtime
...
It also brings ToStackItem to Block and Transaction, previously this was
avoided to separate block and transaction packages from VM. But turns out
`transaction` depends on `stackitem` already, so this makes little sense (but
can be shuffled in another way if needed).
Context.Container is still a hash.Hashable because we have a number of
occasions (header or MPT root verification) where there is no ToStackItem
implementation possible. Maybe they can go with `nil` Container, but I don't
want to have this risk for now.
2022-06-08 18:12:41 +03:00
Roman Khimov
cdb55740ea
core: move ContractCreate*Account tests into the contract pkg
...
No functional changes.
2022-06-08 16:56:06 +03:00
Roman Khimov
ff1545b7eb
core: move TestContractCall into the contract package
...
It belongs there and now it can be moved. No functional changes.
2022-06-08 16:53:01 +03:00
Roman Khimov
bb021d0778
native: unbind PutContractState from Management
...
It doesn't need Management's state, ID can't really change.
2022-06-08 16:41:28 +03:00
Roman Khimov
209b977e9a
core: move contract-related interop code into appropriate package
...
And move one of the tests with it.
2022-06-08 16:02:07 +03:00
Roman Khimov
10f94e6119
core: move chain dump test into its own package
2022-06-08 15:28:08 +03:00
Roman Khimov
c2b3ee3d8e
core: move basic chain creation into a package of its own
...
This allows to reuse it across different packages.
testchain can't be used because of circular dependencies.
Init() is not changed except for filepath.Join() use instead of direct string
appends which is a better approach anyway. rootpath is required because
current directory will change from package to package.
2022-06-08 15:25:27 +03:00
Roman Khimov
8673d2a79c
Merge pull request #2543 from nspcc-dev/perf-new
...
Minor allocation improvements
2022-06-07 11:04:59 +03:00
Roman Khimov
19ad31dc52
vm: optimize IsSignatureContract
...
We use it a lot in (*Blockchain).IsTxStillRelevant().
name old time/op new time/op delta
IsSignatureContract-8 19.1ns ± 5% 1.2ns ± 4% -93.81% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
IsSignatureContract-8 0.00B 0.00B ~ (all equal)
name old allocs/op new allocs/op delta
IsSignatureContract-8 0.00 0.00 ~ (all equal)
2022-06-07 10:29:13 +03:00
Roman Khimov
92c94f265c
interop/vm: make VM reusable and use on VM for all in-block execs
...
Avoid allocating again and again. Increases TPS by about 3%.
2022-06-07 10:05:47 +03:00
Roman Khimov
bdc6624c9d
interop: unify VM price getter setting
2022-06-06 22:00:16 +03:00
Roman Khimov
638b04b29a
interop: wrap contract.LoadToken in context.LoadToken
...
Creating a closure in runtime is a relatively costly thing, but it can easily
be avoided.
2022-06-06 21:53:03 +03:00
Anna Shaleva
7612ad1195
rpc: adjust test data
2022-06-06 13:02:29 +03:00
Anna Shaleva
7dcbfcbbdb
rpc: improve WS connection closure error a bit
...
Ref.
https://github.com/nspcc-dev/neofs-node/pull/1480#issuecomment-1147256917 .
2022-06-06 12:58:42 +03:00
Anna Shaleva
1005c1f7db
vm: forbid jumping out of the script bounds
2022-06-06 12:18:19 +03:00
Anna Shaleva
a5b5f88fe2
core: doesn't allow to deploy contract with invalid method offset
...
This commit partially reverts 16bf7c1426
.
2022-06-06 12:18:16 +03:00
Anna Shaleva
bc85f00cc7
Partially revert "core: fix native NEO ABI"
...
This partially reverts commit ca127f1615
.
2022-06-06 12:08:52 +03:00
Roman Khimov
799394192b
state: create buffer/io writer once per TokenTransferLog
...
name old time/op new time/op delta
TokenTransferLog_Append-8 93.0µs ±170% 46.8µs ±152% ~ (p=0.053 n=10+9)
name old alloc/op new alloc/op delta
TokenTransferLog_Append-8 53.8kB ± 4% 38.6kB ±39% -28.26% (p=0.004 n=8+10)
name old allocs/op new allocs/op delta
TokenTransferLog_Append-8 384 ± 0% 128 ± 0% -66.67% (p=0.000 n=10+10)
2022-06-04 00:11:11 +03:00
Roman Khimov
1e5825c4af
core: don't allocate another int for notification handler
...
It'll be serialized anyway.
2022-06-03 23:39:46 +03:00
Roman Khimov
7a2199c495
Merge pull request #2535 from nspcc-dev/drop-hf-prefix
...
config: s/HF_Aspidochelone/Aspidochelone/
2022-06-03 11:59:53 +03:00
Roman Khimov
b6829f36fd
config: s/HF_Aspidochelone/Aspidochelone/
...
HF_ prefix makes zero sense to me. If it's "hardfork", then it's in the
"Hardforks" section already. If it's "hotfix", then it made some sense back
when it was HF_2712_FixSyscallFees, but now it's codenamed anyway. So we can
drop it and have a cleaner config.
2022-06-03 11:53:18 +03:00
Anna Shaleva
629567717f
compiler: make TestNativeHelpersCompile test more verbose
2022-06-03 11:37:50 +03:00
Anna Shaleva
ca519492fc
rpc: adjust test data
2022-06-03 11:37:50 +03:00
Anna Shaleva
d3b15a60a2
core: add test for ABI checks on deploy
...
Make sure it compatible with the reference implementation, see
736c346b9d/src/neo/SmartContract/Helper.cs (L83)
.
2022-06-03 11:37:50 +03:00
Anna Shaleva
16bf7c1426
core: adjust contract script check on deploy
...
Reference implementation doesn't panic if the method offset is out of
the contract script bounds, see:
736c346b9d/src/neo/SmartContract/Helper.cs (L82)
and
a65487fa56/src/Neo.VM/Script.cs (L146)
.
This commit fixes T5 statediff at block #125000 . Neo-go node FAULTed the
deploying transaction:
```
{
"version" : 0,
"sysfee" : "1000106065",
"validuntilblock" : 130758,
"script" : "DdMDeyJuYW1lIjoiTmVwMTdUb2tlbiIsImdyb3VwcyI6W10sImZlYXR1cmVzIjp7fSwic3VwcG9ydGVkc3RhbmRhcmRzIjpbIk5FUC0xNyJdLCJhYmkiOnsibWV0aG9kcyI6W3sibmFtZSI6InN5bWJvbCIsInBhcmFtZXRlcnMiOltdLCJyZXR1cm50eXBlIjoiU3RyaW5nIiwib2Zmc2V0IjoyMiwic2FmZSI6dHJ1ZX0seyJuYW1lIjoiZGVjaW1hbHMiLCJwYXJhbWV0ZXJzIjpbXSwicmV0dXJudHlwZSI6IkludGVnZXIiLCJvZmZzZXQiOjIyLCJzYWZlIjp0cnVlfSx7Im5hbWUiOiJ0b3RhbFN1cHBseSIsInBhcmFtZXRlcnMiOltdLCJyZXR1cm50eXBlIjoiSW50ZWdlciIsIm9mZnNldCI6MjIsInNhZmUiOnRydWV9LHsibmFtZSI6ImJhbGFuY2VPZiIsInBhcmFtZXRlcnMiOlt7Im5hbWUiOiJvd25lciIsInR5cGUiOiJIYXNoMTYwIn1dLCJyZXR1cm50eXBlIjoiSW50ZWdlciIsIm9mZnNldCI6MjIsInNhZmUiOnRydWV9LHsibmFtZSI6InRyYW5zZmVyIiwicGFyYW1ldGVycyI6W3sibmFtZSI6ImZyb20iLCJ0eXBlIjoiSGFzaDE2MCJ9LHsibmFtZSI6InRvIiwidHlwZSI6Ikhhc2gxNjAifSx7Im5hbWUiOiJhbW91bnQiLCJ0eXBlIjoiSW50ZWdlciJ9LHsibmFtZSI6ImRhdGEiLCJ0eXBlIjoiQW55In1dLCJyZXR1cm50eXBlIjoiQm9vbGVhbiIsIm9mZnNldCI6MjIsInNhZmUiOmZhbHNlfV0sImV2ZW50cyI6W3sibmFtZSI6IlRyYW5zZmVyIiwicGFyYW1ldGVycyI6W3sibmFtZSI6ImZyb20iLCJ0eXBlIjoiSGFzaDE2MCJ9LHsibmFtZSI6InRvIiwidHlwZSI6Ikhhc2gxNjAifSx7Im5hbWUiOiJhbW91bnQiLCJ0eXBlIjoiSW50ZWdlciJ9XX1dfSwicGVybWlzc2lvbnMiOlt7ImNvbnRyYWN0IjoiKiIsIm1ldGhvZHMiOiIqIn1dLCJ0cnVzdHMiOltdLCJleHRyYSI6eyJlbWFpbCI6ImRldmVsb3BlckBuZW8ub3JnIiwiYXV0aG9yIjoibGF6eW5vZGUiLCJkZXNjcmlwdGlvbiI6IkEgU2ltcGxlIE5lcC0xNyBDb250cmFjdCJ9fQyyTkVGM25lb21sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABOaHR0cHM6Ly9naXRodWIuY29tL2xhenlub2RlL25lb21sL2Jsb2IvZGV2L2V4YW1wbGVzL2EuZnVuY3Rpb24uc2ltcGxlbmVwMTcueG1sAAAAABYMBU5lb01MQBhAAgDh9QVAATkFQBFAkA456BLAHwwGZGVwbG95DBT9o/pDRupTKiWPxJfdrdtkN8n9/0FifVtS",
"hash" : "0x40302bcf2021f63a1c24f6009e154c3200f73ad2fe1462d7d599145823dbfa7e",
"witnesses" : [
{
"verification" : "DCECExn08eznGBdguHbcwI+R2//EtVdDx4qf6CeizHqOJgBBVuezJw==",
"invocation" : "DEBtoq+T9NrammQjuYnifco7KHCTk2v+woEJqJCUMr9IscS7PaZaN3FNzSt11yUglIi3T0CJ17KwArBOBvJ8kwq2"
}
],
"attributes" : [],
"signers" : [
{
"scopes" : "None",
"account" : "0x13a192c56738900f9918d7f1ec07d9d8c278b804"
}
],
"size" : 1360,
"nonce" : 1829882407,
"sender" : "NLLvsqs7AyBNmQT6NThUxYWDFwV5b1evaK",
"netfee" : "234352"
}
```
Transaction script contains malformed contract manifest (all methods
offsets are set to be 22, while the contract script lenght is 22):
```
{
"name" : "Nep17Token",
"groups" : [],
"extra" : {
"description" : "A Simple Nep-17 Contract",
"email" : "developer@neo.org",
"author" : "lazynode"
},
"permissions" : [
{
"contract" : "*",
"methods" : "*"
}
],
"features" : {},
"supportedstandards" : [
"NEP-17"
],
"abi" : {
"events" : [
{
"parameters" : [
{
"name" : "from",
"type" : "Hash160"
},
{
"type" : "Hash160",
"name" : "to"
},
{
"name" : "amount",
"type" : "Integer"
}
],
"name" : "Transfer"
}
],
"methods" : [
{
"safe" : true,
"offset" : 22,
"name" : "symbol",
"returntype" : "String",
"parameters" : []
},
{
"returntype" : "Integer",
"parameters" : [],
"safe" : true,
"offset" : 22,
"name" : "decimals"
},
{
"parameters" : [],
"returntype" : "Integer",
"name" : "totalSupply",
"safe" : true,
"offset" : 22
},
{
"parameters" : [
{
"name" : "owner",
"type" : "Hash160"
}
],
"returntype" : "Integer",
"name" : "balanceOf",
"offset" : 22,
"safe" : true
},
{
"name" : "transfer",
"offset" : 22,
"safe" : false,
"parameters" : [
{
"type" : "Hash160",
"name" : "from"
},
{
"name" : "to",
"type" : "Hash160"
},
{
"name" : "amount",
"type" : "Integer"
},
{
"name" : "data",
"type" : "Any"
}
],
"returntype" : "Boolean"
}
]
},
"trusts" : []
}
```
2022-06-03 11:37:50 +03:00