Roman Khimov
cdc2a762a1
Merge pull request #2646 from nspcc-dev/more-native-contract-rpc-wrappers
...
More native contract RPC wrappers
2022-08-17 12:40:17 +03:00
Roman Khimov
0dbe8b6ce2
rpcclient: add oracle package for OracleContract
2022-08-17 11:42:20 +03:00
Roman Khimov
5c8f3a99dc
rpcclient: add management wrapper for ContractManagement
2022-08-17 11:42:20 +03:00
Roman Khimov
ab577da2b5
Merge pull request #2645 from nspcc-dev/fix-vm-cli-panic
...
compiler: avoid panic on empty package list
2022-08-17 11:37:38 +03:00
Anna Shaleva
0bca027f99
compiler: avoid panic on empty package list
...
An attempt to compile unexisting file via neo-go-vm CLI leads to the following
panic:
```
NEO-GO-VM > loadgo ./1-print.go
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc000047300)
github.com/nspcc-dev/neo-go/pkg/compiler/codegen.go:2188 +0x60c
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xc000047300, 0xf66c92}, {0x0, 0x0}, 0xc0003a0000)
github.com/nspcc-dev/neo-go/pkg/compiler/compiler.go:218 +0x65
github.com/nspcc-dev/neo-go/pkg/vm/cli.handleLoadGo(0xc0000f5340)
github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:480 +0x1a5
github.com/urfave/cli.HandleAction({0xde74a0, 0x10d61d0}, 0x6)
github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xf632f0, 0x6}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xf9915b, 0x38}, {0xf6a57b, ...}, ...}, ...)
github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0002c2000, {0xc00036c330, 0x3, 0x3})
github.com/urfave/cli@v1.22.5/app.go:277 +0x705
github.com/nspcc-dev/neo-go/pkg/vm/cli.(*VMCLI).Run(0xc000290890)
github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:694 +0x317
github.com/nspcc-dev/neo-go/cli/vm.startVMPrompt(0xc0001b9e40)
github.com/nspcc-dev/neo-go/cli/vm/vm.go:29 +0x92
github.com/urfave/cli.HandleAction({0xde74a0, 0x10d5d10}, 0x2)
github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xf60a2f, 0x2}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xf7880b, 0x19}, {0x0, ...}, ...}, ...)
github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0001c8fc0, {0xc000116020, 0x2, 0x2})
github.com/urfave/cli@v1.22.5/app.go:277 +0x705
main.main()
./main.go:21 +0x33
```
2022-08-17 11:29:28 +03:00
Roman Khimov
f7c5ab4f43
state: check for array length in (*Contract).FromStackItem
...
Panicing here is not appropriate.
2022-08-16 17:19:47 +03:00
Anna Shaleva
07ee7f7e12
compiler: allow multi-return variables declaration
...
Problem: an attempt to compile the following code leads to a runtime
panic:
```
package foo
var a, b = f()
func Main() int {
return a + b
}
func f() (int, int) {
return 1, 2
}
```
```
panic: runtime error: index out of range [1] with length 1 [recovered]
panic: runtime error: index out of range [1] with length 1
goroutine 22 [running]:
testing.tRunner.func1.2({0xa341c0, 0xc0001647f8})
/usr/local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1212 +0x218
panic({0xa341c0, 0xc0001647f8})
/usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).Visit(0xc0001623c0, {0xc75520, 0xc000155d80})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:591 +0x6559
go/ast.Walk({0xc6c4e0, 0xc0001623c0}, {0xc75520, 0xc000155d80})
/usr/local/go/src/go/ast/walk.go:50 +0x5f
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).convertGlobals.func1({0xc75520, 0xc000155d80})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:359 +0x70
go/ast.inspector.Visit(0xc000229740, {0xc75520, 0xc000155d80})
/usr/local/go/src/go/ast/walk.go:375 +0x31
go/ast.Walk({0xc6d920, 0xc000229740}, {0xc75520, 0xc000155d80})
/usr/local/go/src/go/ast/walk.go:50 +0x5f
go/ast.walkDeclList({0xc6d920, 0xc000229740}, {0xc000155e80, 0x3, 0x120})
/usr/local/go/src/go/ast/walk.go:36 +0x87
go/ast.Walk({0xc6d920, 0xc000229740}, {0xc75458, 0xc000156c80})
/usr/local/go/src/go/ast/walk.go:355 +0x15c5
go/ast.Inspect(...)
/usr/local/go/src/go/ast/walk.go:387
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).convertGlobals(0xc0001623c0, 0xc000156c80, 0xc000254280)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:354 +0x71
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).traverseGlobals.func2(0xc000254280)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/analysis.go:86 +0x16e
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).ForEachPackage(0xc0001623c0, 0xc000191b98)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:93 +0xc6
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).traverseGlobals(0xc0001623c0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/analysis.go:82 +0x22c
github.com/nspcc-dev/neo-go/pkg/compiler.(*codegen).compile(0xc0001623c0, 0xc000274d20, 0x1)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2118 +0x17c
github.com/nspcc-dev/neo-go/pkg/compiler.codeGen(0xc000274d20)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/codegen.go:2191 +0x353
github.com/nspcc-dev/neo-go/pkg/compiler.CompileWithOptions({0xa6f39a, 0xc00023cee0}, {0xc6d240, 0xc00024a460}, 0x0)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/compiler.go:218 +0x65
github.com/nspcc-dev/neo-go/pkg/compiler_test.vmAndCompileInterop(0x5648df, {0xa9989f, 0x7d})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/vm_test.go:75 +0x113
github.com/nspcc-dev/neo-go/pkg/compiler_test.eval(0xc00024a440, {0xa9989f, 0x129f366e}, {0xa68880, 0xc00024a440})
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/vm_test.go:36 +0x2d
github.com/nspcc-dev/neo-go/pkg/compiler_test.TestGenDeclWithMultiRet.func2(0x4079f9)
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/compiler/global_test.go:36 +0x4f
testing.tRunner(0xc00022e9c0, 0xbce760)
/usr/local/go/src/testing/testing.go:1259 +0x102
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:1306 +0x35a
```
Solution:
Allow using multi-return function calls as general variable declaration
value. It was supported for assignment statements, so do the same for
*ast.GenDecl if it's a variable under the hood.
2022-08-16 15:33:44 +03:00
Roman Khimov
f8857c5ebe
Merge pull request #2643 from nspcc-dev/policy-contract-rpc-wrapper
...
Policy/GAS/Designation contracts RPC wrappers
2022-08-16 13:08:34 +03:00
Roman Khimov
5d5455312a
rpcclient: add policy package for the PolicyContract contract
...
And test it with the RPC server.
Notice that getters still return int64 instead of *big.Int, that's because
these values are very limited and technically could even fit into an int (but
that seems to be too dangerous to use for long-term compatibility).
2022-08-16 12:43:25 +03:00
Roman Khimov
ee72b2fa29
rpcclient: add gas package for the GAS contract
...
Test it with the RPC server.
2022-08-16 12:43:25 +03:00
Roman Khimov
ee84a4ab32
rpcclient: add rolemgmt pkg for RoleManagement contract
...
And test it with RPC server.
2022-08-16 12:43:25 +03:00
Roman Khimov
a1a5db8fcd
state: add more convenient method to get native contract hashes
2022-08-15 10:54:29 +03:00
Roman Khimov
bc9b5d6976
ROADMAP: update wrt 0.99.2 release
2022-08-12 19:11:23 +03:00
Roman Khimov
10b3c5d157
CHANGELOG: release 0.99.2
2022-08-12 18:48:02 +03:00
Roman Khimov
db12341755
Merge pull request #2642 from nspcc-dev/rpcclient-nep17
...
NEP-17 RPC client
2022-08-12 18:27:51 +03:00
Roman Khimov
c967005216
rpcclient: add deprecation notices
...
And fix test code using old APIs to pass linter checks.
2022-08-12 18:21:02 +03:00
Roman Khimov
be74cc6b55
cli: use nep17 wrapper to implement commands
2022-08-12 18:21:02 +03:00
Roman Khimov
309358c85b
rpcclient: add new NEP-17 wrapper
2022-08-12 18:21:02 +03:00
Roman Khimov
aa80416632
Merge pull request #2640 from nspcc-dev/fix-state-diff
...
core: fix native Management's hasMethod signature
2022-08-12 12:02:13 +03:00
Anna Shaleva
94e84f0364
core: fix native Management's hasMethod signature
...
Affects states, see
28ab45a6ec/src/Neo/SmartContract/Native/ContractManagement.cs (L155)
.
2022-08-11 16:10:01 +03:00
Roman Khimov
509cdec981
Merge pull request #2639 from nspcc-dev/oracle-fix
...
Oracle fix
2022-08-11 10:02:02 +03:00
Roman Khimov
bf094dffbb
Merge pull request #2638 from nspcc-dev/rpc-unwrap
...
rpcclient: move result processing code into unwrap package
2022-08-10 19:04:04 +03:00
Roman Khimov
bc3bffea53
native: fix oracle.finish reentrancy bug
...
See neo-project/neo#2795 .
2022-08-10 19:02:36 +03:00
Roman Khimov
8d170a1eb8
native: add Oracle.finish reentrancy test
2022-08-10 19:02:36 +03:00
Roman Khimov
da2db74bc9
contracts: decipher oracle test contract
...
Make it a proper Go contract, opcodes are fun until you want to change
something in them. Part of #2412 .
2022-08-10 19:02:36 +03:00
Roman Khimov
5cd3b0c923
Merge pull request #2637 from nspcc-dev/cli-use-actor-more
...
Use Actor more in the CLI
2022-08-10 18:26:18 +03:00
Roman Khimov
f155a7f161
rpcclient: move result processing code into unwrap package
...
Which will be reused by upper-layer packages. It can be extended with more
types in future.
2022-08-09 17:38:47 +03:00
Roman Khimov
7c266fc9bf
cli/wallet: use Actor for voting commands
2022-08-09 17:28:46 +03:00
Roman Khimov
e98ac8bc53
cli: rework registration commands with Actor
...
And reduce the amount of wasted GAS.
2022-08-09 17:28:45 +03:00
Roman Khimov
593fa4cac8
Merge pull request #2632 from nspcc-dev/rpcclient-actor
...
RPC client Actor interface
2022-08-09 17:21:24 +03:00
Roman Khimov
f3d7656b44
Merge pull request #2634 from nspcc-dev/go-1-19-upd
...
*: go 1.19 support
2022-08-09 16:33:08 +03:00
Anna Shaleva
c3670fecc5
github: update linter job
...
Use the latest linter action and explicitly setup go version.
2022-08-09 15:47:18 +03:00
Anna Shaleva
d20d293f84
examples: update neo-go dependency
2022-08-09 15:47:04 +03:00
Anna Shaleva
119b40c378
*: update interop deps
2022-08-09 15:40:15 +03:00
Anna Shaleva
3094d3e0c1
*: update prometheus client library
2022-08-09 15:37:59 +03:00
Anna Shaleva
fc3aa7f181
ci: update workflows' go version
2022-08-09 15:37:59 +03:00
Anna Shaleva
16458dd934
*: remove travis config file
...
We don't use travis anymore, we have GA and CircleCI instead.
2022-08-09 15:37:59 +03:00
Anna Shaleva
916f2293b8
*: apply go 1.19 formatter heuristics
...
And make manual corrections where needed. See the "Common mistakes
and pitfalls" section of https://tip.golang.org/doc/comment .
2022-08-09 15:37:52 +03:00
Roman Khimov
ff72ed5715
actor: take ValidatorsHistory into account for CalculateValidUntilBlock
...
Which makes permanent result.Version caching safe for all cases.
2022-08-09 15:36:40 +03:00
Roman Khimov
95b72db707
rpcsrv: return more configuration data to the client
...
These are extensions, but they're important for the client to make various
decisions.
2022-08-09 15:36:40 +03:00
Roman Khimov
5194b34a93
Merge pull request #2633 from nspcc-dev/fix-wallet-version
...
Fix wallet version
2022-08-08 17:00:04 +03:00
Anna Shaleva
bb751535d3
*: bump minimum supported go version
...
Close #2497 .
2022-08-08 13:59:32 +03:00
Roman Khimov
afef8b85d9
rpcclient: add deprecation warnings
2022-08-08 09:51:51 +03:00
Roman Khimov
260bcc0f49
wallet: fix wallet version to conform to NEP-6
...
See neo-project/neo#2390 . Can't see it there? No wonder, that's why we have
this bug for a year and a half. Not critical, we don't care about versions,
but _very_ annoying.
2022-08-07 22:41:40 +03:00
Roman Khimov
d9feec2be5
cli: use MVUBI for saved transactions
...
And DO NOT CHANGE TX in paramcontext InitAndSave, because it's really
unobvious and must not be done this way.
2022-08-07 22:33:57 +03:00
Roman Khimov
ba2e7063dd
cli: compensate VUB for prompt waiting time
...
We also have now ways to change it with actor package, so technically this
fixes #2618 .
2022-08-07 22:33:57 +03:00
Roman Khimov
7132b38425
cli: use actor.Actor for smart contract invocations
...
That's a proof of the concept mostly since it doesn't change much in this
particular case.
2022-08-07 22:33:56 +03:00
Roman Khimov
f369c2a359
wallet: allow pre-filled contract-based scripts in SignTx
...
They're allowed already for regular accounts (see below), but parameterless
accounts always add a script which is wrong.
2022-08-07 22:33:56 +03:00
Roman Khimov
8385efe4b3
cli: simplify and fix invokeWithArgs logic
...
Saving into a file can't be successful without signAndPush flag (wallet
present). This situation can't happen in CLI invocations since
testinvokefunction doesn't have `--out` flag, but still it's a logic
error. Everything else can be simplified a bit taking that into account.
2022-08-07 22:33:56 +03:00
Roman Khimov
aa2dbe9caf
smartcontract: accept Parameter in NewParameterFromValue
...
While it makes little sense, there can be a situation where this function will
get predefined Parameters in some way.
2022-08-07 22:33:56 +03:00