Anna Shaleva
3b04b6d238
vm: refactor stack dump commands
2021-09-09 13:45:10 +03:00
Anna Shaleva
6da458365d
vm CLI: allow to dump slots
2021-09-09 13:45:10 +03:00
Anna Shaleva
913e3878c5
vm CLI: check whether VM is ready before jumping to the instruction
...
It allows to avoid panic:
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xdab469]
goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/vm.(*VM).Jump(...)
github.com/nspcc-dev/neo-go/pkg/vm/vm.go:1506
github.com/nspcc-dev/neo-go/pkg/vm/cli.handleRun(0xc0005988f0)
github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:413 +0x2e9
github.com/abiosoft/ishell/v2.(*Shell).handleCommand(0xc0004320f0, {0xc00032c7c0, 0xc0002a3920, 0x0})
github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:279 +0x143
github.com/abiosoft/ishell/v2.handleInput(0xc0004320f0, {0xc00032c7c0, 0x3, 0x4})
github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:233 +0x31
github.com/abiosoft/ishell/v2.(*Shell).run(0xc0004320f0)
github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:212 +0x30f
github.com/abiosoft/ishell/v2.(*Shell).Run(0xc0004320f0)
github.com/abiosoft/ishell/v2@v2.0.2/ishell.go:112 +0x28
github.com/nspcc-dev/neo-go/pkg/vm/cli.(*VMCLI).Run(0xc000224030)
github.com/nspcc-dev/neo-go/pkg/vm/cli/cli.go:538 +0x39
github.com/nspcc-dev/neo-go/cli/vm.startVMPrompt(0xc0001f46e0)
github.com/nspcc-dev/neo-go/cli/vm/vm.go:28 +0xb4
github.com/urfave/cli.HandleAction({0xe65fa0, 0x1161c68}, 0x2)
github.com/urfave/cli@v1.22.5/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0xfed435, 0x2}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x100576d, 0x19}, {0x0, ...}, ...}, ...)
github.com/urfave/cli@v1.22.5/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0001016c0, {0xc0000c6000, 0x2, 0x2})
github.com/urfave/cli@v1.22.5/app.go:277 +0x705
main.main()
./main.go:19 +0x33
```
2021-09-08 17:53:09 +03:00
Anna Shaleva
cbc75afd4d
docs: refactor documentation
...
CLI:
* Typos are fixed
* Documentation on NEP-11 tokens is added
* NeoGo node configuration is moved to a separate file
Compiler:
* Typos and indentations are fixed
* Ops dump example is updated
Consensus:
* Typos are fixed
* Links are fixed
Notifications:
* Minor adjustments
RPC:
* `getversion` response is updated
* `getunclamedgas` comment is removed (not valid since
https://github.com/neo-project/neo-modules/pull/243 )
VM:
* Update help message
* `load*` command adjustments
* `astack` command removal
2021-09-08 17:52:46 +03:00
Evgeniy Stratonikov
e2910a7cb4
vm/cli: add public key -> address conversion, fix #2121
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-08-13 10:43:49 +03:00
Roman Khimov
ede410a4a7
go.mod: update ishell package
...
It only adds go.mod and changes import path, that's it.
2021-07-21 23:28:26 +03:00
Roman Khimov
100e97d772
util: move ArrayReverse into package of its own
...
Leave just uint160 and uint256 types in util.
2021-07-19 22:57:55 +03:00
Anna Shaleva
e3611bfa4c
vm, cli: allow to specify flags while loading VM
2021-05-28 12:07:41 +03:00
Roman Khimov
7af67d2a3c
vm/cli: simplify buffer-related code
...
gosimple: S1030: should use buf.String() instead of string(buf.Bytes())
2021-05-12 18:42:50 +03:00
Evgeniy Stratonikov
73f888f02e
core: allow to overload contract methods
...
Multiple methods with different parameter count can co-exist.
2021-01-27 12:51:07 +03:00
Evgenii Stratonikov
1d4d93b3eb
vmcli: use manifest for method execution
2021-01-11 10:45:42 +03:00
Evgenii Stratonikov
33f13ab1c0
vmcli: add tests
2020-12-02 10:49:37 +03:00
Evgenii Stratonikov
f8728e4f44
vmcli: unify error messages
2020-12-02 10:49:37 +03:00
Evgenii Stratonikov
bea5125d42
vmcli: return after error in break
2020-12-02 10:49:37 +03:00
Evgenii Stratonikov
d7ffa89811
vmcli: set breakpoint before the instruction
...
Breakpoint should occur before actual instruction execution.
2020-12-02 10:49:37 +03:00
Evgenii Stratonikov
2f39701d76
vm: provide writer in PrintOps()
...
Make it more flexible and testable. Fallback to using
stdout if no writer is provided.
2020-12-02 10:49:37 +03:00
Evgenii Stratonikov
681e81420a
vm: make (*Context).IP() return instruction pointer
...
It is misleading to return +1 in code, and user representation
can always be altered.
2020-08-21 08:44:32 +03:00
Evgenii Stratonikov
a34ba92d46
compiler: allow to split main package across multiple files
2020-08-11 11:12:55 +03:00
Evgenii Stratonikov
057e1c6e3c
compiler: provide filename to Compile()
2020-08-11 11:10:45 +03:00
Roman Khimov
0e2784cd2c
always wrap errors when creating new ones with fmt.Errorf()
...
It doesn't really change anything in most of the cases, but it's a useful
habit anyway.
Fix #350 .
2020-08-07 12:21:52 +03:00
Evgenii Stratonikov
7e3813a88f
cli: use TAB as delimiter in vm parse
...
Make it simpler to use result in pipes:
neo-go vm parse 123 | rg "Integer to Hex" | cut -f1- | sed -r 's/\t//g'
2020-08-05 09:40:50 +03:00
Evgenii Stratonikov
227c6a2caa
cli: allow to use vm parse
directly
2020-08-05 09:40:50 +03:00
Evgenii Stratonikov
5fe8095cee
vmcli: implement parse command
...
Implement parse command for converting arbitrary values to other
formats. It supports Integer, String, Hex, Base64 and
Address representations.
2020-07-27 13:05:37 +03:00
Evgenii Stratonikov
b3e166aeff
vmcli: remove unused method
2020-07-27 13:04:52 +03:00
Anna Shaleva
1c1818d97e
vm: fix typoes in cli
package
2020-06-29 09:15:29 +03:00
Anna Shaleva
b387deaa05
vm: switch from .avm to .nef
2020-06-29 09:15:29 +03:00
Roman Khimov
32b0936499
vm/cli: improve loadhex example
...
It was using Neo 2 opcodes.
2020-06-25 18:33:46 +03:00
Roman Khimov
003daf37cf
vm/cli: add parameter checks for load* commands
...
Prevent failing like this:
NEO-GO-VM > loadhex
panic: runtime error: index out of range
...
2020-06-25 18:33:46 +03:00
Roman Khimov
5d63ff100e
vm/cli: add support for loadbase64 command
...
Neo3 outputs scripts in base64 for transactions and contracts, to quickly
parse them add a special `loadbase64` command.
2020-06-25 18:33:46 +03:00
Anna Shaleva
783f5ecb01
vm: move StackItem to a separate package
...
closes #912
2020-06-08 13:27:08 +03:00
Evgenii Stratonikov
3831aec53f
vm: make NewBigInteger accept *big.Int
...
It creates big.Int internally anyway, so this is the most flexible way.
2020-04-16 15:54:58 +03:00
Evgenii Stratonikov
dc8fb13021
vm: make NewBigInteger accept int64
...
It is more correct upconvert to int64 if needed,
so precision is never lost.
2020-03-24 11:10:56 +03:00
Roman Khimov
e41d434a49
*: move all packages from CityOfZion to nspcc-dev
2020-03-03 17:21:42 +03:00
Roman Khimov
852e6a335b
compiler: move it up from vm
...
It really deserves it, I think. Especially given that it doesn't have any
direct usage of `vm` package now.
2019-12-03 18:23:46 +03:00
Roman Khimov
579aa31ddd
compiler: drop useless options parameter to Compile()
...
It's not used in any way there.
2019-10-29 13:02:54 +03:00
Vsevolod Brekelov
e2bfff8666
vm: removed mute mode and pushed logging to upper lvl
...
VM should be responsible for code execution and in case anyone interested in additional logging or errors they could handle them like we do it iin cli.
2019-10-22 13:44:14 +03:00
Vsevolod Brekelov
0daef50b9d
cli: fix for error wrapping
2019-10-17 18:23:49 +03:00
Vsevolod Brekelov
5b81110d16
cli: print logo via shell
2019-10-17 18:23:49 +03:00
Vsevolod Brekelov
5109b2e3e7
vm: fix cli comment
2019-10-14 18:38:05 +03:00
Vsevolod Brekelov
591d5eafbe
vm: add stepInto,stepOver,stepOut
...
Original C# vm debugger behavior
2019-10-14 18:37:11 +03:00
Roman Khimov
392a4c4f39
vm/cli: add some convenience heuristic to ease 'run' use
2019-09-10 23:31:06 +03:00
Roman Khimov
c5911c2f10
vm/cli: add support for bool type as 'run' parameter
2019-09-10 23:31:06 +03:00
Roman Khimov
982bdcd704
vm/cli: make operation mandatory if anything added to run
...
Matches neo-cli behavior.
2019-09-10 23:31:06 +03:00
Roman Khimov
e872b6b421
vm/cli: redo the whole thing using abiosoft/ishell
...
Adds history support, better editing and way better help system. Expand on
some helps while at it.
2019-09-10 23:31:06 +03:00
Roman Khimov
42dfca47cf
vm: fix double VM run from CLI
...
Fixes one more instruction being ran when VM FAULTs:
NEO-GO-VM > run
NEO-GO-VM > error encountered at instruction 6 (ROLL)
NEO-GO-VM > runtime error: invalid memory address or nil pointer dereference
FAULT
NEO-GO-VM > error encountered at instruction 7 (SETITEM)
NEO-GO-VM > interface conversion: interface {} is []vm.StackItem, not []uint8
Refs. #96 .
2019-08-31 09:06:56 +03:00
Evgeniy Kulikov
67cbcac643
Fix typos ( #133 )
...
* Fix typos
* revert chains/unit_testnet
* revert chains
* fix review comments (thx @AlexVanin )
2019-02-13 18:01:10 +00:00
Evgeniy Kulikov
630919bf7d
Fix typos and warnings for GoReport / GolangCiLinter ( #132 )
...
- typos
- gofmt -s
- govet warnings
- golangci-lint run
2019-02-09 16:53:58 +01:00
Evgeniy Kulikov
f000b76879
[FIX] Formatting and code-style ( #118 )
...
* [FIX] Formatting and code-style
- gofmt
- import resort
- prealloc slices
- simplify code
* fix vet
2019-01-25 12:20:35 +01:00
Anthony De Meulemeester
4bd5b2812e
Optimisations and API changes for smart contracts ( #67 )
...
* support VM to pass method and arguments to a script.
* added support for type assertions in smartcontracts.
* added native vm support for print.
* moved VM API packages to vm -> API
* reverted the native Print opcode in favor of runtime.Log
* added support for registering custom interop hooks in the VM.
* Updated README
* Updated compiler with @OPTIMIZE tags
* Moved more tests to VM package.
* optimized and refactored compiler and vm API
* updated README with new smartcontract apis
* bumped version
2018-04-10 11:45:31 +02:00
Anthony De Meulemeester
941bd7e728
VM and compiler update ( #63 )
...
* renamed test folders and fixed bug where wrong jump labels would be exectuted for rewrite.
* Added support for Osize (len(string)) and factored out the array tests
* Added current instruction number to VM prompt if program is loaded.
* added support for unary expressions.
* updated README of and sorted the help commands
* updated readme of the compiler
* bumped version -> 0.39.0
2018-04-04 21:41:19 +02:00