Commit graph

5427 commits

Author SHA1 Message Date
Anna Shaleva
d73f95e988 cli: do not run test server on windows
Currently we can't properly stop running server on Windows and SIGHUP
is also not supported. This leads to occupied resources and failed
test cleanup:
```
--- FAIL: TestServerStart (0.35s)
    --- FAIL: TestServerStart/good (0.10s)
        testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestServerStart_good337747932\001\neogotestchain\000001.log:
The process cannot access the file because it is being used by another process.
2022-02-08T14:11:20.959+0300    INFO    persisted to disk       {"blocks": 0, "keys": 112, "headerHeight": 0, "blockHeight": 0, "took": "10.0049ms"}
```
2022-02-10 18:04:09 +03:00
Roman Khimov
32a7e97a87
Merge pull request #2351 from nspcc-dev/nep11d-tests
*: add NEP11-D tests and refactor NEP11-related CLI and RPC client commands
2022-02-10 16:00:05 +03:00
Anna Shaleva
8ff7cd865d cli: ensure chain is properly stopped after chain-related commands
Blockchain occupies resources (e.g. it opens log files for DB, etc.)
on creation and running. We need to release these resources if something
goes wrong during execution chain-related commands.

This commit solves the following problem on Windows:
```
--- FAIL: TestServerStart (0.32s)
    --- FAIL: TestServerStart/stateroot_service_is_on_&&_StateRootInHeader=true (0.04s)
        testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestServerStart_stateroot_service_is_on_&&_StateRootInHeader=true460557297\001\neogotestchain\000001.log: The process cannot access the file because it is being used by another process.
    --- FAIL: TestServerStart/invalid_Oracle_config (0.03s)
        testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestServerStart_invalid_Oracle_config810064028\001\neogotestchain\000001.log: The process cannot access the file because it is being used by another process.
    --- FAIL: TestServerStart/invalid_consensus_config (0.04s)
        testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestServerStart_invalid_consensus_config217270091\001\neogotestchain\000001.log: The process cannot access the file because it is being used by another process.
    --- FAIL: TestServerStart/invalid_Notary_config (0.07s)
        --- FAIL: TestServerStart/invalid_Notary_config/malformed_config (0.04s)
            testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestServerStart_invalid_Notary_config_malformed_config754934830\001\neogotestchain\000001.log: The process cannot access the file because it is being used by another process.
        --- FAIL: TestServerStart/invalid_Notary_config/invalid_wallet (0.03s)
            testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestServerStart_invalid_Notary_config_invalid_wallet934249397\001\neogotestchain\000001.log: The process cannot access the file because it is being used by another process.
    --- FAIL: TestServerStart/good (0.11s)
        testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestServerStart_good596150160\001\neogotestchain\000001.log: The process cannot access the file because it is being used by another process.
```

This commit also unifies blockchain and services releasing code.
2022-02-10 10:33:36 +03:00
Anna Shaleva
2736d62d47 cli: ensure opened sinks are properly closed
zap never closes open sinks except its own tests. This behaviour
prevents TestHandleLoggingParams from successful cleanup because
temp log output file can't be closed due to the following error:
```
TempDir RemoveAll cleanup: remove C:\\Users\\Anna\\AppData\\Local\\Temp\\TestHandleLoggingParams_debug5796883
33\\001\\file.log: The process cannot access the file because it is being used by another process.
```

So this tremendous cludge is made mosetly for our testing code.
It is not for concurrent usage (we don't have cases of
multithreaded access to logger output sink).
2022-02-10 10:33:34 +03:00
Anna Shaleva
59fdb69b9a cli: add temp workaround to handle absolute log path for Windows
Fix #2269.
2022-02-10 10:33:10 +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
Anna Shaleva
91350c3a48 internal: fix contract compilation code
Overloads need to be fetched from config.
2022-02-09 11:47:31 +03:00
Anna Shaleva
3c75f047c1 cli: refactor nep11-related commands and add tests
Specify tokenID via hex-encoded string.
2022-02-09 11:47:27 +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
Anna Shaleva
22c39d3916 examples: properly store owner of nft-d token 2022-02-07 11:38:04 +03:00
Roman Khimov
62602af345
Merge pull request #2348 from nspcc-dev/compiler-defer-conditional
compiler: properly process `defer` in conditional statements
2022-02-04 11:16:22 +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
Roman Khimov
01022c78e4
Merge pull request #2346 from nspcc-dev/fix-codecov
codecov: fix coverage reporting
2022-02-03 16:26:22 +03:00
Anna Shaleva
6332d3604f codecov: adjust codecov config and remove CircleCI coverage job
Let's keep the only coverage job, so that CircleCI and GithubAction
coverage do not conflict with each other.

Also, let's do not require all other tests to pass to report the
coverage.
2022-02-03 16:21:15 +03:00
Roman Khimov
693eb595d8
Merge pull request #2345 from nspcc-dev/compiler-defer-duplication
compiler: do not traverse `defer` function literals twice
2022-02-03 10:55:42 +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
8dcfb19a1c
Merge pull request #2341 from nspcc-dev/cli/tests
cli: improve coverage
2022-02-02 14:41:03 +03:00
Anna Shaleva
ba49209d8a cli: use ioutil instead of os to read/write files
Go 1.15 doesn't have os.ReadFile and os.WiteFile.
2022-02-02 13:48:17 +03:00
Anna Shaleva
4ea0aef9d5 github: update coverage job
See https://github.com/codecov/codecov-action#%EF%B8%8F--deprecration-of-v1
2022-02-02 13:48:17 +03:00
Anna Shaleva
47465b8db9 codecov: add configuration file
And allow the Codecov to post results even if some of our jobs or
workflows are failing.
2022-02-02 13:48:17 +03:00
Anna Shaleva
152cebe4e2 cli: add tests for wallet-related commands
Fixes:
  * Return proper exit code on error.
  * Improve error handling.
2022-02-02 13:48:12 +03:00
Anna Shaleva
590f86aa2c cli: add tests for smartcontract-related commands
Fixes:
  * Improve error handling.
2022-02-02 11:28:29 +03:00
Anna Shaleva
b88f2b389f cli: check execution state while saving invoked tx 2022-02-02 11:28:29 +03:00
Anna Shaleva
9de9bcb17c cli: add tests for server commands
Fixes:
  * Proper exit code should be returned on exit for server-related
commands
2022-02-02 11:28:26 +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
Roman Khimov
6042b3dc26 CHANGELOG: fix typo 2022-01-31 19:16:29 +03:00
Roman Khimov
cbb4e51308 CHANGELOG: release 0.98.1 2022-01-31 18:47:58 +03:00
Roman Khimov
75fbb914da
Merge pull request #2338 from nspcc-dev/fix-gomod
Examples go.mod fixes
2022-01-31 18:25:16 +03:00
Roman Khimov
64fb9218dd
Merge pull request #2339 from nspcc-dev/compare-states
scripts: add compare-states, related to #2337
2022-01-31 11:51:43 +03:00
Roman Khimov
d1a9aa1d0d scripts: add compare-states, related to #2337
Allows to quickly find the bad block and compare application
logs. Theoretically could also walk through the MPT to find the difference
there, but it's not needed now.
2022-01-26 10:11:19 +03:00
Roman Khimov
b011af4723 scripts: move compare-dumps into a package of its own
We can't have multiple *.go scripts in one directory anyway without tests
going wild.
2022-01-26 10:11:19 +03:00
Evgeniy Stratonikov
6b152daf7e .github: check dependencies versions
Rebasing or altering commits in other way is a common thing,
so it makes sense to ensure dependencies are also updated.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-25 12:55:39 +03:00
Evgeniy Stratonikov
ec663e5bc6 examples/nft-nd-nns: update go.mod dependencies
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-25 12:42:47 +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
1154eae3cd examples: use proper interop version in go.mod
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-25 12:37:26 +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
Roman Khimov
f9e8dcbed8
Merge pull request #2333 from nspcc-dev/examples/nep11-d
examples: add NEP11 Divisible token example
2022-01-24 13:17:54 +03:00
Anna Shaleva
5561b94698 examples: add an example of NEP11 Divisible token 2022-01-24 13:10:10 +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