Commit graph

13 commits

Author SHA1 Message Date
Roman Khimov
094c8474b7 compiler: move tests from vm/tests
These don't belong to VM as they compile some Go code and run it in a VM. One
may call them integration tests, but I prefer to attribute them to
compiler. Moving these tests into pkg/compiler also allows to properly count
the compiler coverage they add:

-ok     github.com/CityOfZion/neo-go/pkg/compiler       (cached)        coverage: 69.7% of statements
+ok     github.com/CityOfZion/neo-go/pkg/compiler       (cached)        coverage: 84.2% of statements

This change also fixes `contant` typo and removes fake packages exposed to the
public by moving foo/bar/foobar into the testdata directory.
2019-12-23 17:05:34 +03:00
Roman Khimov
a7457d08a1 vm/core: add ID support for SYSCALL, redo interop registration
This solves two problems:
 * adds support for shortened SYSCALL form that uses IDs (similar to #434, but
   for NEO 2.0, supporting both forms), which is important for compatibility
   with C# node and mainnet chain that uses it from some height
 * reworks interop plugging to use callbacks rather than appending to the map,
   these map mangling functions are clearly visible in the VM profiling
   statistics and we want spawning a VM to be fast, so it makes sense
   optimizing it. This change moves most of the work to the init() phase
   making VM setup cheaper.

Caveats:
 * InteropNameToID accepts `[]byte` because that's the thing we have in
   SYSCALL processing and that's the most often usecase for it, it leads to
   some conversions in other places but that's acceptable because those are
   either tests or init()
 * three getInterop functions are: `getDefaultVMInterop`, `getSystemInterop`
   and `getNeoInterop`

Our 100K (1.4M->1.5M) block import time improves by ~4% with this change.
2019-12-19 13:35: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
Roman Khimov
3cbb699eb7
Merge pull request #426 from nspcc-dev/logger_247
Change fmt.Println to log, close #247.
2019-10-22 14:41:30 +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
3560ada669 codestyle: use camel case 2019-10-18 18:36:54 +03:00
Roman Khimov
26e3b6abbe vm: extend interops to contain price
The same way C# node does.
2019-10-04 16:13:39 +03:00
Roman Khimov
fabd11699a *: gofmt -s
Appy gofmt for all the source tree.
2019-09-09 12:02:24 +03:00
Roman Khimov
9b421874ae vm: enable assign/binary/numeric/struct tests
These were not used for some reason.
2019-08-20 20:37:06 +03:00
Anthony De Meulemeester
35551282b0
Porting the NEX ICO template to neo-go as first class smart contract example (#78)
* Initial draft of the ICO template ported from NEX.

* filled in token configuration

* added kyc storage prefix

* fixed byte array conversion + added tests

* fixed broken test + made 1 file for the token sale example.

* implemented the NEP5 handlers

* bumped version
2018-05-06 08:03:26 +02: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
Renamed from pkg/vm/test/vm_test.go (Browse further)