Commit graph

1907 commits

Author SHA1 Message Date
Evgenii Stratonikov
2a6be8ceef compiler: allow to use return with no arguments 2020-05-06 17:23:32 +03:00
Roman Khimov
e097e86bfa
Merge pull request #921 from nspcc-dev/rpc-websocket-2.x
RPC over websocket (2.x)
2020-05-04 13:55:19 +03:00
Roman Khimov
a025838e52
Merge pull request #916 from nspcc-dev/compiler/generate_abi
compiler: add ability to generate .abi.json file
2020-05-04 12:02:50 +03:00
Anna Shaleva
99d0bafa2c compiler: add ability to generate .abi.json file
A part of integration with NEO Blockchain Toolkit (see #902). To be
able to deploy smart-contract compiled with neo-go compiler via NEO
Express, we have to generate additional .abi.json file. This file
contains the following information:
 - hash of the compiled contract
 - smart-contract metadata (title, description, version, author,
email, has-storage, has-dynamic-invoke, is-payable)
 - smart-contract entry point
 - functions
 - events

However, this .abi.json file is slightly different from the one,
described in manifest.go, so we have to add auxilaury stractures for
json marshalling. The .abi.json format used by NEO-Express is described
[here](https://github.com/neo-project/neo-devpack-dotnet/blob/master/src/Neo.Compiler.MSIL/FuncExport.cs#L66).
2020-05-04 08:31:14 +03:00
Anna Shaleva
592fd068b1 compiler: fix bug with missing methods parameters
Method `methodInfoFromScope(...)` always returned an empty parameters
set, so we were missing this information in both .abi.json and
.debug.json files. Fixed now.
2020-05-04 08:31:09 +03:00
Roman Khimov
556ab39a5a rpc/client: add minimalistic websocket client 2020-04-30 22:59:19 +03:00
Roman Khimov
6333060897 rpc/client: separate out http-related functionality 2020-04-30 22:59:19 +03:00
Roman Khimov
38f9b511ae rpc/client: drop Version from Options
It makes no sense at all, it's a JSON-RPC version.
2020-04-30 22:59:19 +03:00
Roman Khimov
e32367a1c2 rpc/client: fix some comments 2020-04-30 22:59:19 +03:00
Roman Khimov
a49f2bc47c client: remove Balancer getter/setter, make it an Option
Keep it internal to the client instance, it makes no sense exposing it to the
outside user.
2020-04-30 22:59:19 +03:00
Roman Khimov
00d6439eb2 client: make http.Client internal to the Client
Exposing it the outside users is strange, so incapsulate it completely.

Fix DialTimeout setting along the way, handle negative timeouts as invalid.
2020-04-30 22:59:01 +03:00
Roman Khimov
24b46c6041 rpc/server: add websockets support via '/ws' URL 2020-04-30 17:53:28 +03:00
Roman Khimov
3eb6d266ca rpc/server: use httptest.Server for testing
Which allows to reuse it for websockets.
2020-04-30 17:52:42 +03:00
Roman Khimov
3d2a2af575 rpc: shuffle handleHttpRequest/handleRequest responsibilities
Make handleRequest reusable in other contexts like websockets.
2020-04-30 17:52:15 +03:00
Roman Khimov
dbe7be5b00 rpc: change handlers to always return response.Error for errors
As it's expected by WriteErrorResponse() actually.
2020-04-30 17:52:15 +03:00
Roman Khimov
21c31d7d24 rpc/server: refactor handler methods a little
request.In is a natural request representation, one can always get
request.Params from it.
2020-04-30 17:52:13 +03:00
Anna Shaleva
87b0e76a8c rpc, smartcontract: move contract metadata to smartcontract package 2020-04-29 13:50:05 +03:00
Roman Khimov
8f417c8e8b
Merge pull request #910 from nspcc-dev/master-2.x-update-readme
README: update with workshop links and block import examples
2020-04-28 09:00:06 +03:00
Roman Khimov
92a99624c4 README: update with workshop links and block import examples
Fix some heading along the way.
2020-04-27 16:24:21 +03:00
Roman Khimov
24675d0688
Merge pull request #862 from nspcc-dev/neo2x/partial_consensus_message_decoding
consensus: partial consensus message decoding
2020-04-16 18:41:47 +03:00
Anna Shaleva
c813873577 consensus: added partial message decoding
closes #849
2020-04-16 17:16:29 +03:00
Roman Khimov
84edcf0b0e
Merge pull request #848 from nspcc-dev/cli-invoke-nomethod-check-2.x
cli: check for method presence for invokefunction commands
2020-04-13 11:48:56 +03:00
Roman Khimov
2b943b76ae cli: check for method presence for invokefunction commands
Fixes #828.
2020-04-13 11:21:11 +03:00
Roman Khimov
71fb153a69
Merge pull request #846 from nspcc-dev/fix/gomod2
*: go mod tidy
2020-04-10 17:51:43 +03:00
Evgenii Stratonikov
51512c73ed *: go mod tidy
Add `github.com/dgraph-io/badger` in go.mod .
2020-04-10 15:52:34 +03:00
Roman Khimov
4b5cc0b460
Merge pull request #843 from nspcc-dev/master-2.x-readme
README/docs: add 3.0 notice, update links to relative
2020-04-10 10:34:08 +03:00
Roman Khimov
1433c795c2 README/docs: add 3.0 notice, update links to relative
Goreportcard doesn't support branching, sorry: https://github.com/gojp/goreportcard/issues/96
And Godoc too: https://github.com/golang/gddo/issues/593
2020-04-09 20:01:55 +03:00
Roman Khimov
bfaa025a34
Merge pull request #839 from nspcc-dev/feature/badgerdb_support
storage: add support of BadgerDB
2020-04-09 15:57:50 +03:00
Anna Shaleva
54cdfe4a23 storage: add support of BadgerDB
closes #820
2020-04-09 13:55:59 +03:00
Roman Khimov
54a95810a4
Merge pull request #833 from nspcc-dev/test/vm_calls
vm: missing tests for CALL* instructions
2020-04-09 12:12:41 +03:00
Anna Shaleva
9f0bc2aaf5 vm: add tests to CALL* instructions
closes #452
2020-04-09 11:20:39 +03:00
Roman Khimov
5cd096381f
Merge pull request #829 from nspcc-dev/fix/compiler
cli: rename `contract compile` --debug flag
2020-04-08 16:01:33 +03:00
Evgenii Stratonikov
450263bcae cli: rename contract compile --emitdebug to --debug
It is more intuitive and easier to type.
2020-04-08 15:54:25 +03:00
Evgenii Stratonikov
c71ad6a5db cli: output contract after compiling only with --verbose flag
Also remove Debug from compiler option as it is used only in CLI.
2020-04-08 13:09:51 +03:00
Evgenii Stratonikov
73c7b408b7 cli: rename --debug flag in contract compile 2020-04-08 13:09:51 +03:00
Roman Khimov
60b795f3ac
Merge pull request #832 from nspcc-dev/refactoring/core
core: split into several packages
2020-04-08 09:13:47 +03:00
Evgenii Stratonikov
ee0ba9b1b4 core: make SpawnVM a method of context
spawnVMWithInterops is rather long too type and
it doesn't use Blockchain in any way.
2020-04-08 08:38:45 +03:00
Evgenii Stratonikov
a71cd0961e core/dao: remove unnecessary slice type
It is used only once, so a simple `sort.Slice`
invocation will suffice.
2020-04-08 08:38:45 +03:00
Evgenii Stratonikov
030b7754ad core: move DAO to a separate package 2020-04-08 08:38:44 +03:00
Anna Shaleva
495c1b0565 vm: add tests for missing bit and numeric operations
Added tests for:
  - bit operatoins: AND, OR, XOR
  - numeric operations: BOOLOR, MIN, MAX, WITHIN, NEGATE
2020-04-07 18:10:31 +03:00
Roman Khimov
4e0c3fab0f
Merge pull request #811 from nspcc-dev/feature/debug
compiler: support neo-debugger
2020-04-06 19:18:13 +03:00
Evgenii Stratonikov
da826522f8 compiler: set variable index on first declaration
This way variables will have indices corresponding to their
order of appearance in a source file.
2020-04-06 15:30:07 +03:00
Evgenii Stratonikov
457e7e006a compiler: support exporting method variables in debug info 2020-04-06 15:30:07 +03:00
Evgenii Stratonikov
5bdee683e6 cli,compiler: support emitting debug info in a file 2020-04-06 15:30:07 +03:00
Evgenii Stratonikov
5d3da26e1e compiler: support sequence points in debug info
Sequence points is a way to map a specific instruction offset
from a compiled contract to a text span in a source file.

This commit implements mapping only for `return` statements.
Further improvements are straight-forward.
2020-04-06 15:30:07 +03:00
Evgenii Stratonikov
24fef35ead compiler: split Compile info sub-functions
Also add tests for basic debug info.
2020-04-06 15:30:07 +03:00
Evgenii Stratonikov
00c40b58aa compiler: record basic debug info
Save info about method's byte-code sections.
2020-04-06 15:30:06 +03:00
Roman Khimov
9997661998
Merge pull request #821 from nspcc-dev/fix-cache-propagation-to-invocations
core: wrap cached dao properly, don't miss cached data
2020-04-06 11:52:41 +03:00
Roman Khimov
b2c767e356
Merge pull request #827 from nspcc-dev/fix/shl
vm: handle negative arguments in SHL/SHR
2020-04-06 10:50:47 +03:00
Evgenii Stratonikov
96806262bf vm: handle negative arguments in SHL/SHR
Do it as in reference implementation: a >> -b == a << b.
2020-04-06 10:46:35 +03:00