Commit graph

5747 commits

Author SHA1 Message Date
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
Erik van den Brink
c2f9986714 cli: update generate-wrapper usage text 2022-03-22 15:33:54 +01: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
Roman Khimov
abb19014e1 CHANGELOG: mention Windows! 2022-03-21 16:20:19 +03:00
Roman Khimov
66f5ae8fd9 CHANGELOG: release 0.98.2 2022-03-21 16:07:28 +03:00
Roman Khimov
3e3402e3ea
Merge pull request #2400 from nspcc-dev/revert-callflags
Revert callflags change
2022-03-21 15:25:01 +03:00
Roman Khimov
e312e2640b examples: bump neo-go version for nft-nd-nns 2022-03-21 15:09:57 +03:00
Roman Khimov
25d72db8b0 *: update go.sum/go.mod wrt previous change 2022-03-21 14:39:05 +03:00
Roman Khimov
526c423a61 Revert "interop: use All flags for management deploy and update calls"
This reverts commit 37ca96c20b and a part of
7945097543, we need 0.98.2 release to be
3.1.0-compatible and this one breaks the testnet.
2022-03-21 14:32:11 +03:00
Roman Khimov
ad1dd3ebb7
Merge pull request #2399 from nspcc-dev/fuzz-tests
vm: add some Fuzz tests
2022-03-21 12:00:55 +03:00
Evgeniy Stratonikov
3f65473f64 vm: add some Fuzz tests
Both `IsScriptCorrect` and `VM.Run` should never panic.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-18 16:13:39 +03:00
Roman Khimov
906d99571b
Merge pull request #2369 from nspcc-dev/goshechka
*: go 1.18 support 🎉😍🎊🍰🥂
2022-03-18 15:07:20 +03:00
AnnaShaleva
f6ac8daae6 examples: update neo-go dependency of nft-nd-nns 2022-03-18 13:46:47 +03:00
AnnaShaleva
7a8dc11791 examples: update dependencies version 2022-03-18 13:44:33 +03:00
Roman Khimov
4869049965
Merge pull request #2398 from nspcc-dev/trim-micro
block/dao: simplify trimming, avoid allocations
2022-03-18 12:39:53 +03:00
AnnaShaleva
d2bc4473ce circleci: upgrade golangci linter version
The old one isn't able to properly work with go > 1.15. However, the updated
version doesn't work with go 1.18, see https://github.com/golangci/golangci-lint/issues/2649.
So let's keep go1_17 runner with the latest golangci by now.
2022-03-18 11:09:30 +03:00
Anna Shaleva
e8d15b1b7e workflows: upgrade supported go version 2022-03-18 11:09:30 +03:00
AnnaShaleva
f50815d9b9 circleci: migrate from unsupported base images to the recommended ones
See also https://github.com/CircleCI-Public/cimg-go/issues/158#issuecomment-1060586504 solution.
2022-03-18 11:09:30 +03:00
Anna Shaleva
a137552b16 gomod: upgrade minimum required go version up to 1.16 2022-03-18 11:09:23 +03:00
Roman Khimov
5616585697 block/dao: simplify trimming, avoid allocations
The only user of (*Block).Trim() is in DAO and it already has a nice buffer
usually, so creating another one makes no sense. It also simplifies error
handling a lot.
2022-03-18 10:49:25 +03:00