Commit graph

5293 commits

Author SHA1 Message Date
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
AnnaShaleva
fbc09a415e *: fix build errors on windows 2021-11-01 11:15:35 +03:00
Evgeniy Stratonikov
7758378d28 compiler: allow to overload methods in manifest
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-29 20:15:21 +03:00
Evgeniy Stratonikov
51127b8918 vmcli: convert base64 string to address in parse
In application logs hashes are serialized as base64 so it is useful
to convert them back to address via `util convert`.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-29 14:55:10 +03:00
Roman Khimov
67eac3a27f
Merge pull request #2196 from nspcc-dev/drop-badger-and-redis
Drop Badger and Redis
2021-10-28 16:08:49 +03:00
Roman Khimov
ec47491d4d
Merge pull request #2235 from nspcc-dev/mpt/empty-batch
core: handle empty MPT batch properly
2021-10-27 19:14:39 +03:00
AnnaShaleva
3fed7b8eec core: handle empty MPT batch properly
It's OK to have it.
2021-10-27 18:44:39 +03:00
Roman Khimov
1144a03486 storage: drop RedisDB, close #2130 2021-10-27 17:32:25 +03:00
Roman Khimov
fb4b87bb96 storage: drop BadgerDB support, close #2130 2021-10-27 17:31:55 +03:00
Roman Khimov
fdf80dbdc5
Merge pull request #2225 from nspcc-dev/notary/allow-to-combine-witnesses
notary: allow to combine signers of different types
2021-10-26 17:54:07 +03:00
Roman Khimov
354a54c91c
Merge pull request #2232 from nspcc-dev/compiler-invalid-offset
Set proper context during analyzing func usage
2021-10-25 20:57:34 +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
Anna Shaleva
807fa4a720 services: allow non-empty inv scripts for contract-based notary witness 2021-10-25 17:23:29 +03:00
Evgeniy Stratonikov
4fe188a60d compiler: check correctness of emitted bytecode
The error here indicates a bug in compiler implementation.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-25 13:55:55 +03:00
Evgeniy Stratonikov
a885f84cad compiler: fail if some functions are missing
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-25 13:55:55 +03:00
Evgeniy Stratonikov
8a0429036b compiler: set type information during traversal, fix #2231
Set all necessary context before file traversal, not only import
maps. Also, we can skip restoring import maps because all our code is
processed via `For*` iterators which set necessary context.
We can also refactor this a bit to have all context in one place,
this will be done in #2086.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-10-25 13:55:55 +03:00
Roman Khimov
eea728b986
Merge pull request #2230 from nspcc-dev/inline-util
Compile `interop/util` as a regular package
2021-10-25 12:48:58 +03:00