Anna Shaleva
18c5f638b9
dao: adjust usages of Internal DB inconsistency
error
2022-04-04 19:16:58 +03:00
Anna Shaleva
2972569a0a
vm: make byte representation of VMState compatible with C#
2022-04-04 13:52:29 +03:00
Anna Shaleva
6343720adf
dao: return ErrKeyNotFound from GetAppExecResults for dummy txs
...
Otherwise decoding error may be returned which can be misleading.
2022-04-04 12:49:52 +03:00
Anna Shaleva
9a41356a3b
core: add getUint256FromItem helper to native ledger
2022-04-04 12:33:29 +03:00
Roman Khimov
2d60d4021b
Merge pull request #2413 from nspcc-dev/smartcontract-big-numbers
...
smartcontract: allow to use `*big.Int` numbers for integers
2022-04-01 10:38:33 +03:00
Roman Khimov
4e375fd8f4
Merge pull request #2414 from nspcc-dev/eliminate-getstorageitems
...
Eliminate GetStorageItems
2022-04-01 09:16:42 +03:00
Evgeniy Stratonikov
739db259e3
smartcontract: remove unused ParameterFromStackItem
...
It is exists from the times we used `smartcontract.Parameter` somewhere
in the `NotificationEvent`/`ApplicationLog`. `stackitem.ToJSON` now
handles this.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:35 +03:00
Evgeniy Stratonikov
fe0cd5fe32
smartcontract: remove EncodeBinary
for Parameter
...
It seems, we don't use it anywhere.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:35 +03:00
Evgeniy Stratonikov
0b0d39f797
smartcontract: allow to use *big.Int
numbers for integers
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:34 +03:00
Roman Khimov
c12a3b71d4
dao: drop GetStorageItems* APIs
...
They're just adding another useless caching layer to the Seek.
2022-03-31 19:18:51 +03:00
Roman Khimov
60375e9db3
core: drop GetStorageItems interface
...
It's not used and not useful.
2022-03-31 16:46:41 +03:00
Roman Khimov
3ab2ab5cba
core: drop outdated comment from storageFind
2022-03-31 16:39:11 +03:00
Anna Shaleva
8965441288
core: rebase core tests onto neotest
2022-03-30 19:00:53 +03:00
Anna Shaleva
35ef58a47e
core: move Oracle response script creation to a separate function
2022-03-30 18:59:43 +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
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
c039133acf
Merge pull request #2408 from nspcc-dev/improve-examples
...
Improve examples&documentation
2022-03-25 18:16:50 +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
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
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
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
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
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
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
Roman Khimov
c2845852ae
Merge pull request #2397 from nspcc-dev/is-script-correct-panic
...
vm: avoid panic in `IsScriptCorrect`
2022-03-18 10:08:39 +03:00
Evgeniy Stratonikov
ef28308dbf
vm: avoid panic in IsScriptCorrect
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-17 20:12:50 +03:00
AnnaShaleva
a4d402da86
compiler: revert a part of ad65d1fa1f
...
Close #2335 .
2022-03-17 19:39:18 +03:00
Anna Shaleva
753d604784
network: use net.ErrClosed to check network connection was closed
...
Close #1765 .
2022-03-17 19:39:18 +03:00
Anna Shaleva
2096ad6e81
*: remove io/ioutil uses
...
Close #1764 .
2022-03-17 19:39:18 +03:00
Roman Khimov
df3eb76aa2
Merge pull request #2396 from nspcc-dev/fuzz-script-panic
...
Return error on negative instruction pointer in `Context.Next`
2022-03-17 19:13:20 +03:00
Evgeniy Stratonikov
492c91b4c5
vm: disallow negative offset in (*Context).Next()
...
Currently the only known reason this can happen is processing
ENDFINALLY opcode before the corresponding ENDTRY.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-03-17 18:52:48 +03:00
Roman Khimov
5cbf28a104
Merge pull request #2372 from nspcc-dev/jsonpath-oom
...
jsonpath: restrict amount of intermediate objects
2022-03-17 12:34:49 +03:00