Anna Shaleva
da5eb67e85
rpc: implement invokecontractverify
RPC method
2020-12-15 15:53:36 +03:00
Roman Khimov
cf8cf93e7a
native: change contract names, move them to separate package
...
Follow neo-project/neo#2138 and make RPC client's GetNativeContractHash
case-sensitive.
2020-12-14 15:24:15 +03:00
Roman Khimov
9a78f1da19
rpc/client: get policy contract hash in Init()
...
Drop hardcoded value.
2020-12-14 15:23:49 +03:00
Evgenii Stratonikov
df801a8539
rpc: marshal GAS in getunclaimedgas
as decimal
2020-12-09 11:19:25 +03:00
Evgenii Stratonikov
e4c3339c91
util: move Fixed8
to encoding/fixedn package
2020-12-09 11:18:18 +03:00
Roman Khimov
1cf1fe5d74
*: introduce stable contract hashes
...
Follow neo-project/neo#2044 .
2020-11-27 21:47:08 +03:00
Roman Khimov
b92ea2a48a
manifest/compiler: drop hashes from ABI and debug info
...
See neo-project/neo-devpack-dotnet#391 and neo-project/neo#2044 .
2020-11-26 18:30:49 +03:00
Evgenii Stratonikov
a79b12b4d4
rpc: marshal fees and GAS as Fixed8 decimal
2020-11-26 15:04:30 +03:00
Evgenii Stratonikov
7d91a3a89e
pkg: move internal/ package to the root directory
...
This way we can use it in scripts and cli.
2020-11-24 16:39:56 +03:00
Evgenii Stratonikov
31eca342eb
*: replace all NEP5 occurences to NEP17
2020-11-24 13:08:24 +03:00
Evgenii Stratonikov
c849176be7
manifest: include contract Name
2020-11-24 11:23:44 +03:00
Evgenii Stratonikov
1869d6d460
core: allow to use state root in header
2020-11-20 17:16:32 +03:00
Roman Khimov
286d9185f4
smartcontract: remove contract features
...
We're featureless now, all contracts have access to storage and payable status
is to be determined via new NEP. Follow neo-project/neo#2060 .
2020-11-13 21:26:23 +03:00
Roman Khimov
0f827ee6ba
Merge pull request #1531 from nspcc-dev/core/applicationlog_with_multiple_triggers
...
core, rpc: store multiple execution results for single hash
2020-11-12 19:05:22 +03:00
Anna Shaleva
0b15ca8bd0
rpc: add trigger parameter to getapplicationlog
2020-11-12 17:43:11 +03:00
Anna Shaleva
7ca93e76ac
core, rpc: allow to store several AppExecResult for a single hash
...
It is required for we have several executions per block.
2020-11-12 16:24:39 +03:00
Anna Shaleva
20f8fe5699
rpc: use base64 for submitblock
and sendrawtransaction
...
Changes ported from https://github.com/neo-project/neo-modules/pull/394 .
2020-11-12 15:21:35 +03:00
Roman Khimov
a9dddf893a
Merge pull request #1525 from nspcc-dev/rpc/base64
...
rpc: return bse64 bytes from `getblock`, `getblockheader`, `getrawtx`
2020-11-09 10:48:28 +03:00
Anna Shaleva
6bb81d9b51
rpc: return bse64 bytes from getblock
, getblockheader
, getrawtx
...
Close #1522
2020-11-09 10:29:33 +03:00
Anna Shaleva
6ee919747f
rpc: allow batch JSON-RPC requests
...
Close #1509
2020-11-06 17:06:20 +03:00
Anna Shaleva
b8a88f9378
rpc: allow to use address, id or name instead of scripthash [Client]
...
... for getcontractstate RPC client method.
2020-11-03 17:58:24 +03:00
Anna Shaleva
0da01fde7f
core: refactor blocked accounts logic
2020-10-23 11:42:30 +03:00
Anna Shaleva
590be7a58d
rpc, cli: remove Network from RPC client and cli
2020-10-19 16:11:11 +03:00
Anna Shaleva
474d2dfb65
rpc: add Magic to Version
2020-10-19 11:51:27 +03:00
Anna Shaleva
c50f3db6ad
rpc, cli: encode script in base64 for Invoke*
2020-10-19 11:51:27 +03:00
Anna Shaleva
19a2e3bb91
rpc: add transaction field to InvokeResult
2020-10-17 00:42:39 +03:00
Anna Shaleva
9a493dd2a0
rpc: add FaultException to result.Invoke
...
Close #1440
2020-10-08 16:12:14 +03:00
Anna Shaleva
fa0bd9f46b
rpc: getvalidators -> getnextblockvalidators
...
We don't have `getvalidators` RPS call, there's only
`getnextblockvalidators` in the reference implementation.
2020-10-01 17:09:14 +03:00
Roman Khimov
1ff1cd797e
Merge pull request #1419 from nspcc-dev/port-from-2.x
...
Port from 2.x
2020-09-22 21:56:29 +03:00
Roman Khimov
b958b5c9af
rpc/client: update GetNEP5Transfers call
2020-09-22 16:55:20 +03:00
Evgenii Stratonikov
3bba853c3e
rpc/client: use standard errors package in tests
2020-09-22 11:28:27 +03:00
Anna Shaleva
770c8d774c
core, rpc: add GetCommittee method
...
Closes #1414
2020-09-21 15:56:25 +03:00
Roman Khimov
1608fbff87
Merge pull request #1378 from nspcc-dev/tests/cli
...
Implement tests for CLI
2020-09-19 17:02:34 +03:00
Evgenii Stratonikov
e0f406fd3a
rpc/client: add constant to ValidUntilBlock
...
There are 2 problems:
1. `getvalidators` RPC can return empty list.
2. `+1` in single node can be too resrictive.
Proper solution for (1) may require requesting
standby validators. Here we add constant
to fix occasional test failures.
2020-09-18 12:07:02 +03:00
Roman Khimov
ce09c82b25
block: remove Verify()
...
It's used in two places now:
* Blockchain.AddBlock()
This one does transaction duplication check of its own, doing it in
Verify() is just a waste of time. Merkle tree root hash value check is
still relevant though
* Block.DecodeBinary()
We're decoding blocks for the following purposes:
- on restore from dump
The block will be added to the chain via AddBlock() and that will do a
full check of it (if configured to do so)
- on retrieving the block from the DB (DAO)
We trust the DB, if it's gone wild, this check won't really help
- on receiving the block via P2P
It's gonna be put into block queue and then end up in AddBlock() which
will check it
- on receiving the block via RPC (submitblock)
It is to be passed into AddBlock()
- on receiving the block via RPC in a client
That's the only problematic case probably, but RPC client has to trust
the server and it can check for the signature if it really
cares. Or a separate in-client check might be added.
As we can see nothing really requires this verification to be done the way it
is now, AddBlock can just have a Merkle check and DecodeBinary can do fine
without it at all.
2020-09-16 12:50:13 +03:00
Anna Shaleva
acacac1b24
rpc: use state.AppExecResult for ApplicationLog marshalling
...
Closes #1371
2020-09-07 13:38:32 +03:00
Anna Shaleva
0834661cac
rpc: marshal getapplicationlog
stack as []stackitem.Item
...
Following https://github.com/neo-project/neo-modules/issues/318
2020-08-13 17:16:31 +03:00
Roman Khimov
0e2784cd2c
always wrap errors when creating new ones with fmt.Errorf()
...
It doesn't really change anything in most of the cases, but it's a useful
habit anyway.
Fix #350 .
2020-08-07 12:21:52 +03:00
Roman Khimov
5ef08f60ae
remove github.com/pkg/errors from dependencies
...
It's not needed any more with Go 1.13 as we have wrapping/unwrapping in base
packages. All errors.Wrap calls are replaced with fmt.Errorf, some strings are
improved along the way.
2020-08-07 12:21:52 +03:00
Roman Khimov
ef53a45e7a
Merge pull request #1264 from nspcc-dev/smartcontract/manifest/supported_standards
...
smartcontract: add list of supported standards to manifest
2020-08-04 22:17:00 +03:00
Anna Shaleva
90825efa16
core: move transaction's sender to cosigners
...
Closes #1184
Ported changes from https://github.com/neo-project/neo/pull/1752
2020-08-04 17:33:50 +03:00
Anna Shaleva
66ceaa6b75
smartcontract: add list of supported standards to manifest
...
Closes #1204
2020-08-04 17:29:44 +03:00
Evgenii Stratonikov
9cba25616d
rpc: use raw stack items in invoke*
RPC
...
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 16:07:16 +03:00
Evgenii Stratonikov
b53f0257f5
stackitem: change ByteArray type to ByteString
...
Adjust only string representation.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-31 16:07:16 +03:00
Evgenii Stratonikov
e52c39ae7e
manifest: remove EntryPoint from manifest
2020-07-27 11:08:01 +03:00
Anna Shaleva
889a5d7eb6
rpc: adjust submitblock
RPC-call
...
It should return block hash instead of boolean.
2020-07-22 08:37:53 +03:00
Anna Shaleva
c2534b1a0b
rpc: adjust sendrawtransaction
RPC-call
...
It should return tx has instead of boolean.
2020-07-22 08:37:46 +03:00
Anna Shaleva
2ab23dc56a
rpc: adjust getunclaimedgas
RPC-call
...
Part of #1130
2020-07-15 14:45:51 +03:00
Anna Shaleva
3a3cd0353d
rpc: adjust invokefunction
RPC-call JSON fields names
...
Part of #1130
2020-07-15 14:44:22 +03:00
Anna Shaleva
48ccdb09d4
rpc: adjust getversion
RPC-call JSON fields names
...
Part of #1130
2020-07-15 14:44:22 +03:00
Anna Shaleva
538616e9f8
rpc: adjust getrawtransaction
RPC-call JSON fields names
...
Part of #1130
2020-07-15 14:44:13 +03:00
Anna Shaleva
72a6740717
rpc: adjust getcontractstate
RPC-call JSON fields names
...
Part of #1130
2020-07-09 17:34:53 +03:00
Anna Shaleva
15f7b78a8c
rpc: adjust getnep5transfers
RPC-call JSON fields names
...
Part of #1130
2020-07-09 17:34:53 +03:00
Anna Shaleva
dc273736be
rpc: adjust getnep5balances
RPC-call JSON fields names
...
Part of #1130
2020-07-09 17:34:53 +03:00
Anna Shaleva
e81ccb7deb
rpc: adjust getblock
RPC-call JSON fields names
...
Part of #1130
2020-07-09 17:34:53 +03:00
Anna Shaleva
51576f236d
rpc: adjust getapplicationlog
RPC-call JSON fields names
...
Part of #1130
2020-07-09 17:34:53 +03:00
Evgenii Stratonikov
27b3054df4
transaction: set feePerByte on tx construction
2020-07-03 17:52:13 +03:00
Roman Khimov
4f8e4628dc
cli/rpc: hide parameter encoding details for Invoke* calls
...
The script is passed as a hex string, but no one should care. The hash is a
hex-encoded LE value, but no one should care either. Hex might change to
base64, LE to BE, no one outside these functions should care about that.
2020-07-02 16:41:34 +03:00
Anna Shaleva
73b630db9b
*: switch from fixed8 to int64
...
Follow C# implementation, we have to marshall JSON Fixed8 fields without
taking into account decimals.
2020-06-29 21:39:27 +03:00
Roman Khimov
5251607fb7
transaction: s/txid/hash/ for JSON to match C# implementation
...
It uses `hash` for transactions now, but `txid` for application logs.
2020-06-24 10:43:58 +03:00
Roman Khimov
0fdeafb8f7
Merge pull request #1058 from nspcc-dev/neo3/smartcontract/policy
...
core: add native policy contract
2020-06-24 09:37:29 +03:00
Anna Shaleva
b88863948d
rpc: add native policy API to RPC client
...
part of #904
2020-06-24 07:58:09 +03:00
Anna Shaleva
65c1ce4f6a
rpc: add GetStorageByID RPC client method
...
Should be a part of #1077
2020-06-23 17:31:22 +03:00
Evgenii Stratonikov
3787a8895e
rpc: marshal GasConsumed getapplicationlog
as string
...
Also there is no more decimal point.
2020-06-19 11:38:56 +03:00
Evgenii Stratonikov
c0e482fe6c
rpc: restructure getapplicationlog
response
...
Move VM-related fields to top-level.
2020-06-19 11:38:56 +03:00
Roman Khimov
b483c38593
block/transaction: add network magic into the hash
...
We make it explicit in the appropriate Block/Transaction structures, not via a
singleton as C# node does. I think this approach has a bit more potential and
allows better packages reuse for different purposes.
2020-06-18 12:39:50 +03:00
Roman Khimov
8fda6a3407
block: fix ConsensusData hashing
...
It's DoubleSha256 as with the rest of the structures.
2020-06-18 12:22:49 +03:00
Roman Khimov
5fe8287fbb
rpc: use non-pointer Block and Transaction in results
...
Pointers can be nil and in some cases it's important to always have access to
Block or Transaction fields.
2020-06-18 12:13:35 +03:00
Roman Khimov
d22286cbbc
client/cli: add network option to the RPC client
...
It doesn't affect anything yet, but it's going to be used in the future for
network-specific behavior. It also renames short '--timeout' form to '-s'
avoiding conlict with '-t' used for '--testnet'.
2020-06-18 12:11:13 +03:00
Evgenii Stratonikov
7b4ca57e33
*: change address to the new format
...
NEO3 uses new prefix for address (53 = 0x35), thus string representations as
well as encrypted WIFs should be changed.
2020-06-17 15:58:21 +03:00
Anna Shaleva
3568ab3d6d
core: add json marshaller for Cosigner's scopes
...
Following C# implementation, we should marshal Scopes as a set of
strings instead of single byte.
2020-06-15 13:48:15 +03:00
Roman Khimov
fe31c7ed2d
Merge pull request #1047 from nspcc-dev/neo3/rpc/invoke
...
rpc: update invoke* RPC-calls
2020-06-11 21:39:20 +03:00
Anna Shaleva
9e7fca013e
rpc: update CLI and RPC client invoke* calls
...
part of #1036
2020-06-11 20:32:05 +03:00
Evgenii Stratonikov
df958caf93
core: add Manifest to state.Contract
2020-06-11 10:45:24 +03:00
Anna Shaleva
3418e4f7f4
rpc: update getversion
RPC-call
...
closes #1035
2020-06-10 10:47:11 +03:00
Evgenii Stratonikov
b28a8f2548
rpc: encode ContractState.Script in base64
2020-06-08 10:40:52 +03:00
Evgenii Stratonikov
138385e512
transaction: encode Script in base64
2020-06-08 10:31:51 +03:00
Evgenii Stratonikov
96c2cc0322
smartcontract: marshal ByteArray and Signature in base64
2020-06-08 10:27:39 +03:00
Evgenii Stratonikov
1fa25efa79
transaction: encode witness scripts in base64
2020-06-08 10:23:56 +03:00
Roman Khimov
3677358057
rpc/result: fix block confirmations counting
...
It should be the same as for headers and transactions.
2020-06-05 19:27:39 +03:00
Roman Khimov
709146f295
transaction: drop Inputs and Outputs, forget UTXO
2020-06-05 19:20:16 +03:00
Roman Khimov
21efccd300
transaction: remove type field, set Version to 0
...
Two changes being done here, because they require a lot of updates to
tests. Now we're back into version 0 and we only have one type of
transaction.
It also removes GetType and GetScript interops, both are obsolete in Neo 3.
2020-06-05 19:20:16 +03:00
Roman Khimov
f445f7c602
transaction: drop Contract transaction type
2020-06-05 19:20:16 +03:00
Roman Khimov
c6ae954e4e
rpc: drop getaccountstate method
...
It's not relevant for Neo 3.
2020-06-05 19:20:16 +03:00
Roman Khimov
657bb7575e
rpc: change getunclaimed to getunclaimedgas
...
getunclaimed doesn't exist on Neo 3 and getunclaimedgas works for NEP5 GAS.
2020-06-05 19:20:16 +03:00
Roman Khimov
d856df36a7
rpc: drop support for gettxout method
...
Neo 3 doesn't need it.
2020-06-05 19:20:16 +03:00
Roman Khimov
232e1a2598
rpc: drop support for getassetstate
...
It's for UTXO assets and it's absent in Neo 3.
2020-06-05 19:20:16 +03:00
Roman Khimov
63eb6069b2
rpc: drop support for getunspents method
...
Irrelevant for Neo 3.
2020-06-05 19:20:16 +03:00
Roman Khimov
670396b908
rpc: drop getclaimable RPC call support
...
It's not present in NEO 3 and it's not needed there.
2020-06-05 19:20:16 +03:00
Roman Khimov
a446821753
Merge pull request #980 from nspcc-dev/neo3/protocol/version_payload_optimisation
...
protocol: add node capabilities
2020-05-27 19:13:00 +03:00
Anna Shaleva
c590cc02f4
protocol: add capabilities to version payload
...
closes #871
2020-05-27 19:01:14 +03:00
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
Anna Shaleva
7acf5b2841
core: add SystemFee and NetworkFee to transaction
...
closes #831
2020-05-20 23:26:48 +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
Anna Shaleva
73167999cc
core: add cosigners field to transaction
...
closes #864
2020-05-04 11:53:31 +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