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
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
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
Anna Shaleva
2187346158
rpc: fix json marshalling of result.AssetState
...
Modified result.AssetState:
- removed `FeeMode` and `FeeAddress` fields
- fixed json name of `ID` and `AssetType` fields
to be consistent with C# RPC server
2020-03-23 17:44:15 +03:00
Anna Shaleva
2001a40312
util: JSONify uint160 using LE instead of BE
...
closes #769
2020-03-23 17:38:58 +03:00
Evgenii Stratonikov
6ed2bd63b9
core: marshal AppExecResult.Stack as an array
...
Closes #782 .
2020-03-23 16:27:47 +03:00
Evgenii Stratonikov
dfbb84ef38
rpc: support https
...
Allow to start TLS RPC server on a separate port.
Closes #702 .
2020-03-17 12:44:23 +03:00
Roman Khimov
a5e862c351
rpc/client: add TransferNEP5 method to easily transfer tokens
...
We have TransferAsset for regular tokens, so it'd be nice to have TransferNEP5
for NEP5 ones. Relates to #599 .
2020-03-16 17:52:32 +03:00
Evgenii Stratonikov
cdf025bf89
transaction: implement AddVerificationHash() method
2020-03-16 14:11:19 +03:00
Roman Khimov
e9429374aa
Merge pull request #756 from nspcc-dev/feature/unclaimed
...
core/state: do not unmarshal Unclaimed balances in account
2020-03-16 13:21:23 +03:00
Evgenii Stratonikov
e503d1001d
core/state: do not unmarshal Unclaimed balances in account
2020-03-16 12:19:32 +03:00
Evgenii Stratonikov
66727ab8fa
rpc: marshal Asset hash in LE in getnep5balances RPC
2020-03-16 10:14:55 +03:00
Roman Khimov
ba1c3bfccb
Merge pull request #758 from nspcc-dev/rpc-fix-hash160
...
rpc: fix invocations of contracts using hash160
2020-03-13 16:50:31 +03:00
Roman Khimov
c8f4eee5f4
rpc: fix invocations of contracts using hash160
...
ERROR Error encountered with rpc request {"error": "expected string size of 40 got 42",...
2020-03-13 16:47:08 +03:00
Anna Shaleva
784bac0b38
rpc: bug with empty stack marshalling in getapplicationlog
...
Problem: cannot marshall empty raw message from appExecResult.Stack
Solution: add handler for case when appExecResult.Stack is an empty string
2020-03-13 12:50:51 +03:00
Roman Khimov
d9a83373ed
Merge pull request #748 from nspcc-dev/feature/splitnep5
...
core: store NEP5 balances separately from account
2020-03-12 18:31:25 +03:00
Roman Khimov
734778c1f9
Merge pull request #747 from nspcc-dev/fix-contract-deploy-gas-parameter
...
Use wallet in smartcontract deploy/invoke commands and calculate GAS properly
2020-03-12 17:00:04 +03:00
Roman Khimov
25da5a30d8
cli: change deploy and invoke commands to use wallet
...
Passing WIF directly in the command line is not something we should be doing.
Also split netfee and sysfee in the RPC as they're different (and add a script
attribute for free transactions).
2020-03-12 16:19:12 +03:00
Anna Shaleva
307b3b162b
rpc: implement missing RPC client methods
...
Implemented following RPC client methods:
- getapplicationlog
- getassetstate
- getbestblockhash
- getblockcount
- getblockhash
- getblockheader
- getblocksysfee
- getconnectioncount
- getcontractstate
- getpeers
- getrawmempool
- getstorage
- gettransactionheight
- gettxout
- getunclaimed
- getvalidators
- getversion
- submitblock
- validateaddress
2020-03-12 15:56:59 +03:00
Evgenii Stratonikov
6e0a57075f
*: gofmt
2020-03-12 14:51:13 +03:00
Evgenii Stratonikov
df2598c8dc
core: store NEP5 balances separately
...
There is no need to take and unmarshal an account structure only
to get it's NEP5 balances.
2020-03-12 12:58:28 +03:00
Evgenii Stratonikov
d25dddc780
rpc: refactor getDecimals
...
Use existing functions to invoke smartcontract's
method instead of constructing ad-hoc script.
2020-03-12 12:19:31 +03:00
Evgenii Stratonikov
05544a1510
rpc: return empty arrays instead of null in getnep5* RPCs
2020-03-12 12:19:30 +03:00
Roman Khimov
bbd802681e
cli: make gas parameter to deployment add gas to the base price
...
That's how it was intended to behave originally. One thing questionable here
is contract price (policy thing, basically) being moved to smartcontract
package, but it's probably fine for NEO 2.0 (as it won't change) and we'll
make something better for NEO 3.0.
2020-03-11 20:34:36 +03:00
Anna Shaleva
c23a522d25
rpc: implement getunclaimed
...
closes #712
2020-03-11 18:33:15 +03:00
Evgenii Stratonikov
22e99a5b3e
rpc: implement (*Client).NEP5TokenInfo()
...
It can be useful to receive all NEP5 token info at once.
2020-03-10 13:02:14 +03:00
Evgenii Stratonikov
cdeba6d417
rpc: implement (*Client).NEP5* methods
2020-03-10 13:02:14 +03:00
Roman Khimov
4b83e9a5cd
Merge pull request #732 from nspcc-dev/feature/getvalidators
...
rpc: implement getvalidators
2020-03-07 21:43:38 +03:00
Anna Shaleva
456a2d55fd
rpc: implement getvalidators
...
closes #714
2020-03-07 18:05:40 +03:00
Evgeniy Kulikov
b34ac22434
[rpc/server] fix getblock verbose response
...
- Nonce should not trim leading zeros
- NextConsensus should returns address (uint160 -> base58)
2020-03-06 19:53:11 +03:00
Roman Khimov
f8eee778f4
Merge pull request #724 from nspcc-dev/feature/submitblock
...
rpc: implement submitblock
2020-03-06 12:08:45 +03:00
Anna Shaleva
2031d8d103
rpc: add custom errors to sendrawtransaction
...
In case of unsuccessful relyReason sendRawTransaction should return
errors with codes [-500, ..., -505] instead of error with code -32603
2020-03-06 12:04:51 +03:00
Anna Shaleva
a746d8e6e6
rpc: implement submitblock RPC
...
closes #344
2020-03-06 12:03:08 +03:00
Anna Shaleva
ccd88c3af8
rpc: implement gettransactionheight
...
closes #713
2020-03-05 19:34:11 +03:00
Anna Shaleva
5cfa1bc2a8
rpc: fixed getblockheader tests
2020-03-05 19:16:22 +03:00
Roman Khimov
fbdc60b731
Merge pull request #723 from nspcc-dev/feature/nep5
...
core,rpc: implement NEP5-related logic
2020-03-05 18:33:58 +03:00
Evgenii Stratonikov
c019ce565f
rpc: move test contract hash to constant
...
When changing test chain it can be rather annoying
to replace all of the occurences of the contract hash.
2020-03-05 18:26:55 +03:00
Evgenii Stratonikov
547bd3bde3
rpc: display for NEP5 token amount properly
...
Every NEP5 contract MUST have `decimals` method which
is used to properly display token amount.
2020-03-05 18:22:40 +03:00
Evgenii Stratonikov
95a8fa234f
rpc: implement getnep5transfers RPC
2020-03-05 18:22:40 +03:00
Evgenii Stratonikov
2757882d26
rpc: implement getnep5balances RPC
2020-03-05 18:22:40 +03:00
Evgenii Stratonikov
6d270c4550
core,rpc: add NEP5 contract to testdata
...
Also transfer tokens between accounts.
2020-03-05 18:22:40 +03:00
Roman Khimov
b273f3126a
Merge pull request #722 from nspcc-dev/feature/getblockheader
...
rpc: implement getblockheader RPC
2020-03-05 17:18:54 +03:00
Anna Shaleva
42e2aff381
rpc: implement getblockheader RPC
...
closes #711
2020-03-05 14:47:45 +03:00
Roman Khimov
81d89cd502
core: fix SystemFee calculation for Invocation TXes
...
They have it specified right in the transaction. Unfortunately, this little
change rendered invalid our RPC test chain, but I think it became even better
after it, especially given that chain generation is a nice test by itself, so
it should be running as a regular test.
2020-03-04 19:23:23 +03:00
Roman Khimov
a9d8c9e0d3
rpc/client: implement GetRawTransaction, fix #586
2020-03-03 20:43:57 +03:00
Roman Khimov
f01766131b
rpc/client: add a set of GetBlock methods
...
They differ in input and output types (and data), thus four methods are
added.
2020-03-03 20:26:56 +03:00
Roman Khimov
685e34d83c
rpc: update client documentation
...
Add missing methods, move example into something that can be compiled (and fix
it along the way).
2020-03-03 18:59:21 +03:00
Roman Khimov
f747b39bc6
docs: update RPC server documentation, add missing methods
...
And drop doc.go from server package as it duplicates docs/rpc.md and has no
value of its own (TODO list is managed with GitHub issues, really). Also, RPC
server is not really expected to be used by non-neo-go packages (contrary to
the client).
2020-03-03 18:18:56 +03:00
Roman Khimov
f5a1b928ce
pkg: fix gofmt issues
2020-03-03 17:22:15 +03:00
Roman Khimov
e41d434a49
*: move all packages from CityOfZion to nspcc-dev
2020-03-03 17:21:42 +03:00
Roman Khimov
4c8d327353
rpc: drop duplicating Invoke* structures
...
And use smartcontract.Parameter instead of vm.StackItem where
appropriate. Closes #689 .
2020-03-03 15:38:03 +03:00
Roman Khimov
9b4fd99fbc
vm: break circular references when recursing into ToContractParameters
...
Reference types can have circular pointers to each other, thus we need to
control recursion.
2020-03-03 15:38:03 +03:00
Roman Khimov
3282c6ed41
Merge pull request #704 from nspcc-dev/feature/getrawmempool
...
rpc: implement getrawmempool RPC
2020-03-02 19:44:19 +03:00
Anna Shaleva
e1fe12a07f
rpc: implement getrawmempool RPC
...
closes #175
2020-03-02 19:35:51 +03:00
Evgenii Stratonikov
05a3625b7d
wallet: implement (*Account).SignTx
...
It is used in both CLI and RPC.
2020-03-02 18:03:56 +03:00
Evgenii Stratonikov
972e0d8ad1
core: add one more Contract tx to the test chain
...
When testing CLI it is useful to have some spent coins
on an account with a known key.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
37c2bc4733
rpc: implement (*Client).GetClaimable()
...
This is needed to form correct Claim transaction.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
9d5841df38
rpc: make (*Client).SendRawTransaction public
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
44792ed5f7
core: make test chain format compatible with mainnet
...
Write uint32 length before every block.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
51c4868641
rpc: implement getclaimable RPC
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
0e2a1f40ba
core: add ContractTX to a testchain generator
...
Simple transfer from multisig account to the account
of one of the validators.
2020-03-02 18:00:00 +03:00
Evgenii Stratonikov
72d72296c3
core: implement (*Transaction).GetSignedPart()
...
Marshalling it and taking all but last byte violates incapsulation
and is just wrong in case transaction already contains any witnesses.
2020-03-02 18:00:00 +03:00
Roman Khimov
252a9f2f31
Merge pull request #690 from nspcc-dev/feature/getapplicationlog
...
rpc: implement getapplicationlog RPC
2020-03-02 17:41:32 +03:00
Anna Shaleva
ff4384d7ff
rpc: implement getapplicationlog RPC
...
Closes #500
2020-03-02 17:25:27 +03:00
Anna Shaleva
648e0bb242
rpc/smartcontract: merge contract parameter types
...
Merged two types:
- smartcontract.ParamType
- rpc.StackParamType
into single one:
- smartcontract.ParamType
as they duplicated the functionality.
NOTE: type smartcontract.MapType was added (as in C# implementation).
From now, list of supported smartcontract parameter types:
UnknownType
SignatureType
BoolType
IntegerType
Hash160Type
Hash256Type
ByteArrayType
PublicKeyType
StringType
ArrayType
MapType
InteropInterfaceType
VoidType
2020-03-02 17:25:21 +03:00
Evgenii Stratonikov
624a14f730
rpc: rename (*Client).SendToAddress to TransferAsset
...
SendToAddress name is similar to the `sendtoaddress` RPC call,
this can cause confusion.
Closes #686 .
2020-02-28 14:16:39 +03:00
Anna Shaleva
76a0a6e7e8
rpc: implement getblocksysfee RPC
...
Closes #341
2020-02-21 18:45:52 +03:00
Roman Khimov
8da20055d6
rpc: drop duplicating structures used in tests
...
We have proper results now, so use those. The only left is Invoke, but that
depends on another issue at the moment.
2020-02-21 15:23:11 +03:00
Roman Khimov
3fa9de764b
rpc/client: only return the Result from calls, handle Error internally
...
Adjust structures accordingly and throw away most of them, they're useless.
2020-02-21 15:23:11 +03:00
Roman Khimov
28a26d2cae
rpc/client: look into data first, then HTTP error code
...
In case of error our own server responds with an HTTP error and proper
JSON-RPC error in the body, so look there first as it has more specific data.
2020-02-21 15:12:04 +03:00
Roman Khimov
877b987ecf
rpc: omitempty some fields in TransactionOutputRaw
...
These might be undefined for mempool transactions, thus they should be defined
as omitempty.
2020-02-21 15:12:04 +03:00
Roman Khimov
bba8ac15ff
rpc: introduce proper type for sendrawtransaction, drop useless types
...
sendrawtransaction just returns a bool, sendtoaddress returns a proper
transaction and that should be the same as the one we have in
TransactionOutputRaw.
2020-02-21 15:12:04 +03:00
Roman Khimov
465476201c
rpc/response: drop duplicating AccountState structure
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
b50704fd3b
rpc: move server-related code to a separate package
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
d24c6d1d9e
rpc: move client-related code to a separate package
...
This includes Client struct with RPC methods and
BalanceGetter implementation with NeoSCAN.
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
b6bc4e580a
rpc: move functions for Tx building in request package/
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
98a1e2170a
rpc: move ContractDetails to request/ package
2020-02-21 15:12:04 +03:00
Evgenii Stratonikov
63751a6e6b
rpc: merge neoscan-related definitions into one file
...
It will make refactoring easier.
2020-02-21 15:12:04 +03:00
Roman Khimov
f330f2f40b
rpc: separate out request and response structures
...
Mostly as is, no real effort done yet to optimize them, so there are still a
lot of duplicates there, but at least we sort them out into different smaller
packages.
2020-02-21 15:12:04 +03:00
Roman Khimov
69e1ad512f
rpc: move result package into response
...
`response` is to be populated soon.
2020-02-21 15:12:04 +03:00
Roman Khimov
1801e545a0
rpc: remove wrappers package, move things to result
...
These are all RPC call results, `wrappers` package doesn't make much sense to
me.
2020-02-21 15:12:04 +03:00
Roman Khimov
b8f7ab8e6a
rpc: move Invoke to result package
...
It's just a data.
2020-02-21 15:12:04 +03:00
Roman Khimov
c189062f40
rpc: move ValidateAddress to the result package
...
Because it is a result of the RPC call.
2020-02-21 15:12:04 +03:00
Roman Khimov
bfa2d54e16
rpc: move validateAddress() function from wrappers into server
...
It's a server implementation detail, it has nothing to do with the data format
itself. It also makes no sense exporing it.
2020-02-21 15:12:04 +03:00
Roman Khimov
72a62f1292
result: add trivial test for peers management functions
2020-02-21 15:12:04 +03:00
Roman Khimov
d92e193e63
rpc/network: refactor getpeers logic
...
Deduplicate and simplify code.
2020-02-21 15:12:03 +03:00
Roman Khimov
336a94456f
rpc: make blockHeightFromParam a pointer method
...
Makes no sense copying Server here.
2020-02-21 15:12:03 +03:00
Roman Khimov
a4294f4b5f
core: export UtilityTokenID and GoverningTokenID
...
Both are very useful outside of the core, this change also makes respective
transactions initialize with the package as they don't depend on any kind of
input and it makes no sense recreating them again and again on every use.
2020-02-19 12:13:27 +03:00
Evgenii Stratonikov
9b82bbaa8a
rpc: implement getstorage RPC
2020-02-18 11:59:31 +03:00
Evgenii Stratonikov
a2f012e589
core: deploy new smart-contract in test blocks
...
Also put smart-contract sources in testdata and
add invocation TX with APPCALL and storage.Put.
2020-02-18 11:59:28 +03:00
Anna Shaleva
2b9e63c511
core: add func to generate RPC test data
...
newRPCTestChain function generates test chain "testblocks.acc" for RPC
tests
2020-02-17 23:54:25 +03:00
Anna Shaleva
c99b42f738
rpc: add tests for getcontractstate RPC
2020-02-17 23:54:25 +03:00
Anna Shaleva
3c63ef3dc3
rpc: implement getcontractstate RPC
2020-02-17 23:54:25 +03:00
Anna Shaleva
b8715ddf11
rpc: refactor code of NewAccountState function
...
Simplified reversing of scriptHash
2020-02-17 23:52:20 +03:00
Anna Shaleva
f310145612
rpc: fix getrawtransaction error returncode
...
Changed returncode of getrowtransaction method in case when transaction
with specified hash does not exists. Now it returns error with code -100
instead of -32602 (as in c# node)
2020-02-17 23:52:20 +03:00
Anna Shaleva
5dca765bd1
rpc: add custom error with code -100
...
Fixed getassetstate method: it should return error with code -100 when
asset with specified id is not found (as in c# node).
2020-02-17 23:52:20 +03:00
Evgenii Stratonikov
7ee10ecea5
rpc: implement gettxout RPC
2020-02-17 11:58:18 +03:00
Evgeniy Kulikov
64e325d9af
Update tests for getblock
action
...
- replace `GetBlockResponse.Result` with `wrappers.Block`
- update `getblock` checker and add more assets
2020-02-12 21:58:43 +03:00
Evgeniy Kulikov
41ebf12eb3
Update getblock
RPC action response
2020-02-12 19:43:51 +03:00
Evgenii Stratonikov
8243a8b3a7
emit: use io.BinWriter instead of bytes.Buffer
2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
4d8a3a359b
vm: move Emit* functions to a separate package
...
Also strip 'Emit' prefix because 'emit' is now
in the package name.
2020-02-06 18:45:37 +03:00
Roman Khimov
b1b660c779
rpc: fix getaccountstate/getunspents for unknown addresses
...
Returning error string as a result (not an error) is utterly wrong, but C#
implementation just returns a zero balance for unknown addresses, so we should
follow that.
2020-01-29 19:01:00 +03:00
Evgenii Stratonikov
54e0b5a4a7
rpc: set MaxGasInvoke in config
...
Implement ability to restrict maximum amount of GAS
available for free RPC calls.
2020-01-22 14:31:57 +03:00
Evgenii Stratonikov
4718375db1
rpc: return amount of consumed GAS in invoke*
2020-01-22 14:31:57 +03:00
Roman Khimov
ea3b76ded1
network: make NewServer return an error, fix #612
...
It can return nil in two cases, so we're better return an error and handle
it.
2020-01-22 11:17:51 +03:00
Roman Khimov
32213b1454
Merge pull request #601 from nspcc-dev/refactoring/core
...
core: refactor out Block, BlockBase and Header, closes #597 .
2020-01-20 16:19:20 +03:00
Roman Khimov
46b82b4fb5
keys: don't return error from PrivateKey.Sign
...
As it can't ever happen.
2020-01-17 17:00:30 +03:00
Evgenii Stratonikov
489b88afbb
block: rename BlockBase to Base
2020-01-16 10:16:24 +03:00
Evgenii Stratonikov
63c56cca5c
core: refactor out Block, BlockBase and Header structs
...
See #597 .
2020-01-16 10:16:24 +03:00
Roman Khimov
b5f234ddef
rpc: make rpc request logging at Debug level
...
Makes no sense polluting logs with Info. It also affects benchmarking.
2020-01-13 17:33:29 +03:00
Evgenii Stratonikov
9dc5571327
core,rpc: close Blockchain in tests
...
If blockchain is not closed, logging in defer can occur
after test has finished, which will lead to a panic with
"Log in goroutine after Test* has completed".
2020-01-10 11:47:56 +03:00
Evgenii Stratonikov
45a4524054
rpc: remove EnableCORSWorkaround from Request
2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
289cb1c1d9
rpc: use zap.Logger
2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
aecdf470e7
cli,pkg: use zap.Logger
2020-01-10 11:14:27 +03:00
Roman Khimov
9145855d2c
Merge pull request #579 from nspcc-dev/refactor-crypto
...
This moves some functionality into micro-packages, improves testing,
unexports some code and fixes bugs along the way.
2019-12-25 18:12:50 +03:00
Roman Khimov
b246653f62
address: rename functions as per #579 comments
...
Make them more clear to understand.
2019-12-25 17:34:18 +03:00
Roman Khimov
e685e9bf9a
address: move into its own package
...
Doesn't really belong to the crypto.
2019-12-25 15:22:02 +03:00
Vsevolod Brekelov
606616618f
rpc: add ability to answer as C# with block as []byte
2019-12-25 01:44:37 +03:00
Evgenii Stratonikov
884779e501
*: goimports
2019-12-17 14:51:28 +03:00
Roman Khimov
54d888ba70
io: add type-specific read/write methods
...
This seriously improves the serialization/deserialization performance for
several reasons:
* no time spent in `binary` reflection
* no memory allocations being made on every read/write
* uses fast ReadBytes everywhere it's appropriate
It also makes Fixed8 Serializable just for convenience.
2019-12-12 20:19:50 +03:00
Vsevolod Brekelov
2d42b14a1d
core: renames entities-> state and removed State prefix
2019-12-11 13:14:18 +03:00
Vsevolod Brekelov
ec17654986
core: refactoring blockchain state and storage
...
add dao which takes care about all CRUD operations on storage
remove blockchain state since everything is stored on change
remove storage operations from structs(entities)
move structs to entities package
2019-12-11 13:05:31 +03:00
Roman Khimov
7e371588a7
core/tx: remove one layer of indirection for scripts and inouts
...
It reduces heap pressure a little for these elements as we don't have to
allocate/free them individually. And they're directly tied to transactions or
block, not being shared or anything like that, so it makes little sense for
them to be pointer-based. It only makes building transactions a little easier,
but that's obviously a minor usecase.
2019-12-09 17:14:10 +03:00
Roman Khimov
3898aadcec
rpc: simplify uint160 handling
...
Use new Uint160DecodeStringLE() function.
2019-12-06 19:47:58 +03:00
Evgenii Stratonikov
7179e4ba9f
util: add LE suffix to Uint256 methods
2019-12-06 12:16:55 +03:00
Evgenii Stratonikov
57efad912c
util: add LE suffix to Uint160 methods
2019-12-06 12:16:55 +03:00
Roman Khimov
141d27795e
rpc: remove hardcoded pushbytes64 constant
...
Using our new and shiny opcode package.
2019-12-03 18:23:46 +03:00
Roman Khimov
138e125646
*: remove duplicate functions producing verification script
...
Drop wif.GetVerificationScript(), drop
smartcontract.CreateSignatureRedeemScript(), add GetVerificationScript()
directly to the PublicKey and use it everywhere.
2019-12-03 18:23:46 +03:00
Roman Khimov
8d4dd2d2e1
vm: move opcodes into their own package
...
This allows easier reuse of opcodes and in some cases allows to eliminate
dependencies on the whole vm package, like in compiler that only needs opcodes
and doesn't care about VM for any other purpose.
And yes, they're opcodes because an instruction is a whole thing with
operands, that's what context.Next() returns.
2019-12-03 18:22:14 +03:00
Roman Khimov
bc5beb438f
*: gofmt
...
Somehow these crept into the repository.
2019-12-02 10:10:50 +03:00
Roman Khimov
dccf440dca
rpc: skip input/outputs mangling if no gas is attached to invocation
2019-11-29 18:00:08 +03:00
Roman Khimov
8a5ac12df8
rpc: make generic SignAndPushInvocationTx out of DeployContract
...
SignAndPushInvocationTx() is gonna be used for more than just deploying
contracts.
2019-11-29 17:59:07 +03:00
Roman Khimov
127f8418c8
rpc: refactor out runScriptInVM() from invokers
2019-11-28 19:13:58 +03:00
Roman Khimov
e216139108
rpc: implement server-side 'invoke' method, fix #346
2019-11-28 19:08:31 +03:00
Roman Khimov
d04bc0cbe3
rpc: add marshaler for StackParamType
...
Makes stack output look better, no one cares about numbers.
2019-11-27 13:00:11 +03:00
Roman Khimov
3843451ec4
rpc: fix potential getblock handling problem, add a test for it
...
It should only accept hex strings and numbers, anything else is wrong.
2019-11-27 13:00:11 +03:00
Roman Khimov
1c883cc819
rpc: add invokescript tests
2019-11-27 13:00:11 +03:00
Roman Khimov
cf39171485
rpc: implement invokefunction, fix #347
...
Param getters were redone to return errors because otherwise bad FuncParam
values could lead to panic. FuncParam itself might be not the most elegant
solution, but it works good enough for now.
2019-11-27 13:00:11 +03:00