Commit graph

54 commits

Author SHA1 Message Date
Roman Khimov
29e66925aa rpc/client: deduplicate block/header tests a bit
The same data is copied at least twice here. Also use this block for header
test making it a bit more convenient.
2020-05-26 11:36:47 +03:00
Roman Khimov
5432530df4 result: use witnesses field in result.Header JSON
Follow new Neo 3.0 standard for these outputs.
2020-05-26 11:36:47 +03:00
Roman Khimov
7633439845 rpc/block: rework the way Block is JSONized
Our block.Block was JSONized in a bit different fashion than result.Block in
its NextConsensus and Index fields. It's not good for notifications because
third-party clients would probably expect to see the same format. Also, using
completely different Block representation is probably making our client a bit
weaker as this representation is harder to use with other neo-go components.

So use the same approach we took for Transactions and wrap block.Block which is
to be serialized in proper way.

Fix `Script` JSONization along the way, 3.0 node wraps it within `witnesses`.
2020-05-26 11:36:47 +03:00
Roman Khimov
725b47ddef rpc/client: add support for notification filters
Differing a bit from #895 draft specification, we won't add `sender` or
`cosigner` to `transaction_executed`.
2020-05-26 11:36:47 +03:00
Roman Khimov
c4c080d240 rpc: add subscriber queue overflow check
Server-side test is added, but disabled because of its unreliability.
2020-05-26 11:36:47 +03:00
Roman Khimov
bef14977a2 rpc/client: add notifications support for WSClient
It differs from #895 design in that we have Notifications channel always
exposed as WSClient field, probably it simplifies things a little.
2020-05-26 11:36:47 +03:00
Anna Shaleva
9f2cb1726b core: add witness check to nep5 transfer method
We have to check, whether transaction's sender is authorised to transfer
nep5 assets.
2020-05-20 23:34:27 +03:00
Anna Shaleva
7acf5b2841 core: add SystemFee and NetworkFee to transaction
closes #831
2020-05-20 23:26:48 +03:00
Evgenii Stratonikov
977c431bf1 vm: implement ASSERT/ABORT opcodes
Rename THROWIFNOT to ASSERT, add ABORT opcode.
ABORT cannot be caught, but the implementation should be postponed until
exception handling is implemented.
2020-05-06 15:54:19 +03:00
Roman Khimov
b04c8623c5
Merge pull request #925 from nspcc-dev/rpc-over-websocket
RPC over websocket
2020-05-06 12:52:58 +03:00
Roman Khimov
3de48d7d90 rpc/client: add minimalistic websocket client 2020-05-04 16:54:35 +03:00
Roman Khimov
a458a17748 rpc/client: separate out http-related functionality 2020-05-04 16:54:35 +03:00
Roman Khimov
6d202ad4c5 rpc/client: drop Version from Options
It makes no sense at all, it's a JSON-RPC version.
2020-05-04 16:54:35 +03:00
Roman Khimov
19397ec4a8 rpc/client: fix some comments 2020-05-04 16:54:35 +03:00
Roman Khimov
20d477cbd8 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-05-04 16:54:35 +03:00
Roman Khimov
315aabde56 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-05-04 16:54:35 +03:00
Anna Shaleva
73167999cc core: add cosigners field to transaction
closes #864
2020-05-04 11:53:31 +03:00
Anna Shaleva
08f5708edb core: remove Script attribute type 2020-05-04 11:49:14 +03:00
Anna Shaleva
29d321b5e1 *: drop miner transaction
1. Completely remove miner transaction

2. Change validation rule for block: block without transactions is
valid.
2020-04-27 17:57:37 +03:00
Anna Shaleva
55fd9f8d24 core: change block.ConsensusData to neo3 format
1. Dropped `Base.ConsensusData` block field

2. Added `Block.ConsensusData` field with `Nonce` and `PrimaryIndex`

3. Removed "Neo.Header.GetConsensusData" and
"AntShares.Header.GetConsensusData" interops
2020-04-27 17:57:37 +03:00
Anna Shaleva
aa554f0a9a core: update block timestamp format
Changed block.Timestamp from uint32 to uint64
2020-04-27 17:56:44 +03:00
Roman Khimov
2fa3bdf6a9 core/native: move Votes from account to native NEO state 2020-04-27 12:30:39 +03:00
Anna Shaleva
2b5c14160c core: add sender field to transaction
closes #860
2020-04-20 17:21:28 +03:00
Anna Shaleva
b809d09b24 rpc: add validUntilBlock to transferNEP5
In #856 I forgot to add validUntilBlock to NEP5 transfer transaction,
so added now.
2020-04-17 13:52:23 +03:00
Anna Shaleva
70da3c86f1 rpc: fix typo
Fixed typo in annotation of CalculateInputs method of RPC Client.
2020-04-15 13:46:44 +03:00
Anna Shaleva
5fa11987d2 core: add validUntilBlock field to transaction
1. closes #841

2. Commented out test cases where binary transaction are used.
These test cases marked with `TODO NEO3.0: Update binary` and need to be
updated.

3. Updated other tests.

4. Added cache to calculateValidUntilBlock() RPC-client method.
2020-04-15 13:46:43 +03:00
Anna Shaleva
65503aa9b4 core: add nonce field to transaction
1. Closes #840: added Nonce field to transaction.Transaction and
removed Nonce field from transaction.MinerTx

2. Added following methods to different tx types:
  - NewMinerTx()
  - NewMinerTxWithNonce(...)
  - NewEnrollmentTx(...)
  - NewIssueTx()
  - NewPublishTx(...)
  - NewRegisterTx(...)
  - NewStateTx(...)
in order to avoid code duplication when new transaction is created.

3. Commented out test cases where binary transaction/block are used.
These test cases marked with `TODO NEO3.0: Update binary` and need to be
updated.

4. Updated other tests

5. Added constant Nonce to GoveringTockenTx, UtilityTokenTx and genesis
block to avoid data variability. Also marked with TODO.
2020-04-14 16:19:41 +03:00
Anna Shaleva
d1f92a585b core: add NewTransactionFromBytes method to Transaction
Added `NewTransactionFromBytes(b []byte)` method to
transaction.Transaction in order to avoid code duplication.
2020-04-13 12:04:43 +03:00
Anna Shaleva
9c09ad9c89 rpc: fix marshalling of type-specific tx data
closes #585
2020-03-30 15:48:50 +03:00
Anna Shaleva
0be237beb6 rpc: fix double-pointer bugs in RPC Client
Fixed double-pointer bug in following methods:
	- GetRawTransactionVerbose
	- GetBlockVerbose
	- GetBlockHeader
	- GetTxOut
	- ValidateAddress
2020-03-27 16:04:11 +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
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
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
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
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
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
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
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
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
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
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