Commit graph

580 commits

Author SHA1 Message Date
Roman Khimov
ec7e17ffa6 pkg: make use of the new crypto/hash package
Simplifies a lot of code and removes some duplication. Unfortunately I had to
move test_util random functions in same commit to avoid cycle
dependencies. One of these random functions was also used in core/transaction
testing, to simplify things I've just dropped it there and used a static
string (which is nice to have for a test anyway).

There is still sha256 left in wallet (but it needs to pass Hash structure into
the signing function).
2019-08-26 13:32:19 +03:00
Roman Khimov
2fd782eee8 util: drop RandUint32()
I don't see anything useful in it, all the current users of it should just use
plain rand.Uint32() not limiting its output in any way.
2019-08-26 13:32:19 +03:00
Roman Khimov
3fa6ba9c7b hash: simplify ripemd160 usage
Go's Hash is explicitly specified to never return an error on Write(), and our
own decoding functions only check for length which is gonna be right in every
case so it makes no sense returning errors from these functions.
2019-08-26 13:32:19 +03:00
Roman Khimov
80c3c9035a hash: simplify Sha256 implementations
Use sha256.Sum256() and drop duplicating Sum() completely.
2019-08-26 13:32:19 +03:00
Roman Khimov
5c5878968b hask: import package from _pkg.dev, make it compile 2019-08-26 13:32:19 +03:00
Roman Khimov
37be2e215c array: add a test for even num of elements
And drop duplicating code from _pkg.dev.
2019-08-26 13:32:19 +03:00
Roman Khimov
0cde8d962d fixed8: switch to more uniform function naming 2019-08-26 13:32:19 +03:00
Roman Khimov
b0af8b306d fixed8: fix Satoshi() and add a test for it 2019-08-26 13:32:19 +03:00
Roman Khimov
20a4ad99b3 fixed8: add some testcases from dev, split Value functions
Add FloatValue() and rename Value() to Int64Value() for consistency.
2019-08-26 13:32:19 +03:00
Roman Khimov
a861f53733 fixed8: simplify arithmetic functions
I'm not sure they're of any use at all.
2019-08-26 13:32:19 +03:00
Roman Khimov
c67217159f fixed8: remove trailing zeroes from string representation
Add some testcases from `dev` branch (with less than zero case added) and
remove useless trailing zeroes from the resulting string.
2019-08-26 13:32:19 +03:00
Roman Khimov
d5d570f793 uint256: add Reverse(), change String() to be BE
This one makes a little more obvious that we're operating with LE
representations mostly. Refs. #307. See #314 also.
2019-08-26 13:32:19 +03:00
Roman Khimov
c1b1b6fca4 uint160: move ReverseString() from _pkg.dev
With associated test and drop duplicating Uint160 implementation from
_pkg.dev. It doesn't seem to be used in pkg code at the moment, but still it
can be useful. Refs #307.
2019-08-26 13:32:19 +03:00
Roman Khimov
bc0a4671d4 _pkg.dev: drop crypto/aes, refs #307
Duplicated by pkg/crypto/aes256.go.
2019-08-23 19:29:09 +03:00
Roman Khimov
4640394aca _pkg.dev: drop internal rfc6979 package
Reuse anthdm/rfc6979. Closes #285.
2019-08-23 19:29:09 +03:00
Vsevolod
caaba8e874
Merge pull request #308 from nspcc-dev/circleci-update-306
circleci: update config to include cli and docker builds
2019-08-21 22:10:45 +03:00
Vsevolod
8dfbf3b548
Merge pull request #310 from nspcc-dev/im-kulikov-patch-1
Update Readme
2019-08-21 22:07:47 +03:00
Evgeniy Kulikov
deed6f4943
Update Readme
- update links
- update head / badges
2019-08-21 20:47:41 +03:00
Roman Khimov
16e0fcde1f circleci: update tag specs in workflows
Use go-style version tags as suggested by @im-kulikov.
2019-08-21 20:02:43 +03:00
Roman Khimov
79ccfb9b1c
Merge pull request #309 from nspcc-dev/readme-update
Update Readme
2019-08-21 19:46:19 +03:00
Vsevolod
642fad0cd3
Update Readme
Add current NEO pic
Add @volekerb and @roman-khimov in Contacts
Add links to docs
2019-08-21 19:30:21 +03:00
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