Commit graph

2159 commits

Author SHA1 Message Date
Roman Khimov
8ff9121ee5 circleci: update config to include cli and docker builds
Merges old config into the new one, closes #306.
2019-08-21 19:12:13 +03:00
Roman Khimov
18d971440b vm: expand binary expr tests with cases from #294
Make a full set of numeric/string comparisons with `==` and `!=` being
evaluated to true and false.
2019-08-20 20:43:43 +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
Roman Khimov
0309cff5a2 vm: implement EQUAL via reflection
Fixes failing tests.
2019-08-20 19:46:52 +03:00
Roman Khimov
d26be7dcc1 docs: drop contribution.md from dev
I don't think it adds anything useful over the existing top-level
CONTRIBUTING.md.
2019-08-20 19:09:17 +03:00
Roman Khimov
4e077838a2 CONTRIBUTING: adapt to new reality a bit
See #298 for example.
2019-08-20 19:07:58 +03:00
Roman Khimov
e3e731fe47 LICENSE.md: rename from LICENCE.md
Fix obvious typo.
2019-08-20 18:47:08 +03:00
Roman Khimov
e0fbf59875 Gopkg*: drop obsolete packaging things
We're using modules now.
2019-08-20 18:46:59 +03:00
Roman Khimov
c7bb464b92 main.go: drop it, useless in master branch
Brought by the `dev` merge originally.
2019-08-20 18:45:25 +03:00
Roman Khimov
beec8f114a Merge branch 'dev-prepared-for-master' into mastev
See #283 for details. This just makes the `dev` code available in the `master`
branch without any attempt to make it really do something.
2019-08-20 18:44:09 +03:00
Roman Khimov
ddd1d92ff1 pkg: hide it by moving to _pkg.dev
The idea here is to preserve the history of `dev` branch development and its
code when merging with the `master`. Later this code could be moved into the
masters code where appropriate.
2019-08-20 18:39:50 +03:00
Roman Khimov
bb2568cc53
Merge pull request #301 from nspcc-dev/fix-sigsegv-on-failed-bind
connmgr: correctly pass binding error to the server
2019-08-19 20:22:55 +03:00
Roman Khimov
5bab4b8bb1
Merge pull request #300 from nspcc-dev/equal-numequal-fix-294
compiler: fix string/numbers equality/inequality gen again

Closes: #294.
2019-08-19 20:22:22 +03:00
Roman Khimov
4ccda04eea compiler: fix string/numbers equality/inequality gen again
Unfortunately d58fbe0c88 didn't really fix the
problem because tinfo.Type (the expression resulting type) actually is a bool
and we need to check its parameters. Also, there is need to fix the NEQ
operation.
2019-08-19 19:18:17 +03:00
Roman Khimov
9a30f2fbcc connmgr: correctly pass binding error to the server
And make the node fail gracefully if it's unable to bind. Before this commit:
-----
Server is starting up
Connection manager started
Error connecting to outbound  listen tcp 127.0.0.1:20332: bind: address already in use
We have connected successfully to:  127.0.0.1:20334
panic: runtime error: invalid memory address or nil pointer dereference
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x6bbfa2]

goroutine 12 [running]:
github.com/CityOfZion/neo-go/pkg/connmgr.New.func1.1(0x0, 0x0)
        /home/rik/dev/neo-go/pkg/connmgr/connmgr.go:47 +0x22
panic(0x718980, 0xa22f70)
        /usr/lib64/go/1.12/src/runtime/panic.go:522 +0x1b5
github.com/CityOfZion/neo-go/pkg/connmgr.New.func1(0xc000013430, 0xc000013450, 0xc000013440, 0xc0005265f0, 0xf, 0x0)
        /home/rik/dev/neo-go/pkg/connmgr/connmgr.go:52 +0x15e
created by github.com/CityOfZion/neo-go/pkg/connmgr.New
        /home/rik/dev/neo-go/pkg/connmgr/connmgr.go:38 +0xfe
exit status 2
-----

After this commit:
-----
listen tcp 127.0.0.1:20332: bind: address already in use
-----
2019-08-19 15:31:22 +03:00
Roman Khimov
0574bcf1fe
Merge pull request #292 from nspcc-dev/neo-storm-chpicks
Cherry-picks from neo-storm. Closes #290.
2019-08-16 19:23:56 +03:00
Roman Khimov
399c5781a1
Merge pull request #298 from nspcc-dev/fix/294
Closes #294.
2019-08-16 17:04:09 +03:00
Evgenii
d58fbe0c88 compiler: use separate opcodes for string and number equality 2019-08-16 16:56:09 +03:00
Roman Khimov
1e09037902 pkg/vm/compiler: update README
s/opdump/inspect/ and new sample output.
2019-08-15 19:53:21 +03:00
Roman Khimov
57c7df4dff *: remove remaining references to neo-storm, update README
README update partially reverts c8d7671d26 and
updates it with current commands and sample output.
2019-08-15 19:51:07 +03:00
Roman Khimov
a1e3655560 interop: move into pkg/interop, replace pkg/vm/api
neo-storm has developed more wrappers for syscall APIs, so they can and should
be used as a drop-in replacement for pkg/vm/api. Moving it out of vm, as it's
not exactly related to the VM itself.
2019-08-15 19:41:51 +03:00
Roman Khimov
7cd91610df compiler: quick and dirty inspection fix for JMP instrs
These were interpreted completely wrong, they actually have two next bytes
indicating an offset. This patch is a quick fix, actually more work is needed
here to properly display various instructions.
2019-08-15 18:26:52 +03:00
Roman Khimov
1a4055a962 compiler: fix codegen for OR, fixes failing TestLOR
0880e88fa5 breaks it by introducing a new label
that is not counted here.
2019-08-15 18:25:22 +03:00
Roman Khimov
810f096811 compiler: change codegen to emit NUMEQUAL instead of EQUAL
This is wrong, see issue #294, but it makes our VM tests work (as VM is
missing EQUAL implementation), so until #294 is properly resolved we're better
have this kind of wrong code generation.
2019-08-15 18:22:56 +03:00
Roman Khimov
01330e7ed7 cli: add error return check for compiler.CompileAndInspect()
GolangCI complains:
  Error return value of compiler.CompileAndInspect is not checked (from errcheck)
2019-08-14 20:29:32 +03:00
Evgenii
2daebdfce2 compiler: convert unary operators properly
Imported from CityOfZion/neo-storm#62 PR.
2019-08-14 20:08:17 +03:00
Evgenii
05c07a8567 compiler: fix argument handling for function arity >= 3
Imported from CityOfZion/neo-storm#61 PR.
2019-08-14 20:08:14 +03:00
Evgenii
5ba835d25b compiler: process packages in deterministic order
Imported from CityOfZion/neo-storm#60 PR.
2019-08-14 20:08:05 +03:00
1883a11f44 swap arguments for functions with more than 3 arguments (CityOfZion/neo-storm#51)
Imported from CityOfZion/neo-storm (402ebb1d6226e2a30d8fdc19663227361cc72ca0).
2019-08-14 19:14:08 +03:00
74602b6143 concatenate strings using CAT opcode (CityOfZion/neo-storm#54)
Imported from CityOfZion/neo-storm (7d759a23e3af792657c7515645b890eadfa7329f).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
36b253872f WIP
Imported from CityOfZion/neo-storm (cbfc89972e977fa808e9f68c9ad5c6c18bef291d).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
a765561b3a implemented bitwise instructions and fixed loading constants of type uint (CityOfZion/neo-storm#49)
Imported from CityOfZion/neo-storm (b8a9b14dacc4fd6a62c236b2e89545684435a8fb).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
459d3654a2 fixed missing syscall transaction.GetHash() (CityOfZion/neo-storm#43)
Several bug fixes and improvements

Imported from CityOfZion/neo-storm (8e8fe5c215bfaed51452482f4f28cc9956a1f69b).
2019-08-14 19:14:07 +03:00
BlackTrace
69511e053f update right neo api (CityOfZion/neo-storm#40)
Imported from CityOfZion/neo-storm (eee635918c80a9444dc1b37e537f9ecaf1a83d33).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
0880e88fa5 Fixed bug in else stmts (CityOfZion/neo-storm#42)
* Fixed bug in else stmts

* Fixed if else bug

* Back to %v for formatting instructions

Imported from CityOfZion/neo-storm (ea8440e1454207753c8d209ce7c2cf724fd4ea16).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
b97e5aafec Fix/bugs (CityOfZion/neo-storm#38)
* Fixed bug where void functions cleaned up their mess multiple times
* Compiler improvements
* Fixed Neo APIs naming convention
* Added NOP after syscall for matching AVM files with neo-python.

Imported from CityOfZion/neo-storm (f93a28ef87d272a74f821d45ae0c6735a8c610be).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
f547708e10 Implemented detailed init command (CityOfZion/neo-storm#37)
* Implemented detailed init command

* add command for skipping contract information

Imported from CityOfZion/neo-storm (0ef8b983ef43ef2eb8e9f190f1f36dc0e839bbc1).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
54a886a7fe Added docs folder with first draft of the runtime and smart contract API (CityOfZion/neo-storm#31)
* Added docs folder with first draft of the runtime and smart contract API

* Draft of the runtime/neo smart contract api

* Added more API documentation.

* Added the last API documentation for the NEO runtime and interop functions.

Imported from CityOfZion/neo-storm (bc7749ee08f2f48b87f13400e5917ee28e854d86).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
55966c7e07 Draft of iterator and enumerator (CityOfZion/neo-storm#26)
* Draft of iterator and enumerator

* Added iterator API to the syscall mapping

* Added draft of the enumerator.go file

* Added enumerator interop API.

* Updated the changelog

Imported from CityOfZion/neo-storm (156093318b8612e810965bb1ea26e1babfb46cdd).
2019-08-14 19:14:06 +03:00
Ankur Srivastava
3fc25e1431 fixes CityOfZion/neo-storm#16
* A new command `cli init --name testcontract` now creates a directory testcontract/main.go

Imported from CityOfZion/neo-storm (331585e51ce13b6fe902b7a352b150c5b457a4f5).
2019-08-14 19:14:06 +03:00
Jeroen Peeters
df173c295d chore: change CompareBytes to EqualBytes (CityOfZion/neo-storm#22)
* chore: change CompareBytes to EqualBytes

* chore: remove trailing spaces

* chore: rename EqualBytes to Equals

Imported from CityOfZion/neo-storm (da16e967d9631e132488731a42966bccb5ad7f30).
2019-08-14 19:14:06 +03:00
Anthony De Meulemeester
f14833893c CityOfZion/neo-storm#17 Implemented util.CompareBytes (CityOfZion/neo-storm#21)
Imported from CityOfZion/neo-storm (c0ee185a7cfd2c222fb7b4c8ca19885844d53855).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
b997eeb051 fixed token example and fixed compiler test with multiple dirs (CityOfZion/neo-storm#20)
Imported from CityOfZion/neo-storm (2d0814a04c34f320dee41674066ccd766a7a8ea1).
2019-08-14 19:14:05 +03:00
Jeroen Peeters
1f8ccdba16 chore: move token example to nep5 as package name (CityOfZion/neo-storm#19)
* feat: add token example

* feat: code splitted package

* feat: use updated apis

* chore: change token namespace to nep5

* chore: add transfer event and readme updates

Imported from CityOfZion/neo-storm (63ec2d7dc23a60f128a8b383ceda1eaa15d919c1).
2019-08-14 19:14:05 +03:00
Jeroen Peeters
b3037cd598 Token Example (CityOfZion/neo-storm#12)
* feat: add token example

* feat: code splitted package

* feat: use updated apis

Imported from CityOfZion/neo-storm (e2bab450d7355b559ae2d70a87f557e8a6dbfff6).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
8bfaed0e4b added in the crypto helper api for smart contracts. (CityOfZion/neo-storm#15)
Imported from CityOfZion/neo-storm (ad6e9dae46846f97a7da6dd48bf55ad554d612b3).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
9e15ab04ce Added missing execution interop api (CityOfZion/neo-storm#14)
Imported from CityOfZion/neo-storm (ab12273da74e0d35df8863f08f1a914723d2bdba).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
0b33cf3193 new mapping for interop api (CityOfZion/neo-storm#10)
* new mapping for interop api

* Fixed interop API mapping + added missing apis

* added engine apis

Imported from CityOfZion/neo-storm (ec5e6c8e2b587704a1e071e83b633d2d3a235300).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
2fbb269c0d added compiler to test all example files. (CityOfZion/neo-storm#9)
Imported from CityOfZion/neo-storm (e756a91b292f525f2cd7e6d6c05b46df582c8ece).
2019-08-14 19:14:05 +03:00
Roman Khimov
d804b517fc examples/token-sale: drop binary avm from the repo
It's easily reproduced from the token_sale.go and it's confusing the compiler
test.
2019-08-14 19:14:05 +03:00