Commit graph

4092 commits

Author SHA1 Message Date
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
Roman Khimov
473d11d24e
Merge pull request #2370 from nspcc-dev/nonzero-blockchain-start
core: add tests for non-zero blockchain start
2022-03-01 16:39:17 +03:00
Anna Shaleva
49c995ec06 core: add tests for blockchain initialisation
Close #1577.
2022-02-28 19:00:43 +03:00
AnnaShaleva
8e3f2417f4 core: add check for native activations history
It should be consistent with storage states.
2022-02-28 18:49:18 +03:00
Anna Shaleva
032d9749c2 core: improve blockchain error messages 2022-02-28 18:49:18 +03:00
Anna Shaleva
a57c3f4842 core: fix InitWithIncompleteStateJump test 2022-02-28 18:49:18 +03:00
Anna Shaleva
9adcefc2ef core: gracefully wrap Seek error if failed to retrieve header hases 2022-02-28 18:49:18 +03:00
Anna Shaleva
8d6aa1782d core: fix StateRootInHeader error message for (*Blockchain).init() 2022-02-28 18:49:18 +03:00
Anna Shaleva
ad0c53c067 core: unify the format of error messages for (*Blockchain).init() 2022-02-28 18:49:12 +03:00
Evgeniy Stratonikov
a2cef15932 compiler: emit bindings configuration
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-28 15:36:14 +03:00
Evgeniy Stratonikov
422a80f483 jsonpath: restrict amount of intermediate objects
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-28 13:18:34 +03:00
Anna Shaleva
21515e1835 core: refactor Level store creation for tests
We don't need to create the whole DB configuration structure.
2022-02-25 12:14:17 +03:00
Anna Shaleva
339bec1632 core: adjust TestDumpAndRestore test
`with state root` test should consider StateRootInHeader set to true.
2022-02-25 11:47:13 +03:00
Roman Khimov
870fd024c9
Merge pull request #2367 from nspcc-dev/rpc/thread-safe
rpc: take care of RPC clients
2022-02-24 20:11:15 +03:00
Anna Shaleva
1f255e756f rpc: add a note to RPC clients about thread-safeness 2022-02-24 19:01:21 +03:00
Anna Shaleva
2896c0a83a rpc: add test for concurrent WSClient access and request IDs generation 2022-02-24 19:01:21 +03:00
AnnaShaleva
0d8723527c rpc: refactor WSClient initialisation
Fix the following linter warning:
```
pkg/rpc/client/wsclient.go:99:18  govet  copylocks: literal copies lock value from *cl: github.com/nspcc-dev/neo-go/pkg/rpc/client.Client contains sync.RWMutex
```
2022-02-24 19:01:21 +03:00
AnnaShaleva
8991ee91cd rpc: make RPC WSClient thread-safe
Add ability to use unique request IDs for RPC requests.
2022-02-24 19:01:12 +03:00
Roman Khimov
b65ab011fe
Merge pull request #2349 from nspcc-dev/codegen-contract
cli/smartcontract: generate bindings to an existing contract
2022-02-24 15:51:33 +03:00
Anna Shaleva
0357d9f4f4 smartcontract: add hash check to paramcontext
Close #2344.
2022-02-24 10:21:08 +03:00
Evgeniy Stratonikov
da03d895de cli/smartcontract: generate bindings to an existing contract
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-23 15:40:06 +03:00
AnnaShaleva
5b2e88b916 rpc: protect supscriptions of RPC WSClient from concurrent access 2022-02-22 15:40:08 +03:00
Anna Shaleva
d77f188d10 rpc: update native contract hashes inside (c *Client) GetNativeContracts() 2022-02-22 15:39:42 +03:00
AnnaShaleva
408f6b050e rpc: make RPC Client thread-safe 2022-02-22 15:37:00 +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
AnnaShaleva
7c1862a9ac rpc: move all RPC client's cached fields to a separate cache structure
No functional changes.
2022-02-21 18:16:49 +03:00
Evgeniy Stratonikov
4aab85ef51 callflag: allow to marshal call flags in YAML
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-21 10:43:35 +03:00
Evgeniy Stratonikov
c212b2be95 util: allow to marshal Uint160 in YAML
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-21 10:38:20 +03:00
Roman Khimov
9224f57323
Merge pull request #2365 from nspcc-dev/vm/replace-cli
vm CLI: replace ishell with urfave/cli
2022-02-18 19:30:39 +03:00
AnnaShaleva
c35950206a vm: add test to check CLI UTF-8 compatibility 2022-02-18 19:20:50 +03:00
Anna Shaleva
c182141624 vm: fix linter issue
printf: `fmt.Fprintln` arg list ends with redundant newline (govet)
2022-02-18 19:20:43 +03:00
Anna Shaleva
2501ce3cb1 vm: adjust run description for VM CLI
With urfave/cli method name can be `help`.
2022-02-18 16:34:58 +03:00
Anna Shaleva
d04d55708c vm: setup autocompleter 2022-02-18 16:34:58 +03:00
Anna Shaleva
e8ec820d2e vm: add unload command
When execution fails it's the only way to change the prompt showing the
last executed instruction. Example:

```
NEO-GO-VM > loadgo examples/engine/engine.go
READY: loaded 117 instructions
NEO-GO-VM 0 > run
Error: at instruction 3 (SYSCALL): failed to invoke syscall 805851437: syscall not found
NEO-GO-VM 8 > parse
Error: missing argument
NEO-GO-VM 8 > parse 123
Integer to Hex			7b
Integer to Base64		ew==
String to Hex			313233
String to Base64		MTIz

NEO-GO-VM 8 > unload
NEO-GO-VM > exit

```
2022-02-18 16:34:58 +03:00
Anna Shaleva
563c3a4baa vm: replace ishell with urfave/cli
Use github.com/chzyer/readline for readline capabilities (including
history and ANSI escape sequences handling).
2022-02-18 16:34:50 +03:00
Roman Khimov
7d6f087337 storage: drop (KeyPrefix).Bytes() API
It allocates and most of the time we can avoid that.
2022-02-18 15:19:57 +03:00
Roman Khimov
7223caf369 dao: improve PutCurrentHeader logic
Move serialization out of the core.
2022-02-18 15:05:25 +03:00
Roman Khimov
522229d731 storage: drop AppendPrefix/AppendPrefixInt APIs
We're not using them anymore and they allocate.
2022-02-18 14:59:59 +03:00
Roman Khimov
d2db58d748 dao: move header hash store logic out of the core
Which allows for more efficient buffer use along the way.
2022-02-18 14:54:05 +03:00
Roman Khimov
de2579ec07 dao: put contract IDs into keys using big endianness
We don't have a need to iterate over them at the moment, but since we're
changing the DB format in the next release anyway let's add this ability also,
just in case.
2022-02-18 14:38:51 +03:00
Roman Khimov
600da6909c storage: put uint32 into keys using in big endianness
Which allows to iterate over the contents easily.
2022-02-18 14:35:17 +03:00
Roman Khimov
1ca918e631 dao: delay buffer creation until it's needed
Verification contexts don't ever touch the storage, so these allocations can
be avoided for them.
2022-02-18 14:24:45 +03:00
Roman Khimov
e864768c88 dao: simplify NewPrivate 2022-02-18 14:18:56 +03:00
Roman Khimov
5402e654d1 core: don't create useless DAO layer in GetTestVM
We're already wrapping in interop.NewContext.
2022-02-18 14:12:44 +03:00
Roman Khimov
b60d4ff191 dao: deduplicate header->KV conversion 2022-02-18 14:12:44 +03:00
Roman Khimov
d8cf879499 dao: deduplicate DeleteBlock, no functional changes 2022-02-18 14:12:44 +03:00
Roman Khimov
f80680187e storage: expose private storage map for more efficient MPT batch
It couldn't be done previously with two maps and mixed storage, but now all of
the storage changes are located in a single map, so it's trivial to do exact
slice allocations and avoid string->[]byte conversions.
2022-02-17 23:41:10 +03:00
Roman Khimov
7dc8fc443f dao: simplify buffer management for private DAO
Private DAO is only used in a single thread which means we can safely reuse
key/data buffers most of the time and handle it all in DAO.

Doesn't affect any benchmarks.
2022-02-17 22:27:39 +03:00
Roman Khimov
9bfb3357f2 storage: add "private" mode to MemCachedStore
Most of the time we don't need locking on the higher-level stores and we drop
them after Persist, so that's what private MemCachedStore is for.

It doesn't improve things in any noticeable way, some ~1% can be observed in
neo-bench under various loads and even less than that in chain processing. But
it seems to be a bit better anyway (less allocations, less locks).
2022-02-17 22:27:39 +03:00
Roman Khimov
aefb26255a dao: drop DAO interface
It's a remnant from the days when we had Simple and Cached DAO
implementations, now it makes zero sense.
2022-02-16 18:24:20 +03:00
Roman Khimov
9d2ef775cf storage: simplify (*MemCachedStore).Put/Delete interface
They never return errors, so their interface should reflect that. This allows
to remove quite a lot of useless and never tested code.

Notice that Get still does return an error. It can be made not to do that, but
usually we need to differentiate between successful/unsuccessful accesses
anyway, so this doesn't help much.
2022-02-16 18:24:20 +03:00
Roman Khimov
be24bf6412 storage: drop Put and Delete from Store interface
It's only changed with PutChangeSet, single KV operations are handled by
MemCachedStore.
2022-02-16 18:24:20 +03:00
Roman Khimov
017795c9c1 storage: completely remove MemoryBatch
If you need something like that, just wrap another MemCachedStore layer around
it.
2022-02-16 16:13:12 +03:00
Roman Khimov
17a43b19e0 storage: remove Batch from Store
We never use it for real underlying stores, so these implementations are
useless (everything goes though PutChangeSet now).
2022-02-16 15:55:48 +03:00
Roman Khimov
35bdfc5eca storage: use two maps for MemoryStore
Simple and dumb as it is, this allows to separate contract storage from other
things and dramatically improve Seek() time over storage (even though it's
still unordered!) which in turn improves block processing speed.

        LevelDB             LevelDB (KeepOnlyLatest)  BoltDB              BoltDB (KeepOnlyLatest)
Master  real    16m27,936s  real    10m9,440s         real    16m39,369s  real    8m1,227s
        user    20m12,619s  user    26m13,925s        user    18m9,162s   user    18m5,846s
        sys     2m56,377s   sys     1m32,051s         sys     9m52,576s   sys     2m9,455s

2 maps  real    10m49,495s  real    8m53,342s         real    11m46,204s  real    5m56,043s
        user    14m19,922s  user    24m6,225s         user    13m25,691s  user    15m4,694s
        sys     1m53,021s   sys     1m23,006s         sys     4m31,735s   sys     2m8,714s

neo-bench performance is mostly unaffected, ~0.5% for 1-1 test and 4% for
10K-10K test both fall within regular test error range.
2022-02-16 15:55:48 +03:00
Roman Khimov
b6a4947cfd storage: drop STAccount prefix
It's unused for a long time.
2022-02-16 13:06:57 +03:00
Roman Khimov
54bc603831 core: remove old storage items synchronously during jump
There won't be a lot of them and GC experience we have shows that iterating
over 1-2M of entries is not a huge problem for DBs we have.
2022-02-16 13:03:13 +03:00
Roman Khimov
805d81e441 core: drop old transfer data during state jump 2022-02-16 12:12:03 +03:00
Roman Khimov
3a2b800e5f core: remove stale transfer entries, fix #2096
Initially I thought of doing it in the next persist cycle, but testing shows
that it needs just ~2-5% of the time MPT GC does, so doing it in the same
cycle doesn't affect anything.
2022-02-15 15:51:03 +03:00
Roman Khimov
c4b49a2d52 storage: deduplicate storage closing in tests 2022-02-14 17:29:21 +03:00
Roman Khimov
261552516b stateroot: use a better word for logs 2022-02-14 17:29:21 +03:00
Roman Khimov
ccdda21718 stateroot: add and use DataMPTAux for auxiliary data
Use DataMPT for nodes only, otherwise with 1M blocks with have 1M
height-stateroot mapping entries that our GC has to iterate over for no
reason.
2022-02-14 17:29:21 +03:00
Roman Khimov
ad606101c7 storage: add SeekGC interface for GC
It's very special, single-purpose thing, but it improves cumulative time spent
in GC by ~10% for LevelDB and by ~36% for BoltDB during 1050K mainnet chain
processing. While the overall chain import time doesn't change in any
noticeable way (~1%), I think it's still worth it, for machines with slower
disks the difference might be more noticeable.
2022-02-14 17:29:21 +03:00
Roman Khimov
51b804ab0e storage: generalize Level/Bolt seek implementations
Too much in common. Just refactoring. no functional changes.
2022-02-12 23:09:37 +03:00
Roman Khimov
a5f8b8870a storage: use Update for changeset processing
Batch is only relevant in multithreaded context, internally it'll do some
magic and use the same locking/updating Update does, so it makes little sense
for us. This doesn't change benchmarks in any noticeable way.
2022-02-11 16:48:35 +03:00
Roman Khimov
6380647770
Merge pull request #2354 from nspcc-dev/mpt-value-based-gc
Value-based MPT GC
2022-02-11 16:25:08 +03:00
Roman Khimov
373fce54e6 config: conflict P2PStateExchangeExtensions/KeepOnlyLatestState
They don't make sense together, for P2P state exchange to be possible we need
a set of MPTs.
2022-02-11 14:19:54 +03:00
Roman Khimov
c5f1e2fbcd mpt: don't allocate for every key
Microoptimization.
2022-02-11 14:19:54 +03:00
Roman Khimov
423c7883b8 core: implement basic GC for value-based storage scheme
The key idea here is that even though we can't ensure MPT code won't make the
node active again we can order the changes made to the persistent store in
such a way that it practically doesn't matter. What happens is:
 * after persist if it's time to collect our garbage we do it synchronously
   right in the same thread working the underlying persistent store directly
 * all the other node code doesn't see much of it, it works with bc.dao or
   layers above it
 * if MPT doesn't find some stale deactivated node in the storage it's OK,
   it'll recreate it in bc.dao
 * if MPT finds it and activates it, it's OK too, bc.dao will store it
 * while GC is being performed nothing else changes the persistent store
 * all subsequent bc.dao persists only happen after the GC is completed which
   means that any changes to the (potentially) deleted nodes have a priority,
   it's OK for GC to delete something that'll be recreated with the next
   persist cycle

Otherwise it's a simple scheme with node status/last active height stored in
the value. Preliminary tests show that it works ~18% worse than the simple
KeepOnlyLatest scheme, but this seems to be the best result so far.

Fixes #2095.
2022-02-11 14:19:54 +03:00
Roman Khimov
075fd05bfc
Merge pull request #2356 from nspcc-dev/rpc-big-numbers
Allow to use big integers in RPC
2022-02-11 13:24:35 +03:00
Evgeniy Stratonikov
037076f2ee rpc/request: return error from ExpandArrayIntoScript if any
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-11 12:48:55 +03:00
Evgeniy Stratonikov
c72b3f2176 vm/emit: check big integer size
Fix a bug where big integer could be emitted as 0 without reporting an
error. Also, add tests.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-11 12:48:55 +03:00
Evgeniy Stratonikov
0394a79ef8 rpc: support big integers as request parameters
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-11 12:48:54 +03:00
Roman Khimov
acd348c13f
Merge pull request #2353 from nspcc-dev/fix-win-tests
*: fix windows tests
2022-02-10 21:57:10 +03:00
Roman Khimov
c4ee310e85 mpt: modify refcounted storage scheme to make GC possible
Add "active" flag into the node data and make the remainder modal, for active
nodes it's a reference counter, for inactive ones the deactivation height is
stored.

Technically, refcounted chains storing just one trie don't need a flag, but
it's a bit simpler this way.
2022-02-10 21:56:20 +03:00
Roman Khimov
86cb4ed80f mpt: add the notion of MPT mode
It directly affects the storage format, so it's important. ModeGC is not used
at the moment, but defined for future extensibility.
2022-02-10 19:15:18 +03:00
Anna Shaleva
9bbd94d0fa network: tune waiting limits in tests
Some tests are failing on Windows due to slow runners with errors like the following:
```
2022-02-09T17:11:20.3127016Z     --- FAIL: TestGetData/transaction (1.82s)
2022-02-09T17:11:20.3127385Z         server_test.go:500:
2022-02-09T17:11:20.3127878Z             	Error Trace:	server_test.go:500
2022-02-09T17:11:20.3128533Z             	            				server_test.go:520
2022-02-09T17:11:20.3128978Z             	Error:      	Condition never satisfied
2022-02-09T17:11:20.3129479Z             	Test:       	TestGetData/transaction
```
2022-02-10 18:58:50 +03:00
Anna Shaleva
0de4c0fc17 compiler: use full paths for debug info files if relative can't be constructed
Firstly introduced in 9871dc8f5a. It's OK
if relative path can't be constructed e.g. for interop dependencies. Otherwice
leads to failing tests on Windows with the following error:
```
2022-02-09T09:39:31.3307626Z panic: Rel: can't make D:\a\neo-go\neo-go\pkg\interop\neogointernal\syscall.go relative to C:\Users\RUNNER~1\AppData\Local\Temp\TestContractInitAndCompile1998984267\001\testcontract [recovered]
2022-02-09T09:39:31.3308830Z 	panic: Rel: can't make D:\a\neo-go\neo-go\pkg\interop\neogointernal\syscall.go relative to C:\Users\RUNNER~1\AppData\Local\Temp\TestContractInitAndCompile1998984267\001\testcontract
2022-02-09T09:39:31.3309285Z
2022-02-09T09:39:31.3309390Z goroutine 302 [running]:
2022-02-09T09:39:31.3309725Z testing.tRunner.func1.2({0x14dbfe0, 0xc00051bdb0})
2022-02-09T09:39:31.3310187Z 	C:/hostedtoolcache/windows/go/1.17.6/x64/src/testing/testing.go:1209 +0x36c
2022-02-09T09:39:31.3310538Z testing.tRunner.func1()
2022-02-09T09:39:31.3310937Z 	C:/hostedtoolcache/windows/go/1.17.6/x64/src/testing/testing.go:1212 +0x3b6
2022-02-09T09:39:31.3311285Z panic({0x14dbfe0, 0xc00051bdb0})
2022-02-09T09:39:31.3311689Z 	C:/hostedtoolcache/windows/go/1.17.6/x64/src/runtime/panic.go:1047 +0x266
2022-02-09T09:39:31.3312319Z github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).fillDocumentInfo.func1(0xc0002d0b40)
2022-02-09T09:39:31.3312885Z 	D:/a/neo-go/neo-go/pkg/compiler/analysis.go:240 +0x34d
2022-02-09T09:39:31.3313397Z go/token.(*FileSet).Iterate(0xc0000a69c0, 0xc0004898b0)
2022-02-09T09:39:31.3313839Z 	C:/hostedtoolcache/windows/go/1.17.6/x64/src/go/token/position.go:463 +0xde
2022-02-09T09:39:31.3314404Z github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).fillDocumentInfo(0xc0002e4d20)
2022-02-09T09:39:31.3314947Z 	D:/a/neo-go/neo-go/pkg/compiler/analysis.go:236 +0x97
2022-02-09T09:39:31.3315530Z github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile(0xc0002e4d20, 0xc00009a690, 0xc000101540)
2022-02-09T09:39:31.3316064Z 	D:/a/neo-go/neo-go/pkg/compiler/codegen.go:2088 +0x192
2022-02-09T09:39:31.3316563Z github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc00009a690)
2022-02-09T09:39:31.3317066Z 	D:/a/neo-go/neo-go/pkg/compiler/codegen.go:2167 +0x7cd
2022-02-09T09:39:31.3317679Z github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xc0000435e0, 0x62}, {0x0, 0x0}, 0xc0004bcf70)
2022-02-09T09:39:31.3318233Z 	D:/a/neo-go/neo-go/pkg/compiler/compiler.go:225 +0xde
2022-02-09T09:39:31.3318804Z github.com/nspcc-dev/neo-go/pkg/compiler.CompileAndSave({0xc0000435e0, 0x62}, 0xc0004bcf70)
2022-02-09T09:39:31.3319353Z 	D:/a/neo-go/neo-go/pkg/compiler/compiler.go:241 +0x3a5
2022-02-09T09:39:31.3319889Z github.com/nspcc-dev/neo-go/cli/smartcontract.contractCompile(0xc0004e42c0)
2022-02-09T09:39:31.3320456Z 	D:/a/neo-go/neo-go/cli/smartcontract/smart_contract.go:520 +0xc2d
2022-02-09T09:39:31.3320873Z github.com/urfave/cli.HandleAction({0x14b6fa0, 0x17b8d60}, 0x7)
2022-02-09T09:39:31.3321344Z 	C:/Users/runneradmin/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:524 +0xf4
2022-02-09T09:39:31.3321931Z github.com/urfave/cli.Command.Run({{0x16460d2, 0x7}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x166fe9e, 0x27}, {0x0, ...}, ...}, ...)
2022-02-09T09:39:31.3322443Z 	C:/Users/runneradmin/go/pkg/mod/github.com/urfave/cli@v1.22.5/command.go:173 +0xc09
2022-02-09T09:39:31.3322894Z github.com/urfave/cli.(*App).RunAsSubcommand(0xc0000b7340, 0xc0004e4000)
2022-02-09T09:39:31.3323375Z 	C:/Users/runneradmin/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:405 +0x106c
2022-02-09T09:39:31.3323852Z github.com/urfave/cli.Command.startApp({{0x1647536, 0x8}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1671070, 0x28}, {0x0, ...}, ...}, ...)
2022-02-09T09:39:31.3324365Z 	C:/Users/runneradmin/go/pkg/mod/github.com/urfave/cli@v1.22.5/command.go:372 +0x108c
2022-02-09T09:39:31.3324838Z github.com/urfave/cli.Command.Run({{0x1647536, 0x8}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1671070, 0x28}, {0x0, ...}, ...}, ...)
2022-02-09T09:39:31.3325327Z 	C:/Users/runneradmin/go/pkg/mod/github.com/urfave/cli@v1.22.5/command.go:102 +0xe8c
2022-02-09T09:39:31.3325744Z github.com/urfave/cli.(*App).Run(0xc000323880, {0xc0004237a0, 0xb, 0x12})
2022-02-09T09:39:31.3326198Z 	C:/Users/runneradmin/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:277 +0xa8c
2022-02-09T09:39:31.3326770Z github.com/nspcc-dev/neo-go/cli.(*executor).run(0xc0000709c0, {0xc0004237a0, 0xb, 0x12})
2022-02-09T09:39:31.3327275Z 	D:/a/neo-go/neo-go/cli/executor_test.go:273 +0x3a5
2022-02-09T09:39:31.3327812Z github.com/nspcc-dev/neo-go/cli.(*executor).Run(0x14aa020, 0xc000493950, {0xc0004237a0, 0xb, 0x12})
2022-02-09T09:39:31.3328324Z 	D:/a/neo-go/neo-go/cli/executor_test.go:263 +0x10f
2022-02-09T09:39:31.3328844Z github.com/nspcc-dev/neo-go/cli.TestContractInitAndCompile(0xc0001d69c0)
2022-02-09T09:39:31.3329377Z 	D:/a/neo-go/neo-go/cli/contract_test.go:155 +0x147f
2022-02-09T09:39:31.3329694Z testing.tRunner(0xc0001d69c0, 0x17b8be8)
2022-02-09T09:39:31.3330123Z 	C:/hostedtoolcache/windows/go/1.17.6/x64/src/testing/testing.go:1259 +0x230
2022-02-09T09:39:31.3330470Z created by testing.(*T).Run
2022-02-09T09:39:31.3330862Z 	C:/hostedtoolcache/windows/go/1.17.6/x64/src/testing/testing.go:1306 +0x727
2022-02-09T09:39:31.3331325Z FAIL	github.com/nspcc-dev/neo-go/cli	5.552s

```
2022-02-10 18:58:44 +03:00
Anna Shaleva
a9872063fe vm: refactor VM CLI tests as they take too long to pass
These tests are slow on Windows, so refactor them a bit and avoid the following
error:
```
--- FAIL: TestRunWithDifferentArguments (4.01s)
        cli_test.go:96:
                Error Trace:    cli_test.go:96
                                                                                cli_test.go:321
                Error:          command took too long time
                Test:           TestRunWithDifferentArguments
```
2022-02-10 18:04:16 +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
de99c3acdb storage: provide a way to escape from SeekAsync goroutine
A routine blocked on channel send here can't really exit, so avoid goroutine
leak:

goroutine 2813725 [chan send, 6 minutes]:
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync.func1.1(0xc01a7118f7, 0x2, 0x25, 0xc01a7118f9, 0x23, 0x23, 0xc0366c7c01)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:120 +0x86
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek.func2(0xc0079e7920, 0xa, 0x30, 0xc0079e792a, 0x26, 0x26, 0x1)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:183 +0x347
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek(0xc000458480, 0x135c028, 0xc0000445d0, 0xc00f1721d0, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:224 +0x4f4
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).Seek(0xc000458480, 0xc00f1721d0, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, 0xc0357c6620)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:110 +0x8a
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek(0xc0331a4f00, 0x135bff0, 0xc00ae26ec0, 0xc00f1721d0, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:210 +0x379
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync.func1(0xc0331a4f00, 0x135bff0, 0xc00ae26ec0, 0xc00f1721d0, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:119 +0xc5
created by github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:118 +0xc8

goroutine 2822823 [chan send, 6 minutes]:
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync.func1.1(0xc011859b77, 0x3, 0x3, 0xc017bea8d0, 0x26, 0x26, 0xc00f1afc00)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:120 +0x86
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek.func2(0xc011859b60, 0xa, 0xa, 0xc017bea8a0, 0x26, 0x26, 0xc00ad9fb00)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:200 +0x47e
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek.func2(0xc01d5d8c90, 0xa, 0x30, 0xc01d5d8c9a, 0x26, 0x26, 0x1)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:200 +0x47e
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek(0xc035e12900, 0x135c028, 0xc0000445d0, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:224 +0x4f4
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).Seek(0xc035e12900, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, 0xc030c9e0e0)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:110 +0x8a
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek(0xc000458480, 0x135c028, 0xc0000445d0, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:210 +0x379
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).Seek(0xc000458480, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, 0xc030c9e070)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:110 +0x8a
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek(0xc00b340c60, 0x135bff0, 0xc00f1afbc0, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:210 +0x379
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync.func1(0xc00b340c60, 0x135bff0, 0xc00f1afbc0, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:119 +0xc5
created by github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync
        github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:118 +0xc8
...
2022-02-09 00:22:42 +03:00
Roman Khimov
3307292597 storage: rework MemoryStore with a single map
Doesn't affect any benchmarks or tests, but makes things a bit simpler.
2022-02-09 00:22:42 +03:00
Roman Khimov
2bc493a839 mpt: simplify makeStorageKey() interface 2022-02-08 12:38:03 +03:00
Evgeniy Stratonikov
b5afe24090 compiler: properly process defer in conditional statements
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-04 11:04:03 +03:00
Evgeniy Stratonikov
10d006195a vm: properly clear try stack in CALL
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-04 11:04:03 +03:00
Evgeniy Stratonikov
ed43b75631 compiler: do not traverse defer function literals twice
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-02-02 16:52:15 +03:00
Roman Khimov
9719191770
Merge pull request #2342 from nspcc-dev/fix-management-contract-callflags
Fix management contract callflags
2022-02-01 12:30:53 +03:00
Roman Khimov
7945097543 native: fix ContractManagement's call flags for update/deploy
See neo-project/neo#2653.
2022-02-01 12:21:00 +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
Roman Khimov
37ca96c20b interop: use All flags for management deploy and update calls
Unfortunately, tests will fail after this commit, but it needs to be done in
order to update interop dependency afterwards. Fixes #1990.
2022-01-31 22:21:08 +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
Roman Khimov
60d6fa1125 network: keep a copy of the config inside of Server
Avoid copying the configuration again and again, make things a bit more
efficient.
2022-01-24 18:43:01 +03:00
Roman Khimov
6e9d725a29 config: consolidate ProtocolConfiguration consistency checks 2022-01-24 18:42:57 +03:00
Anna Shaleva
9c2e92d7d9 compiler: check overloaded methods for safeness one more time
It's possible that overloaded method is marked as `safe` in manifest, so
that it must have `save` field set to true after its name was
overwritten.
2022-01-21 18:03:04 +03:00
Anna Shaleva
fa1174ec7e smartcontract: adjust NEP11-D standard
Method `ownerOf` returns iterator which should be of the type
InteropInterface.
2022-01-21 18:03:04 +03:00
Evgeniy Stratonikov
ad65d1fa1f compiler: implement custom logic for go1.15
For some reason `foo.go` is interpreted as an http URL, and even if we
replace it with `./foo.go` there is an errors with file missing on disk.
Because `CompileWithOptions` should be able to compile file under any
circumstances, we allocate temporary directory base on version used to
compile a binary.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-21 17:43:28 +03:00
Evgeniy Stratonikov
970769e5b2 compiler: allow to use _ in constants
When `_` is unused it can be omitted from constant values mapping.
Catched when compiling `netmap` contract from nspcc-dev/neofs-contract.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:52:58 +03:00