Commit graph

2171 commits

Author SHA1 Message Date
Evgenii Stratonikov
3cbd138b67 compiler: allow to declare variables of struct type
Previously, struct variables were initialize with VM's nil value
which is of primitive type. Thus SETITEM used for struct's field
updating wasn't working.
2020-03-27 13:50:09 +03:00
Evgenii Stratonikov
6baed7a010 compiler: allow to declare slices of compound types
Previously this declarations were ignored which resulted
in runtime errors, because VM's nil is an element of primitive type
and can't be converted to an array.
2020-03-27 13:50:09 +03:00
Roman Khimov
c738975b7b
Merge pull request #803 from nspcc-dev/feature/appcall
emit: implement AppCallWithOperationAndArgs
2020-03-27 13:30:48 +03:00
Roman Khimov
5db7e897ac
Merge pull request #802 from nspcc-dev/feature/testutil
testutil: implement helpers for encode/decode routines
2020-03-27 12:47:57 +03:00
Evgenii Stratonikov
db2dccf7cb emit: implement AppCallWithOperationAndArgs
It is nice to have a typical task of calling contract method
with specific arguments incapsulated inside some function.
2020-03-27 11:05:36 +03:00
Evgenii Stratonikov
0036b3e52b random: make use or random package in tests
Also implement Bytes/Fill routines for generating byte slices.
2020-03-27 10:27:46 +03:00
Evgenii Stratonikov
9abda40171 testserdes: implement helpers for encode/decode routines
Frequently one needs to check if struct serializes/deserializes
properly. This commit implements helpers for such cases including:
1. JSON
2. io.Serializable interface
2020-03-27 10:27:46 +03:00
Roman Khimov
d4622768d1
Merge pull request #795 from nspcc-dev/feature/find_storage_example
examples: expand storage smartcontract with find() usage example
2020-03-26 16:45:44 +03:00
Anna Shaleva
0a5298b3ee examples: expand storage smartcontract with find() usage example
closes #364
2020-03-26 16:41:07 +03:00
Anna Shaleva
37cb60a0b5 compiler/interop: add missing methods to interop.Iterator
Add Next() and Value() to interop.Iterator and corresponding syscalls to
compiler
2020-03-26 16:39:10 +03:00
Roman Khimov
2a262c6ef4
Merge pull request #799 from nspcc-dev/fix/for
compiler: allow for loops with empty condition
2020-03-26 15:23:13 +03:00
Evgenii Stratonikov
f0b6f783aa compiler: allow for loops with empty condition 2020-03-26 15:00:14 +03:00
Roman Khimov
198fffb9b8
Merge pull request #791 from nspcc-dev/fix/calli
vm: fix offset for CALLI opcode
2020-03-26 13:13:28 +03:00
Evgenii Stratonikov
4522eed1bb vm: fix offset for CALLI opcode
It is different from other JMP* and +2 should be added to the parameter.
2020-03-26 13:09:55 +03:00
Roman Khimov
7f65e19218
Merge pull request #775 from nspcc-dev/feature/go1.14
.circleci: add go1.14 tests
2020-03-25 18:34:33 +03:00
Evgenii Stratonikov
4fe8137a41 .circleci: add go1.14 tests 2020-03-25 17:56:06 +03:00
Roman Khimov
396c78c722
Merge pull request #793 from nspcc-dev/update/boltdb
go.mod: update boltdb to v1.3.4

Related to #771.
2020-03-25 17:33:54 +03:00
Roman Khimov
e5fbf3ef2c
Merge pull request #794 from nspcc-dev/fix/rpc
rpc: allow to unmarshal integer params from string
2020-03-25 17:32:36 +03:00
Evgenii Stratonikov
4e92642dec rpc: allow to unmarshal integer params from string 2020-03-25 17:23:13 +03:00
Evgenii Stratonikov
fcc4877f43 go.mod: update boltdb to v1.3.4
Also import lib as declared in it's go.mod:
via `go.etcd.io/bbolt`.
2020-03-25 17:07:54 +03:00
Roman Khimov
4f26064aab
Merge pull request #792 from nspcc-dev/fix/deploy
smartcontract: do not require pointer in MarshalYAML
2020-03-25 16:36:34 +03:00
Evgenii Stratonikov
5f876aaeda smartcontract: do not require pointer in MarshalYAML
It is a single byte anyway.
Now `contract init` works properly.
2020-03-25 16:26:39 +03:00
Roman Khimov
b52da3b928
Merge pull request #753 from nspcc-dev/refactoring/rpc
rpc: unify RPC handlers and metrics
2020-03-25 15:33:12 +03:00
Evgenii Stratonikov
43495a49f4 rpc: reuse handlers map for prometheus metrics 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
57f37bc7a0 rpc: add metrics for invoke* RPCs 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
2ed417388b rpc: unify RPC handlers
Move all of them to a map. This can make it easier
to add/remove RPC based on plugins and makes code less verbose.
2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
8236217a01 rpc: make all handler have the same signature 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
6e801d33f0 rpc: make a separate handler for every RPC
Move getbestblockhash, getblockcount, getconnectioncount RPC.
2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
969ed6e6e1 rpc: move getaccountstate/getunspents RPCs to a separate func 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
2ec5b9f08a rpc: move getblock RPC to a separate func 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
e442ebdb69 rpc: move getblockhash RPC to a separate func 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
90fdde4018 rpc: move getversion RPC to a separate func 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
99d02d5de0 rpc: move getpeers RPC to a separate func 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
dfb4171e3c rpc: move getrawmempool RPC to a separate func 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
4e25c9121b rpc: move validateaddress RPC to a separate func 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
70eb0b175a rpc: move getassetstate RPC to a separate func 2020-03-25 15:25:12 +03:00
Evgenii Stratonikov
9e6785bed9 rpc: unify counter metrics update 2020-03-25 15:25:12 +03:00
Roman Khimov
db2c4c7598
Merge pull request #772 from nspcc-dev/feature/reuse
core: reuse buffers in persist()
2020-03-25 15:10:26 +03:00
Evgenii Stratonikov
c992d6c518 core: reuse buffer in (*cacheddao).Persist()
When serializing multiple accounts, cost of a buffer grow
can become significant. This commit tries to amortize it by
reusing the same buffer in a single `Persist()` call.
2020-03-25 13:13:54 +03:00
Roman Khimov
79b930f6de
Merge pull request #790 from nspcc-dev/fix/deploy
cli: fix type in flags.Fixed8FromContext
2020-03-24 17:37:08 +03:00
Evgenii Stratonikov
7310666479 cli: fix type in flags.Fixed8FromContext 2020-03-24 17:17:28 +03:00
Roman Khimov
6ba2190394
Merge pull request #763 from nspcc-dev/feature/rpc_client_tests
rpc: add testing to RPC client package
2020-03-24 16:07:45 +03:00
Anna Shaleva
6998c5044b rpc: add testing infrastructure to RPC client package
closes #716

NOTE: RPC client tests contain `serverResponse` json data fetched from examples
published in official C# JSON-RPC API v2.10.3 reference
(see https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api.html)
2020-03-24 16:02:08 +03:00
Anna Shaleva
8e05bfe99c rpc/crypto: fix validator field marshalling in getvalidators RPC server
Problem: wrong `PublicKey` field json marshalling of result.Validator

Solution: add marshaller to publickey (crypto)
2020-03-24 15:52:51 +03:00
Anna Shaleva
ca12c75b12 rpc: fix name of json nep5balance field
Problem: wrong json field name of result.NEP5Balances.Balances
(see for details:
https://github.com/neo-project/neo-modules/blob/master-2.x/RpcNep5Tracker/RpcNep5Tracker.cs#L295)

Solution: rename field from `balances` to `balance` to be consistent with C# client
2020-03-24 14:55:20 +03:00
Anna Shaleva
4911837949 rpc: fix wrong script marshalling in getcontractstate RPC server
problem: `script` field of result.ContractState is marshalled as []byte

solution: add marshaller for result.ContractState
2020-03-24 14:55:20 +03:00
Anna Shaleva
79f7862496 rpc: fix blockheader marshalling in getblockheader RPC server
Problem: wrong json marshalling of `nextconsensus` field of
result.Header

Solution: change field type from util.uint160 to address string
2020-03-24 14:55:20 +03:00
Roman Khimov
751e79d480
Merge pull request #785 from nspcc-dev/feature/uint160_marshalling
util: JSONify uint160 using LE instead of BE
2020-03-24 12:41:07 +03:00
Roman Khimov
f84008437e
Merge pull request #788 from nspcc-dev/fix/vmbigint
vm: make NewBigInteger accept int64
2020-03-24 12:38:22 +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