Roman Khimov
a10b1ad32d
rpc/server: make Server conform network.Service interface
...
With Start() and Shutdown() taking no parameters and returning no values.
2022-04-22 10:49:06 +03:00
Roman Khimov
4eee2f930e
rpc/server: make double-start a no-op
2022-04-22 10:33:52 +03:00
Anna Shaleva
1c6afe402f
rpc: adjust getversion
RPC response
...
Reference implementation includes `initialgasdistribution` as integer
value with decimals.
C# response:
```
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"nonce": 1677922561,
"protocol": {
"addressversion": 53,
"initialgasdistribution": 5200000000000000,
"maxtraceableblocks": 2102400,
"maxtransactionsperblock": 512,
"maxvaliduntilblockincrement": 5760,
"memorypoolmaxtransactions": 50000,
"msperblock": 15000,
"network": 860833102,
"validatorscount": 7
},
"tcpport": 10333,
"useragent": "/Neo:3.1.0/",
"wsport": 10334
}
}
```
Neo-Go response:
```
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"network": 860833102,
"nonce": 2847278838,
"protocol": {
"addressversion": 53,
"initialgasdistribution": "52000000",
"maxtraceableblocks": 2102400,
"maxtransactionsperblock": 512,
"maxvaliduntilblockincrement": 5760,
"memorypoolmaxtransactions": 50000,
"msperblock": 15000,
"network": 860833102,
"validatorscount": 7
},
"tcpport": 10333,
"useragent": "/NEO-GO:0.98.2/"
}
}
```
2022-04-14 13:51:30 +03:00
Anna Shaleva
889a7ec378
rpc: regenerate basic chain and adjust RPC server tests
2022-03-30 11:32:30 +03:00
Anna Shaleva
4a74c117ee
*: refactor TestCreateBasicChain and its dependencies
...
Close #2355
2022-03-30 11:32:26 +03:00
Roman Khimov
9d5b8d606a
server: quote method in logs, fix CodeQL warnings
...
CWE-117:
Log entries created from user input
If unsanitized user input is written to a log entry, a malicious user may be able to forge new log entries.
2022-03-22 16:05:06 +03:00
Roman Khimov
0a338ea94b
rpc/server: register ws calls in Prometheus
...
They were completely missing.
2022-03-21 23:18:00 +03:00
Anna Shaleva
2096ad6e81
*: remove io/ioutil uses
...
Close #1764 .
2022-03-17 19:39:18 +03:00
AnnaShaleva
49e228ddf8
rpc: fix Client's GetOraclePrice
2022-03-01 19:08:22 +03:00
AnnaShaleva
92282c70cb
*: support customisable NotaryServiceFeePerKey value
...
* Add corresponding methods to Notary contract.
* Extend RPC Client API.
* Adjust tests.
2022-03-01 19:08:16 +03:00
AnnaShaleva
0092330fe1
rpc: carefully review places where Client.cache.initDone is used
...
1. Keep initDone check only for the places where cache is directly accessed.
We don't need to check it in other places, otherwise we have a mess of
duplicating checks.
2. Fix bug in code related to block deserialisation. There's no magic, so
checking that initialisation is done is not enough for proper block
deserialisation. We need to manually fill StateRootEnabled field.
3. Since transaction doesn't need network magic to compute its hash, we don't
need to perform Client initialisation before transaction-related requests.
4. Check that cache is initialised before accessing network magic.
5. Refactor the way Policy contract hash is fetched for Client requests.
We don't really need Client initialisation for that, it's OK to fetch Policy
hash on-the-fly.
2022-02-22 12:52:14 +03:00
Anna Shaleva
e306a90554
rpc: add NEP11-D tests to server and client
...
Also refactor basic chain creation.
2022-02-09 11:57:16 +03:00
Anna Shaleva
47652643df
rpc: accept NEP11 token IDs as []byte for client methods
...
Accepting IDs as string is encoding-ambiguous, so make it []byte instead.
2022-02-09 11:55:07 +03:00
Roman Khimov
1df447cd68
Merge pull request #2334 from nspcc-dev/extendable-validators
...
Extendable validators
2022-02-01 12:09:56 +03:00
Roman Khimov
cda1c75db3
core: drop GetStandBy* methods
...
They're misleading now that we have variable number of committee
members/validators. The standby list can be seen in the configuration and the
appropriate numbers can be received from it also.
2022-01-31 23:14:38 +03:00
Roman Khimov
e621f746a7
config/core: allow to change the number of validators
...
Fixes #2320 .
2022-01-31 23:14:38 +03:00
Evgeniy Stratonikov
e890c32dcc
rpc/client: remove dependency on examples
...
Duplicate necessary structures in a dedicated micropackage.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-25 12:41:06 +03:00
Evgeniy Stratonikov
9871dc8f5a
compiler: update x/tools package
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:26 +03:00
Roman Khimov
42769d11ff
Merge pull request #2330 from nspcc-dev/transfer-logs-opt
...
core: improve Seek and optimise seek time for transfer logs
2022-01-19 21:55:40 +03:00
Anna Shaleva
9b841b9b8f
core, rpc: use Seek to iterate over NEP* transfers
...
The results are controversial a bit. MemoryPS is a special storage
and the new approach doesn't help it to iterate through NEP17 transfers.
However, on long distances (if transfers are requested for more than
1000 blocks, which is ~4.1 hours of mainnet chain) both LevelDB and
BoltDB perform good enough with the new approach. Taking into account
the fact that default value for the query period of `getnep17transfers`
RPC handler is a week (~40K mainnet blocks) we can sacrifice MemoryPS
performance in favour of BoltDB and LevelDB optimisation.
Close #2263 .
Benchmark results:
name old time/op new time/op delta
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take100Blocks-8 783µs ±13% 1762µs ± 4% +125.12% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take1000Blocks-8 6.91ms ± 2% 9.00ms ± 2% +30.28% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take100Blocks-8 1.43ms ± 8% 1.79ms ± 4% +24.93% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take1000Blocks-8 7.78ms ± 3% 8.93ms ± 2% +14.78% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take100Blocks-8 7.69ms ± 3% 1.73ms ±10% -77.50% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take1000Blocks-8 14.1ms ± 2% 9.0ms ± 2% -36.53% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take100Blocks-8 768µs ± 3% 801µs ± 2% +4.24% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take1000Blocks-8 8.03ms ± 2% 8.05ms ± 8% ~ (p=0.436 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take100Blocks-8 1.70ms ±16% 0.85ms ± 7% -49.85% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take1000Blocks-8 10.8ms ± 2% 8.1ms ± 2% -25.21% (p=0.000 n=10+8)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take100Blocks-8 10.8ms ± 2% 0.9ms ± 7% -92.12% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take1000Blocks-8 18.2ms ±13% 8.2ms ± 6% -54.95% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take100Blocks-8 874µs ± 6% 823µs ± 2% -5.81% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take1000Blocks-8 9.35ms ± 2% 8.14ms ± 2% -12.91% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take100Blocks-8 1.85ms ± 4% 0.89ms ±10% -51.68% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take1000Blocks-8 10.6ms ± 4% 8.2ms ± 2% -22.44% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take100Blocks-8 10.7ms ± 2% 0.9ms ± 2% -91.90% (p=0.000 n=8+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take1000Blocks-8 21.8ms ±15% 8.2ms ± 1% -62.25% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take100Blocks-8 650kB ± 0% 1010kB ± 7% +55.45% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take1000Blocks-8 6.39MB ± 0% 9.89MB ± 1% +54.74% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take100Blocks-8 1.28MB ± 0% 1.14MB ± 0% -11.25% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take1000Blocks-8 7.02MB ± 0% 10.01MB ± 0% +42.54% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take100Blocks-8 7.02MB ± 0% 1.08MB ± 0% -84.64% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take1000Blocks-8 12.8MB ± 0% 10.0MB ± 0% -22.04% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take100Blocks-8 823kB ± 3% 866kB ± 5% +5.19% (p=0.001 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take1000Blocks-8 9.92MB ± 0% 9.85MB ± 0% -0.71% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take100Blocks-8 1.84MB ± 4% 1.01MB ± 5% -44.75% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take1000Blocks-8 11.0MB ± 0% 10.0MB ± 1% -8.45% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take100Blocks-8 11.0MB ± 0% 1.0MB ± 1% -90.55% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take1000Blocks-8 20.0MB ± 0% 10.1MB ± 0% -49.69% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take100Blocks-8 913kB ± 5% 907kB ± 6% ~ (p=0.497 n=9+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take1000Blocks-8 10.0MB ± 1% 10.0MB ± 1% -0.63% (p=0.001 n=10+8)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take100Blocks-8 1.92MB ± 2% 1.04MB ± 0% -45.53% (p=0.000 n=9+8)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take1000Blocks-8 11.1MB ± 1% 10.1MB ± 0% -9.22% (p=0.000 n=10+7)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take100Blocks-8 11.1MB ± 1% 1.0MB ± 0% -90.61% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take1000Blocks-8 20.4MB ± 1% 10.1MB ± 0% -50.46% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take100Blocks-8 11.1k ± 0% 11.7k ± 0% +5.35% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take1000Blocks-8 110k ± 0% 110k ± 0% +0.55% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take100Blocks-8 22.0k ± 0% 11.9k ± 0% -46.14% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take1000Blocks-8 120k ± 0% 110k ± 0% -8.44% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take100Blocks-8 120k ± 0% 12k ± 0% -90.36% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take1000Blocks-8 219k ± 0% 110k ± 0% -49.73% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take100Blocks-8 11.3k ± 0% 11.2k ± 0% -1.06% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take1000Blocks-8 112k ± 0% 110k ± 0% -2.36% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take100Blocks-8 22.5k ± 0% 11.3k ± 0% -49.65% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take1000Blocks-8 124k ± 0% 110k ± 0% -11.08% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take100Blocks-8 124k ± 0% 11k ± 0% -90.84% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take1000Blocks-8 225k ± 0% 110k ± 0% -51.07% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take100Blocks-8 11.4k ± 0% 11.3k ± 0% -1.36% (p=0.000 n=9+9)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take1000Blocks-8 114k ± 0% 111k ± 0% -2.33% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take100Blocks-8 22.7k ± 0% 11.5k ± 0% -49.56% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take1000Blocks-8 125k ± 0% 111k ± 0% -11.12% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take100Blocks-8 125k ± 0% 11k ± 0% -90.82% (p=0.000 n=8+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take1000Blocks-8 229k ± 1% 111k ± 0% -51.42% (p=0.000 n=10+10)
2022-01-19 20:55:08 +03:00
Roman Khimov
2e452df13a
rpc/storage: add storage changes to invoke* diagnostics
2022-01-19 00:02:19 +03:00
Roman Khimov
d79d8324e0
rpc: add notifications into the invoke* result
2022-01-18 22:35:44 +03:00
Anna Shaleva
e3c0a1635f
rpc: improve findstates
errors reporting
2022-01-17 12:24:59 +03:00
Roman Khimov
9c8ba5777e
Merge pull request #2323 from nspcc-dev/drop-blockchainer
...
Reduce blockchainer.Blockchainer use
2022-01-14 20:47:26 +03:00
Roman Khimov
fc45d3b132
blockchain: properly set invocation counter for verification ctx
...
Fix problem noted in #2270 .
2022-01-14 19:57:16 +03:00
Roman Khimov
9f9bd7261c
core: return *interop.Context from GetTestVM
...
Return everything needed, fix #2273 .
2022-01-14 19:57:16 +03:00
Roman Khimov
bf1604454c
blockchainer/network: move StateSync interface to the user
...
Only network package cares about it.
2022-01-14 19:57:14 +03:00
Anna Shaleva
73ecbb2fb3
rpc: adjust helper contract code
...
Compiler forces notification parameters to match the one specified in
manifest, and manifest of `test_contract.go` tells that `to` parameter
type is hash160:
```
event 'Transfer' should have 'Hash160' as type of 1 parameter, got: ByteArray
```
2022-01-14 16:47:31 +03:00
Roman Khimov
c942402957
blockchainer: drop Policer interface
...
We never use it as a proper interface, so it makes no sense keeping it this
way.
2022-01-12 00:58:03 +03:00
Roman Khimov
01d15ff473
Merge pull request #2270 from nspcc-dev/vm-invoked-contracts
...
Add invoked contract tracing
2021-12-01 11:27:27 +03:00
Roman Khimov
f58d424c6d
rpc/client: fix custom* scope processing in CreateTxFromScript
...
Copying just the scope doesn't work for CustomContracts, CustomGroups and
Rules because they all contain additional metadata. Thanks @mialbu for
reporting this.
2021-11-22 12:44:42 +03:00
Roman Khimov
c01427ca65
rpc: add verbose parameter to invokefunction and invokescript
2021-11-20 21:57:41 +03:00
Roman Khimov
5b470f14cc
rpc: pass single Param to CreateFunctionInvocationScript
...
N3 contracts require method and array of arguments to function correctly, but
CreateFunctionInvocationScript can produce scripts that won't work correctly
if one is to pass anything but a single array parameter to it. This doesn't
make much sense, so we can always expect there to be an array of parameters in
the third positional invokefunction argument (the same way C# node does).
2021-11-20 21:57:41 +03:00
Roman Khimov
ce9d0b22cf
*: use NEP-XX naming consistently in docs/comments
...
Standards are NEP-11 and NEP-17, not NEP11, not NEP17, not anything
else. Variable/function names of course can use whatever fits, but documents
and comments should be consistent wrt this.
2021-11-19 12:58:46 +03:00
Roman Khimov
1375918b63
rpc: add client-side NEP-11 methods
2021-11-19 12:58:46 +03:00
Roman Khimov
7f48653e66
rpc: add server-side NEP-11 tracking API
2021-11-19 12:58:46 +03:00
Roman Khimov
125e4231b0
core: store NEP-11 transfers, add accessor functions
2021-11-18 00:09:10 +03:00
Roman Khimov
cc4a63e454
rpc/server: use dynamic port for P2P service
...
Fix running tests alongside regular testnet node.
panic: TCP listen error
goroutine 4634 [running]:
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc0008540c0, 0xc001a4df80, 0x1, 0x1)
/home/rik/go/pkg/mod/go.uber.org/zap@v1.18.1/zapcore/entry.go:234 +0x532
go.uber.org/zap.(*Logger).Panic(0xc002399ce0, 0xecd669, 0x10, 0xc001a4df80, 0x1, 0x1)
/home/rik/go/pkg/mod/go.uber.org/zap@v1.18.1/logger.go:230 +0x85
github.com/nspcc-dev/neo-go/pkg/network.(*TCPTransport).Accept(0xc000fd6960)
/home/rik/dev/neo-go/pkg/network/tcp_transport.go:49 +0x216
created by github.com/nspcc-dev/neo-go/pkg/network.(*Server).Start
/home/rik/dev/neo-go/pkg/network/server.go:292 +0x2bb
FAIL github.com/nspcc-dev/neo-go/pkg/rpc/server 1.095s
2021-11-15 12:19:27 +03:00
Roman Khimov
6b8e615094
Merge pull request #2234 from nspcc-dev/rpc/params-parsing
...
rpc: method-specific parameters parsing optimisation
2021-11-10 20:45:44 +03:00
Anna Shaleva
4072c2fa90
rpc: handlers parameters audit
...
Make them compatible with C#.
2021-11-10 14:54:09 +03:00
Anna Shaleva
2e8bbf2a87
rpc: *In parameters marshalling optimisation
...
Parse request parameters on-demand.
2021-11-10 14:42:08 +03:00
Anna Shaleva
3be2a22af8
rpc: fix Unknown transaction
response for gettransactionheight
2021-11-09 16:56:48 +03:00
Evgeniy Stratonikov
4ab18d084a
rpc/request: add unmarshal benchmark
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:21:04 +03:00
AnnaShaleva
2d196b3f35
rpc: refactor calculatenetworkfee
handler
...
Use (Blockchainer).VerifyWitness() to calculate network fee for
contract-based witnesses.
2021-10-25 19:07:25 +03:00
Roman Khimov
d551439654
Merge pull request #2193 from nspcc-dev/optimize-find
...
core: optimise (*MemCachedStorage).Seek
2021-10-21 21:20:33 +03:00
Anna Shaleva
07cbe4d253
core: add finalizer functions to interop context
...
These functions are aimed to free the resources occupied by storage
iterator by the end of script execution or whenever Finilize is called.
2021-10-21 10:05:12 +03:00
Anna Shaleva
55fb221bbb
rpc: make getproof
work with destroyed contracts
...
Now it's able to get proof for destroyed contract if the contract wasn't
destroyed before the requested stateroot's height.
2021-10-15 07:06:25 +03:00
Anna Shaleva
892eadf86d
core: mandate passing from
as a subprefix for (*Trie).Find
...
However, we need to distinguish empty subprefix and nil subprefix (no
start specified) to match the C# behaviour.
2021-10-13 14:47:41 +03:00
Anna Shaleva
43ac4e1517
rpc: implement findstates
RPC handler
2021-10-13 11:41:05 +03:00
Anna Shaleva
01143da621
rpc: add getstate
RPC handler
2021-10-11 16:43:44 +03:00
Roman Khimov
b4e24bef14
Merge pull request #2202 from nspcc-dev/validatorscount
...
rpc: add validatorscount to getversion response
2021-09-29 11:55:59 +03:00
Roman Khimov
5a2b77238c
rpc: add validatorscount to getversion response
...
See neo-project/neo-modules#642 .
2021-09-28 10:10:26 +03:00
Anna Shaleva
5c97e0dcf2
rpc: move NotaryRequestEvent to the subscriptions pkg
...
It is used for subscriptions only, so move it to the subscriptions pkg.
2021-09-24 17:42:59 +03:00
Anna Shaleva
b3ea7504cb
subscriptions: add container hash to notification event
...
External users make use of it. Close #2190 .
2021-09-24 17:42:02 +03:00
Roman Khimov
42a9d3d7b8
nef: add Source field
...
Follow neo-project/neo#2605 .
2021-09-24 00:19:37 +03:00
Anna Shaleva
c113d682bd
core: fix NEO balance state handler
...
We need to store NEO balance's LastUpdateHeight before GAS mint,
because mint can call onNEP17Payment and onNEP17Payment can call NEO
transfer which also calls GAS mint. Storing balance height allows to
avoid recursion.
2021-09-20 19:23:35 +03:00
Roman Khimov
621478296c
Merge pull request #2161 from nspcc-dev/rpc-get-version
...
rpc: return protocol parameters in `getversion`, fix #2160
2021-09-13 19:10:43 +03:00
Evgeniy Stratonikov
8a3e05096b
*: gofmt -s
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-09-10 21:49:11 +03:00
Evgeniy Stratonikov
c465b18cb2
rpc: return protocol parameters in getversion
, fix #2160
...
`StateRootInHeader` is duplicated similarly to `Network`.
It will be removed in future as it is surely a protocol parameter.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-09-10 21:45:59 +03:00
Roman Khimov
63e00ac128
Merge pull request #2166 from nspcc-dev/fix-nns-compat
...
Fix NNS compatibility
2021-09-10 18:10:17 +03:00
Roman Khimov
aaccf748ac
nft-nd-nns: add getAllRecords method
...
See neo-project/non-native-contracts#5 .
2021-09-10 16:30:45 +03:00
Anna Shaleva
b989fdb462
rpc: fill transaction witnesses during invokescript
handling
2021-09-10 11:38:59 +03:00
Anna Shaleva
61faf28738
rpc: avoid null
unverified transactions in getrawmempool
response
2021-09-10 11:38:59 +03:00
Anna Shaleva
ed9cdfe667
rpc: use core Header for getblockheader
response
...
Nonce and Primary fields were missing from response.
2021-09-09 18:47:22 +03:00
Anna Shaleva
74f1848d19
core: adjust LastUpdatedBlock calculation for NEP17 balances
...
...wrt P2PStateExchange setting.
2021-09-07 19:43:27 +03:00
Evgeniy Stratonikov
3c34e6fa21
rpc/request: delay parameter unmarshaling
...
It is rather costly to try to unmarshal many structs in order.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-13 16:22:54 +03:00
Anna Shaleva
e8bed184d5
core: implement dynamic NEP17 balances tracking
...
Request NEP17 balances from a set of NEP17 contracts instead of getting
them from storage. LastUpdatedBlock tracking remains untouched, because
there's no way to retrieve it dynamically.
2021-07-29 10:23:01 +03:00
Anna Shaleva
e46d76d7aa
core: rename state.NEP17Balances to state.NEP17TransferInfo
...
Balances are to be removed from state.NEP17TransferInfo, so the remnant
fields are NextTransferBatch, NewBatch and a map of LastUpdatedBlocks.
These fields are more staff-related.
Also rename dao.[Get, Put, put]NEP17Balances and STNEP17Balances
preffix.
Also rename NEP17TransferInfo.Trackers to LastUpdatedBlockTrackers
because NEP17TransferInfo.Balances are to be removed.
2021-07-28 13:22:53 +03:00
Roman Khimov
a188d20fd1
rpc: fix getstateheight result compatibility
...
C#:
"result" : {
"localrootindex" : 11623,
"validatedrootindex" : 11623
}
Go:
"result" : {
"blockHeight" : 11627,
"stateHeight" : 11627
}
2021-07-22 21:13:44 +03:00
Evgeniy Stratonikov
3a4e0caeb8
core/block: add Nonce
field to header
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-07-15 15:58:49 +03:00
Roman Khimov
473a1fc24e
rpc/server: fix sporadic test failures
...
It can still be "reading" after test end:
subscription_test.go:24:
Error Trace: subscription_test.go:24
asm_amd64.s:1374
Error: Received unexpected error:
set tcp 127.0.0.1:49874: use of closed network connection
Test: TestFilteredNotaryRequestSubscriptions
==================
WARNING: DATA RACE
Write at 0x00c000e28989 by goroutine 185:
testing.tRunner()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1126 +0x21a
Previous write at 0x00c000e28989 by goroutine 192:
testing.(*common).FailNow()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:731 +0x4f
testing.(*T).FailNow()
<autogenerated>:1 +0x44
github.com/stretchr/testify/require.NoError()
/home/runner/go/pkg/mod/github.com/stretchr/testify@v1.6.1/require/require.go:1038 +0x104
github.com/nspcc-dev/neo-go/pkg/rpc/server.wsReader()
/home/runner/work/neo-go/neo-go/pkg/rpc/server/subscription_test.go:24 +0x187
Goroutine 185 (running) created at:
testing.(*T).Run()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1168 +0x5bb
testing.runTests.func1()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1439 +0xa6
testing.tRunner()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1123 +0x202
testing.runTests()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1437 +0x612
testing.(*M).Run()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1345 +0x3b3
main.main()
_testmain.go:89 +0x236
Goroutine 192 (finished) created at:
github.com/nspcc-dev/neo-go/pkg/rpc/server.initCleanServerAndWSClient()
/home/runner/work/neo-go/neo-go/pkg/rpc/server/subscription_test.go:65 +0x294
github.com/nspcc-dev/neo-go/pkg/rpc/server.TestFilteredNotaryRequestSubscriptions()
/home/runner/work/neo-go/neo-go/pkg/rpc/server/subscription_test.go:348 +0x68d
testing.tRunner()
/opt/hostedtoolcache/go/1.15.13/x64/src/testing/testing.go:1123 +0x202
==================
testing.go:1038: race detected during execution of test
2021-07-08 10:40:54 +03:00
Roman Khimov
23fb5dd420
rpc/server: properly shutdown things in subscription test
...
Chain is the last one to Close().
2021-07-07 20:47:34 +03:00
Evgeniy Stratonikov
aa76383fa7
compiler: extend permission check to runtime hashes
...
If a method is known at compile time we can still check
if it is present in the list of methods of at least one contract.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-06-28 11:49:30 +03:00
Anna Shaleva
50296975e2
crypto: allow to provide non-default scrypt parameters
2021-06-11 15:22:28 +03:00
Roman Khimov
a6fc5d9fe4
Merge pull request #1998 from nspcc-dev/fix-calculatenetworkfee-result
...
rpc: wrap calculatenetworkfee result in a structure
2021-06-07 09:53:48 +03:00
Roman Khimov
6a61e86d12
rpc: wrap calculatenetworkfee result in a structure
...
C#:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"networkfee": "1185120"
}
}
Go:
{
"id": 2,
"jsonrpc": "2.0",
"result": 1185120
}
Thanks @csmuller for finding it.
2021-06-04 23:38:35 +03:00
Anna Shaleva
1dbf1d4310
rpc: allow to track notary requests via Notification subsystem
2021-06-01 16:29:04 +03:00
Evgeniy Stratonikov
c8ddc790d9
rpc/request: handle bool parameters correctly
2021-05-25 11:24:28 +03:00
Anna Shaleva
2d20b0fa23
core: remove nnsrecords package from native
...
Use nns from examples instead.
2021-05-17 22:24:56 +03:00
Anna Shaleva
7180b2ce06
rpc: use non-native NNS instead of native NNS in testchain
2021-05-17 22:08:15 +03:00
Roman Khimov
9d2712573f
*: enable godot linter and fix all its warnings
...
It's important for NeoGo to have clean documentation. No functional changes.
2021-05-12 23:17:03 +03:00
Roman Khimov
c4e084b0d8
*: fix whitespace errors
...
leading/trailing newlines
2021-05-12 22:51:41 +03:00
Roman Khimov
a44376903a
rpc: fix errcheck warnings in websocket code
2021-05-12 21:48:38 +03:00
Roman Khimov
e9cefc4bfc
*: fix all errcheck warnings in testing code
2021-05-12 21:45:12 +03:00
Roman Khimov
601841ef35
*: drop unused structure fields
...
Found by structcheck:
`good` is unused (structcheck)
and alike.
2021-05-12 19:41:23 +03:00
Roman Khimov
0178594850
*: simpilfy make() invocations
...
gosimple: S1019: should use make([]byte, 64) instead
2021-05-12 18:36:45 +03:00
Roman Khimov
8322607fd2
rpc/server: silence deadcode warning
2021-05-12 18:22:18 +03:00
Roman Khimov
cfc067dd24
*: remove dead code
...
Found by deadcode via golangci-lint.
2021-05-12 18:13:14 +03:00
Anna Shaleva
6d59689d9c
core: rename Neo.Crypto.CheckMultisig interop
2021-05-11 18:38:14 +03:00
Anna Shaleva
366e79b9b8
core: rename Neo.Crypto.CheckSig interop
2021-05-11 18:37:55 +03:00
Anna Shaleva
d0c64347ab
*: add data
to NEP11 Transfer
2021-05-05 19:44:29 +03:00
Anna Shaleva
9eeebf481c
rpc: allow to marshal Iterators for invoke* results
2021-04-30 16:23:06 +03:00
Anna Shaleva
40ae78cb88
wallet: add Standard
field to Token
...
We need to distinguish NEP11 and NEP17 tokens preesnted in the wallet.
2021-04-30 15:58:27 +03:00
Anna Shaleva
2fb083bd37
rpc: add NEP11TokenInfo method
2021-04-30 11:38:11 +03:00
Anna Shaleva
127d0ad2ba
rpc: allow to provide cosigners for NEP11-transfer-related commands
2021-04-23 10:45:11 +03:00
Anna Shaleva
49c35dec20
rpc: allow to provide cosigners for NEP17-transfer-related commands
2021-04-23 10:29:40 +03:00
Anna Shaleva
48ae1cc486
rpc: refactor SignAndPushInvocationTx
...
We have a set of accounts provided via `cosigners` argument, so we
should fill all transaction witnesses in (not only sender's witness).
If we can't properly construct witnesses for all of the signers then an
error should be returned.
2021-04-21 18:52:32 +03:00
Anna Shaleva
ae36523a61
rpc, internal: fix CodeQL int conversions warnings
...
```
Incorrect conversion of an integer with architecture-dependent bit
size from to a lower bit size type int32 without an upper bound
check.
```
2021-04-19 11:30:28 +03:00
Roman Khimov
13619a0e77
rpc/server: improve submitblock and submitnotaryrequest also
2021-04-10 22:47:24 +03:00
Roman Khimov
274f2c0408
rpc/server: be more specific in some sendrawtransaction error cases
...
Refs. #1894 .
2021-04-10 00:31:42 +03:00