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
Evgenii Stratonikov
9c7168e4e8
rpc/client: allow to use contract accounts in AddNetworkFee
2020-08-27 11:32:55 +03:00
Evgenii Stratonikov
72ca8b79c3
rpc/client: provide sender in CreateNEP5MultiTransferTx
...
Specify scope explicitly.
Fix #1354 .
2020-08-25 09:21:06 +03:00
Evgenii Stratonikov
6bdaefcfa4
rpc/client: use CreateTxFromScript
where possible
...
There is substantial overlap between `CreateTxFromScript` and
`SignAndPushInvocationTx`. This commit refactors both of them
to reuse common code.
2020-08-18 11:24:48 +03:00
Evgenii Stratonikov
16b10ab918
rpc/client: drop (*Client).wif
...
It isn't used internally and has no value.
2020-08-18 11:24:48 +03:00
Evgenii Stratonikov
8699a4c1a9
rpc/client: provide scripts in AddNetworkFee
...
To calculate network fee properly we must know type of every
signer (simple, multisig, contract). Providing scripts is the most
simple and flexible way to know this.
2020-08-18 11:24:48 +03:00
Roman Khimov
e7d13e6db2
*: fix misspellings found in Go Report Card
2020-08-14 12:16:24 +03:00
Roman Khimov
70cc8b89e8
Merge pull request #1323 from nspcc-dev/fix/clienttests
...
rpc: fix (*Client).BalanceOf
2020-08-14 11:54:36 +03:00
Evgenii Stratonikov
a8cda69bc3
rpc: fix (*Client).BalanceOf
...
Add missing argument and write tests.
2020-08-14 11:19:24 +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
b31e18096f
rpc/client: remove obsolete retry from invokeSomething()
...
All preview3 nodes have proper support for scoped signers in parameters.
2020-08-11 21:21:38 +03:00
Roman Khimov
c3c88a57cd
Merge pull request #1281 from nspcc-dev/drop-go-1.12-and-fix-some-things
...
Drop go 1.12 and fix some things
2020-08-07 13:34:54 +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
Evgenii Stratonikov
05c24d9401
cli: support voting
...
Closes #1206 .
2020-08-06 20:39:13 +03:00
Roman Khimov
4bbe863904
Merge pull request #1266 from nspcc-dev/notifications/filter_by_name
...
rpc: filter subscriptions' notifications by name
2020-08-05 10:00:15 +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
Roman Khimov
49688de75c
Merge pull request #1260 from nspcc-dev/feature/sendmany
...
cli: allow to transfer multiple tokens in `multitransfer`
2020-08-04 19:35:03 +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
Anna Shaleva
4ff3a9e9a7
rpc: filter subscriptions' notifications by name
...
Closes #1263
2020-08-04 16:29:13 +03:00
Evgenii Stratonikov
2dd6ef964e
cli: allow to transfer multiple tokens in multitransfer
...
Like this:
./neogo wallet nep5 multitransfer -w wallet1_solo.json
--from NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK -r http://127.0.0.1:30333
neo:NYqxsNMHxDg3T19APYP27mBZFfauC4zngR:2
neo:NVNvVRW5Q5naSx2k2iZm7xRgtRNGuZppAK:3
gas:NYqxsNMHxDg3T19APYP27mBZFfauC4zngR:2
2020-08-04 10:36:06 +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
805f746f15
rpc: change NotificationEvent format
...
Name is now a separate field.
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
Anna Shaleva
4bf88ba6b0
core: decouple native contracts from interop service
...
Closes #1191 .
2020-07-29 10:33:18 +03:00
fyrchik
0d558ef95e
Merge pull request #1230 from nspcc-dev/feature/multitransfer
...
Generate multitransfer NEP5 transactions on client
2020-07-29 09:50:49 +03:00
Evgenii Stratonikov
e52c39ae7e
manifest: remove EntryPoint from manifest
2020-07-27 11:08:01 +03:00
Evgenii Stratonikov
e013477bc9
rpc,cli: support multitransfer transactions
...
Allow to transfer single asset to multiple recepients
in a single transaction. It is currently a separate command in CLI
and can be merged in future.
2020-07-24 17:01:30 +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
Anna Shaleva
7b90ad9337
rpc: fix cosigner scope in CreateNEP5TransferTx
...
It should be the same as transaction's cosigner scope.
2020-07-06 11:03:21 +03:00
Anna Shaleva
966ad8a0b1
rpc: fix adding extra network fee to tx
2020-07-06 11:02:57 +03:00
Anna Shaleva
1880e96844
cli: fix contract deploy&invoke
...
We should add cosigners to deplyment and invocation transactions.
2020-07-06 10:01:14 +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
Roman Khimov
17ea6411a2
rpc/client: ensure compatibility with preview2 C# node for invoke*
...
It won't work with proper cosigners and the client must be compatible both
with neo-go and C# node. See neo/neo-modules#260 also.
2020-07-02 16:40:32 +03:00
Roman Khimov
cc95d559cc
rpc/client: unify invoke* functions
2020-07-02 16:40:32 +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
Evgenii Stratonikov
35f952e44f
rpc/server: simplify errors handling during parameter parsing
...
Forward-ported from 2.x with some updates.
2020-06-27 12:11:21 +03:00
alexvanin
cfa0c6e0ad
cli: update hardcoded script hashes for neo and gas contracts
...
Use LittleEndian as preferred way to encode script-hashes
2020-06-26 16:22:02 +03:00
Evgenii Stratonikov
f66199c99f
cli: hardcode NEO and GAS token info
...
Don't make extra network queries for already known contracts.
2020-06-25 17:21:26 +03:00
Evgenii Stratonikov
3e3781168d
rpc/client: do not query contract for account if it is in the wallet
2020-06-25 17:21:26 +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
0af5b9339d
rpc, cli: remove invoke
RPC-call
...
part of #1036
2020-06-10 20:30:55 +03:00
Anna Shaleva
3418e4f7f4
rpc: update getversion
RPC-call
...
closes #1035
2020-06-10 10:47:11 +03:00
Roman Khimov
795523f5cd
Merge pull request #1013 from nspcc-dev/neo3/vm/stackitem_refactoring
...
vm: move StackItem to a separate package
2020-06-08 15:30:44 +03:00
Anna Shaleva
7ca2807875
vm/encoding: move bigint from vm to encoding package
2020-06-08 13:27:13 +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
337e65b696
rpc: drop UTXO transfer support, remove Balancer
...
Nothing uses them now and they're irrelevant for Neo 3.
2020-06-05 19:20:16 +03:00
Roman Khimov
c0e044961d
cli/wallet: add ability to save NEP5 transfer transaction
...
It allows to use multisig cli operations for multisig transaction creation and
send.
2020-06-05 19:20:16 +03:00
Roman Khimov
9a4e53b58e
rpc/client: no longer add UTXO GAS for fees
...
It's already being paid with NEP5 GAS.
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
3b2644da4f
rpc/client: pass token as simple hash into TransferNEP5
...
It doesn't need full wallet.Token structure.
2020-06-05 19:20:16 +03:00
Roman Khimov
ed0a3e4af5
rpc/client: drop neoscan support
...
It was used as getunspents substitute and it's not longer relevant for NEO 3.
2020-06-05 19:20:16 +03:00
Roman Khimov
d9400800e3
transaction: drop Gas field from InvocationTX
...
It essentialy is the new SystemFee, so use that. Had to increase GAS transfer
in test chain to 1000 to pay for deployment.
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
alexvanin
aca6f2f3ad
rpc/client: handle client creation error in new wsclient
...
Client returns error if it can't parse endpoint string. WSClient
should check client error or there could be panic at `cl.cli = nil`
expression.
2020-05-26 11:36:47 +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
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