Roman Khimov
0e1fe2f58b
Merge pull request #2259 from nspcc-dev/fix-some-tests
...
Fix some tests
2021-11-15 15:53:13 +03:00
Roman Khimov
48de82d902
network: fix data race in TestHandleMPTData, fix #2241
2021-11-15 12:37:01 +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
7fa58a4dc8
Merge pull request #2255 from nspcc-dev/compiler-noreturn-defers
...
compiler: correctly handle defer in functions without return values
2021-11-15 10:43:00 +03:00
Roman Khimov
f742bb6dd2
Merge pull request #2256 from nspcc-dev/optimize-gas-cost-of-conversion
...
compiler: optimize GAS cost of type conversion
2021-11-15 10:21:13 +03:00
Roman Khimov
db99368e96
compiler: optimize GAS cost of type conversion
...
CONVERT call base price is 8192. DUP, ISTYPE and JMPIF all cost 2. So we add
0.07% overhead in the worst case and save 99.93% otherwise.
At the same time, old code was just two bytes and new one is seven, but I
think it's tolerable considering how much GAS it can potentially save.
Fix #2250 .
2021-11-12 19:58:21 +03:00
Roman Khimov
a91581fa16
compiler: correctly handle defer in functions without return values
...
Fix #2253 .
2021-11-12 19:36:59 +03:00
Roman Khimov
b31a8d750e
Merge pull request #2252 from nspcc-dev/packmap-packstruct
...
vm: add PACKMAP/PACKSTRUCT, extend UNPACK
2021-11-12 18:25:54 +03:00
Roman Khimov
9cdd360606
Merge pull request #2251 from nspcc-dev/rules-witness-scope
...
transaction: add new Rules witness scope
2021-11-12 18:25:39 +03:00
Roman Khimov
410aabe7a1
compiler: drop some useless NOPs
...
They're all obsolete and not needed.
2021-11-12 17:19:59 +03:00
Roman Khimov
0d50730382
compiler: optimize map initialization with PACKMAP
2021-11-12 17:19:59 +03:00
Roman Khimov
a8befeea33
compiler: optimize new empty struct creation with PACKSTRUCT
2021-11-12 17:19:59 +03:00
Roman Khimov
909ea477f4
compiler: create arrays/structs more effectively
...
Use PACK/PACKSTRUCT.
2021-11-12 17:19:59 +03:00
Roman Khimov
3e6ce3c221
vm: add PACKMAP/PACKSTRUCT, extend UNPACK
...
See neo-project/neo-vm#443 .
2021-11-12 17:19:59 +03:00
Roman Khimov
9875799893
transaction: add new Rules witness scope
...
See neo-project/neo#2622 . The implementation is somewhat asymmetric (and not
very efficient) for binary/JSON encoding/decoding, but it should be
sufficient.
2021-11-12 15:29:28 +03:00
Anna Shaleva
4df5d370c5
neotest: export nonce() method
...
Sometimes user needs to construct transaction by itself, so it's better
to unify nonce sources for auto-generated and manually-generated
transactions to avoid nonce collisions in tests.
2021-11-11 20:00:40 +03:00
Roman Khimov
0a7f8afcea
Merge pull request #2229 from nspcc-dev/contract-test
...
Generic contract testing infrastructure
2021-11-11 11:46:55 +03:00
Evgeniy Stratonikov
ce549e4cb2
core/test: allow to determine system fee automatically
...
Eventually this will be replaced by `pkg/neotest` invocations but for
now it allows us to remove NNS constants together with the tests.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Evgeniy Stratonikov
79a48a7800
neotest: allow to use 6-node committee
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Evgeniy Stratonikov
bef2a6f7ae
neotest: provide both validator and committee
...
It will become useful for multi-node committee.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Evgeniy Stratonikov
950adb7b89
neotest: support painless multi-signing
...
Implementing a separate `Signer` interface is beneficial in multiple
ways:
1. Support both single and multiple transaction witnesses.
2. It should be easy to add contract signer this way.
Tests should use accounts created with `NewAccount` so hiding all
details doesn't seem to be an issue.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Evgeniy Stratonikov
1f9fd4a472
neotest: add contract client wrapper
...
Reduces amount of boilerplate code in tests.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Evgeniy Stratonikov
e3625152c6
core: move NNS test out of core
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Evgeniy Stratonikov
233fca0c1e
neotest: add contract testing framework
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:14 +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
3c13c8b7a5
rpc: refactor GetUint160FromHex helper
...
We can trim prefix using `strings` library like it is done for uint256.
2021-11-10 14:54:18 +03:00
Anna Shaleva
4072c2fa90
rpc: handlers parameters audit
...
Make them compatible with C#.
2021-11-10 14:54:09 +03:00
Anna Shaleva
867bb708fc
rpc: add cache to basic parameters
...
Need to cache values of string, bool, int and array because they can be
reused multiple times by RPC handlers. Other values don't need to be
cached.
2021-11-10 14:42:40 +03:00
Anna Shaleva
2fd04fbb35
rpc: allow to pass null parameter to invoke* calls
2021-11-10 14:42:40 +03:00
Anna Shaleva
2e8bbf2a87
rpc: *In parameters marshalling optimisation
...
Parse request parameters on-demand.
2021-11-10 14:42:08 +03:00
Roman Khimov
fc487eaa44
Merge pull request #2247 from nspcc-dev/rpc/unknown_tx_err
...
rpc: fix `Unknown transaction` response for `gettransactionheight`
2021-11-09 17:06:41 +03:00
Anna Shaleva
3be2a22af8
rpc: fix Unknown transaction
response for gettransactionheight
2021-11-09 16:56:48 +03:00
Roman Khimov
76db6a4f29
Merge pull request #2246 from nspcc-dev/update-tests-workflow
...
.github: update ubuntu image for test workflows
2021-11-09 16:51:28 +03:00
Anna Shaleva
a512db4797
.github: update ubuntu image for test workflows
2021-11-09 14:02:22 +03:00
Roman Khimov
173bf0be62
Merge pull request #2245 from nspcc-dev/examples/nep17
...
examples: adjust NEP17 and token-sale examples
2021-11-08 18:46:24 +03:00
Anna Shaleva
1a32fcb2dc
core: specify method not found
call error
...
It's useful for debugging and external users.
2021-11-08 17:19:00 +03:00
Anna Shaleva
5593d51d1a
examples: adjust NEP17 and token-sale examples
...
Do not store zero receiver balance in the contract storage.
2021-11-08 14:00:57 +03:00
Roman Khimov
5e08ef79fa
Merge pull request #2239 from nspcc-dev/win
...
*: allow to build NeoGo binaries on Windows
2021-11-08 10:21:57 +03:00
Roman Khimov
49149afecf
Merge pull request #2244 from nspcc-dev/dont-panic-on-stdin-ioctl-issues
...
Dont panic on stdin ioctl issues
2021-11-04 20:36:54 +03:00
Roman Khimov
7679a17bc6
cli: provide better error message in case of password read failure
2021-11-03 19:36:11 +03:00
Roman Khimov
053256f43e
input: return error instead of panicing, fix #2243
...
Doesn't make much sense panicing here.
2021-11-03 19:35:07 +03:00
AnnaShaleva
29552489f1
Makefile: build to './bin/neo-go.exe' on windows
...
'.exe' extension is needed to automatically run the binary on win.
2021-11-03 16:36:03 +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
Roman Khimov
1d16016027
Merge pull request #2217 from nspcc-dev/compiler-overload
...
compiler: allow to overload methods in manifest
2021-11-01 14:49:43 +03:00
Roman Khimov
fe50f6edc7
Merge pull request #2240 from nspcc-dev/fix-panic-in-network
...
Fix panic on peer disconnect
2021-11-01 12:44:15 +03:00
Roman Khimov
774dee3cd4
network: fix disconnection race between handleConn() and handleIncoming()
...
handleIncoming() winning the race for p.Disconnect() call might lead to nil
error passed as the reason for peer unregistration.
2021-11-01 12:20:55 +03:00
Roman Khimov
2eeec73770
network: don't panic if there is no reason for disconnect
...
Although error should always be there, we shouldn't fail like this if it's not:
| panic: runtime error: invalid memory address or nil pointer dereference
| [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xc8884c]
|
| goroutine 113 [running]:
| github.com/nspcc-dev/neo-go/pkg/network.(*Server).run(0xc000150580)
| github.com/nspcc-dev/neo-go/pkg/network/server.go:396 +0x7ac
| github.com/nspcc-dev/neo-go/pkg/network.(*Server).Start(0xc000150580, 0x0)
| github.com/nspcc-dev/neo-go/pkg/network/server.go:294 +0x3fb
| created by github.com/nspcc-dev/neo-go/cli/server.startServer
| github.com/nspcc-dev/neo-go/cli/server/server.go:344 +0x56f
2021-11-01 12:19:00 +03:00
Roman Khimov
328f8b7954
Merge pull request #2238 from nspcc-dev/fix-block-queue
...
network: remove priority queue from block queue
2021-11-01 12:03:45 +03:00
Roman Khimov
48668afa7a
Merge pull request #2237 from nspcc-dev/convert-base64-address
...
vmcli: convert base64 string to address in `parse`
2021-11-01 11:52:34 +03:00
Roman Khimov
8bb1ecb45a
network: remove priority queue from block queue
...
Use circular buffer which is a bit more appropriate. The problem is that
priority queue accepts and stores equal items which wastes memory even in
normal usage scenario, but it's especially dangerous if the node is stuck for
some reason. In this case it'll accept from peers and put into queue the same
blocks again and again leaking memory up to OOM condition.
Notice that queue length calculation might be wrong in case circular buffer
wraps, but it's not very likely to happen (usually blocks not coming from the
queue are added by consensus and it's not very fast in doing so).
2021-11-01 11:49:01 +03:00