Commit graph

5564 commits

Author SHA1 Message Date
Anna Shaleva
35ef58a47e core: move Oracle response script creation to a separate function 2022-03-30 18:59:43 +03:00
Anna Shaleva
35590f0c96 circleci: update cache key to avoid fetching outdated cache
Avoid the following problem:
```
Found a cache from build 55879 at deps-
Size: 178 MiB
Cached paths:
  * /go/pkg/mod

Downloading cache archive...
Validating cache...

Unarchiving cache...

Failed to unarchive cache

Error untarring cache: Error extracting tarball /tmp/cache87609141 : tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download/cloud.google.com: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download/cloud.google.com/go: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download/cloud.google.com/go/@v: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download/cloud.google.com/go/@v/list: Cannot open: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download/cloud.google.com/go/@v/list.lock: Cannot open: No such file or directory tar: go: Cannot mkdir: Pe: exit status 2
```
2022-03-30 12:18:01 +03:00
Anna Shaleva
a4dab3a5ba core: adjust error message of native call 2022-03-30 12:18:01 +03:00
Anna Shaleva
59f3fa1ef1 neotest: adapt framework to work with *testing.B 2022-03-30 12:17:55 +03:00
Anna Shaleva
ff13af804d core: adjust persist-related Blockchain tests
`newTestChain` runs blockchain, so persist is likely already happened
before the first test iteration. Explicit call to persist makes no sence
here.
2022-03-30 11:46:44 +03:00
Anna Shaleva
28e936eb95 core: export GetMaxNotValidBeforeDelta blockchain API
Mostly for tests, but it can also be useful as a separate API.
2022-03-30 11:46:44 +03:00
Anna Shaleva
e0ab4ec6f0 core: adjust helper test contract
Method is allowed to have single return value on stack after its invocation.
Make sure that test contract follows this rule.
2022-03-30 11:46:44 +03:00
Anna Shaleva
9dd43583e0 core: fix helper test contract
Second management helper contract should have valid ABI (at least one method should
be mentioned in the ABI).
2022-03-30 11:46:44 +03:00
Anna Shaleva
13252bb941 core: refactor helper test contracts generation
* Move generator to a separate package.
* Move loader to a separate package and get rid of the code duplications.
2022-03-30 11:46:29 +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
AnnaShaleva
3b45325319 neotest: extend multichain constructor 2022-03-29 15:01:10 +03:00
Anna Shaleva
150041d25e core: unexport native Management's GetMinimumDeploymentFee
This method is used only from Management contract. We also have
neotest-based tests for `getMinimumDeploymentFee`, it should be enough.
2022-03-29 15:01:10 +03:00
Anna Shaleva
bedfd75086 neotest: port fix from 91350c3a48 2022-03-29 15:01:07 +03:00
Roman Khimov
64186d0597
Merge pull request #2410 from nspcc-dev/workflows/check_build_privnet
github: add job to check privnet image build
2022-03-28 15:33:17 +03:00
Anna Shaleva
064f9629b3 docs: specify required Docker version for node image building 2022-03-28 15:15:14 +03:00
Anna Shaleva
b01892613e github: add job to check WSC privnet image build 2022-03-28 15:15:14 +03:00
Anna Shaleva
613f6e4350 Makefile: allow to build privnet image for WSC
1. Build privnet image for WSC.
2. Automatically define OS to build image and privnet image.
3. Unify image building code for Ubuntu and WSC.
2022-03-28 15:15:08 +03:00
Roman Khimov
c039133acf
Merge pull request #2408 from nspcc-dev/improve-examples
Improve examples&documentation
2022-03-25 18:16:50 +03:00
Roman Khimov
fa040c21ba
Merge pull request #2411 from nspcc-dev/cli/improve-query-help
cli: improve help text a bit
2022-03-25 17:54:03 +03:00
Roman Khimov
fe27ae9b96 examples: completely rework runtime example
Make it more useful, triggers are largely obsolete (2.x thing).
2022-03-25 16:47:15 +03:00
Anna Shaleva
a1ed4be223 cli: properly set default timeout for RPC flag
Old help message is misleading a bit:
```
OPTIONS:
   --verbose, -v                   Output full tx info and execution logs
   --rpc-endpoint value, -r value  RPC node address
   --timeout value, -s value       Timeout for the operation (10 seconds by default) (default: 0s)
```

The new one:
```
OPTIONS:
   --verbose, -v                   Output full tx info and execution logs
   --rpc-endpoint value, -r value  RPC node address
   --timeout value, -s value       Timeout for the operation (default: 10s)
```
2022-03-25 16:14:04 +03:00
Anna Shaleva
f2c292e0c7 cli: improve query tx usage text
Note explicitly that transaction hash should be specified, so instead of
an old help text:
```
$ ./bin/neo-go query tx --help
NAME:
   neo-go query tx - Query transaction status

USAGE:
   neo-go query tx [command options] [arguments...]

OPTIONS:
   --verbose, -v                   Output full tx info and execution logs
   --rpc-endpoint value, -r value  RPC node address
   --timeout value, -s value       Timeout for the operation (10 seconds by default) (default: 0s)
```
now we got the more informative one:
```
$ ./bin/neo-go query tx --help
NAME:
   neo-go query tx - Query transaction status

USAGE:
   neo-go query tx <hash> -r endpoint [-v]

OPTIONS:
   --verbose, -v                   Output full tx info and execution logs
   --rpc-endpoint value, -r value  RPC node address
   --timeout value, -s value       Timeout for the operation (10 seconds by default) (default: 0s)
```
2022-03-25 16:13:15 +03:00
Anna Shaleva
be14d8325b github: add job to check Ubuntu privnet image build
Related to
https://github.com/nspcc-dev/neo-go/pull/2408#pullrequestreview-921289314.
2022-03-25 16:09:25 +03:00
Roman Khimov
52893d6a00
Merge pull request #2409 from nspcc-dev/network-message
network: check compressed payload size in `decompress`
2022-03-24 21:22:53 +03:00
Evgeniy Stratonikov
34b1b52784 network: check compressed payload size in decompress
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-24 17:22:55 +03:00
Roman Khimov
be7527409c compiler: fix panic in notification check
Options is a pointer, so it can be nil:

--- FAIL: TestCompiler (0.23s)
    --- FAIL: TestCompiler/TestCompile (0.21s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x960374]

goroutine 8861 [running]:
testing.tRunner.func1.2({0xa604c0, 0x112c230})
        /usr/lib64/go/1.18/src/testing/testing.go:1389 +0x24e
testing.tRunner.func1()
        /usr/lib64/go/1.18/src/testing/testing.go:1392 +0x39f
panic({0xa604c0, 0x112c230})
        /usr/lib64/go/1.18/src/runtime/panic.go:838 +0x207
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).processNotify(0xc0000eba40, 0xc000233ae0?, {0xc00044ae90, 0x1, 0x1})
        /home/rik/dev/neo-go/pkg/compiler/inline.go:134 +0xd4
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).processStdlibCall(0xc0000eba40?, 0xc000233ae0, {0xc00044ae90, 0x1, 0x1})
        /home/rik/dev/neo-go/pkg/compiler/inline.go:124 +0xda
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).inlineCall(0xc0000eba40, 0xc000233ae0, 0xc0001fe5c0)
        /home/rik/dev/neo-go/pkg/compiler/inline.go:35 +0x1fa
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0000eba40, {0xd36bf8?, 0xc0001fe5c0?})
        /home/rik/dev/neo-go/pkg/compiler/codegen.go:932 +0x152c
go/ast.Walk({0xd348e0?, 0xc0000eba40?}, {0xd36bf8?, 0xc0001fe5c0?})
        /usr/lib64/go/1.18/src/go/ast/walk.go:52 +0x62
go/ast.Walk({0xd348e0?, 0xc0000eba40?}, {0xd36db0?, 0xc00044aeb0?})
        /usr/lib64/go/1.18/src/go/ast/walk.go:207 +0x1154
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0000eba40, {0xd36ba8?, 0xc0001cce70?})
        /home/rik/dev/neo-go/pkg/compiler/codegen.go:1155 +0x54cd
go/ast.Walk({0xd348e0?, 0xc0000eba40?}, {0xd36ba8?, 0xc0001cce70?})
        /usr/lib64/go/1.18/src/go/ast/walk.go:52 +0x62
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0000eba40, {0xd36f68?, 0xc0001fe600?})
        /home/rik/dev/neo-go/pkg/compiler/codegen.go:733 +0x2e30
go/ast.Walk({0xd348e0?, 0xc0000eba40?}, {0xd36f68?, 0xc0001fe600?})
        /usr/lib64/go/1.18/src/go/ast/walk.go:52 +0x62
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0000eba40, {0xd36ba8?, 0xc0001ccea0?})
        /home/rik/dev/neo-go/pkg/compiler/codegen.go:1155 +0x54cd
go/ast.Walk({0xd348e0?, 0xc0000eba40?}, {0xd36ba8?, 0xc0001ccea0?})
        /usr/lib64/go/1.18/src/go/ast/walk.go:52 +0x62
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).convertFuncDecl(0xc0000eba40, {0xd36e28, 0xc000256700}, 0xc0001cced0, 0xc00041b68c?)
        /home/rik/dev/neo-go/pkg/compiler/codegen.go:502 +0x97d
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile.func2(0xc000256700, 0xc0001c64b0)
        /home/rik/dev/neo-go/pkg/compiler/codegen.go:2129 +0x1f9
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachFile.func1(0xc000254a00)
        /home/rik/dev/neo-go/pkg/compiler/compiler.go:102 +0x96
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachPackage(0xc0000eba40, 0xc0002f3c68)
        /home/rik/dev/neo-go/pkg/compiler/compiler.go:93 +0xdb
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachFile(0xa1f700?, 0xc000448f90?)
        /home/rik/dev/neo-go/pkg/compiler/compiler.go:99 +0x4d
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile(0xc0000eba40, 0xc00022c390, 0x1?)
        /home/rik/dev/neo-go/pkg/compiler/codegen.go:2116 +0x3d6
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc00022c390)
        /home/rik/dev/neo-go/pkg/compiler/codegen.go:2167 +0x373
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xc000c525a0?, 0x16?}, {0x0?, 0x0?}, 0x0)
        /home/rik/dev/neo-go/pkg/compiler/compiler.go:218 +0x7d
github.com/nspcc-dev/neo-go/pkg/compiler.Compile({0xc000c525a0?, 0xc000304340?}, {0x0?, 0x0?})
        /home/rik/dev/neo-go/pkg/compiler/compiler.go:203 +0x34
github.com/nspcc-dev/neo-go/pkg/compiler_test.compileFile(...)
        /home/rik/dev/neo-go/pkg/compiler/compiler_test.go:89
github.com/nspcc-dev/neo-go/pkg/compiler_test.TestCompiler.func2(0x6a2a89?)
        /home/rik/dev/neo-go/pkg/compiler/compiler_test.go:61 +0x133
testing.tRunner(0xc000304340, 0xc7f5b0)
        /usr/lib64/go/1.18/src/testing/testing.go:1439 +0x102
created by testing.(*T).Run
        /usr/lib64/go/1.18/src/testing/testing.go:1486 +0x35f
2022-03-24 16:34:18 +03:00
Roman Khimov
7fe462a65d neotest/chain: improve comments 2022-03-23 23:11:39 +03:00
Roman Khimov
f6094c8c4e neotest: use public constants for default configuration
And be more consistent about MaxTraceableBlocks use.
2022-03-23 23:11:27 +03:00
Roman Khimov
208e38803c neotest: add some high-level documentation 2022-03-23 22:48:41 +03:00
Roman Khimov
ab6fe44cab examples: add a note on tests for nft-nd-nns 2022-03-23 22:23:58 +03:00
Roman Khimov
2c70f41e51 examples: move nft-nd-nns test into the same package
Which is the way Go tests are normally stored.
2022-03-23 22:21:07 +03:00
Roman Khimov
3070c2e7fc examples: polish iterator
Use read only context where appropriate, shorten notifications, fix comment.
2022-03-23 22:05:40 +03:00
Roman Khimov
1d1b4d4c18 examples: extend iterator with more storage options 2022-03-23 22:04:17 +03:00
Roman Khimov
4c4e9c0371 examples: add something to the storage for iterator example 2022-03-23 22:02:19 +03:00
Roman Khimov
479eda6786 interop: add LICENSE.md into the package
Otherwise pkg.go.dev refuses to display the documentation.
2022-03-23 18:26:02 +03:00
Roman Khimov
68c76a3307 docs: #2293 was fixed some time ago 2022-03-23 18:22:23 +03:00
Roman Khimov
26c3a6c161 examples: drop token-sale contract
It makes zero sense, it's not what it says it
is. AmountPerNEO/MaxExchangeLimitRound are not used at all to affect minting
and allowance/transferFrom features are largely obsolete. We have proper
minting implemented in NFT contracts and there is a nice NEP-17 available
also.
2022-03-23 18:22:16 +03:00
Roman Khimov
a5979f6d64 examples: add defer/recover to OnNEP17Payment handlers
Transaction must be ABORTed, exceptions are not sufficient.
2022-03-23 11:58:07 +03:00
Roman Khimov
e557da70a4
Merge pull request #2404 from nspcc-dev/fix-log-entries-with-user-input
Fix log entries with user input
2022-03-22 17:35:12 +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
Roman Khimov
13999252c6
Merge pull request #2403 from nspcc-dev/extend-publish
github: add ability to manually trigger publishing workflow with `latest` tag
2022-03-21 18:41:43 +03:00
Roman Khimov
7b7c2a2fbd
Merge pull request #2402 from nspcc-dev/revert-revert
Revert callflags revert
2022-03-21 18:38:00 +03:00
AnnaShaleva
f2b160444e github: add ability to manually trigger publishing workflow with latest tag
In case if something goes wrong during release version publishing.
2022-03-21 18:31:38 +03:00
Roman Khimov
0da34967f6 examples: update go.sum/go.mod in nft-nd-nns 2022-03-21 18:22:48 +03:00
Roman Khimov
3b639f518e *: update go.* for the previous change 2022-03-21 17:44:33 +03:00
Roman Khimov
d5a9af5860 Revert "Revert "interop: use All flags for management deploy and update calls""
This reverts commit 526c423a61, heading to 3.2.0.
2022-03-21 17:41:37 +03:00
Roman Khimov
694152098f
Merge pull request #2401 from nspcc-dev/fix-workflows
github: adjust Docker image publishing workflows
2022-03-21 16:51:29 +03:00
AnnaShaleva
d416ae336f github: adjust Docker image publishing workflows 2022-03-21 16:39:27 +03:00