Evgenii Stratonikov
acea3867b2
smartcontract: implement ContextItem
2020-03-04 20:01:26 +03:00
Evgenii Stratonikov
46db4e9d9d
smartcontract: rename param_context.go to parameter.go
2020-03-04 20:01:26 +03:00
Evgenii Stratonikov
924d920423
smartcontract: support JSON unmarshaling of Signature param
2020-03-04 20:01:26 +03:00
Evgenii Stratonikov
7eaeb18f18
transaction: marshal ContractTX even if Data is nil
...
It contains no information so it doesn't matter anyway.
2020-03-04 20:01:26 +03:00
Evgenii Stratonikov
634e9483d3
transaction: unmarshal Witness properly
...
Both verification and invocation scripts need to
be unmarshaled from hex.
Also fix failing RPC tests: block contains non-pointer
`transaction.Witness` field and (*Witness).MarshalJSON method
is not called.
2020-03-04 20:01:26 +03:00
Evgenii Stratonikov
33f99104e8
transaction: unmarshal Output properly
...
Address is marshaled in base58 and needs to be
decoded accordingly.
2020-03-04 20:01:26 +03:00
Roman Khimov
1dd7c8d337
Merge pull request #719 from nspcc-dev/fix/rpc
...
smartcontract: fix bugs in paramter marshal/unmarshal
2020-03-04 19:58:56 +03:00
Evgenii Stratonikov
b4f8d66bd3
smartcontract: allow to marshal nil parameters
2020-03-04 19:55:04 +03:00
Evgenii Stratonikov
7cde58f731
smartcontract: adjust parameter value to type properly
2020-03-04 19:49:50 +03:00
Roman Khimov
9b04623edf
go.mod: fix dbft version, previous commit was wiped during "merge"
...
It wasn't really a merge, but rather rebase and ff-push.
2020-03-04 19:32:15 +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
ae6edf0601
core: add a check for fractional gas in invocation TXes
...
It's not allowed in C# code and that's reasonable as it's a sysfee essentially
that can only be integer.
2020-03-04 19:23:23 +03:00
Roman Khimov
823798514a
util: rename Int64Value to IntegralValue, add FractionalValue
...
Makes it's interface more clear and allows to easily access fractional part.
2020-03-04 19:23:23 +03:00
Roman Khimov
7cc847d655
transaction: add some missing InvocationTX decoding checks
...
Script must have something inside and GAS can't be negative.
2020-03-04 19:23:23 +03:00
Roman Khimov
8141d49e5a
Merge pull request #715 from nspcc-dev/rpc-doc-and-client
...
Update RPC docs, implement client-side getblock and getrawtransaction
2020-03-04 11:48:43 +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
7480ad1a4d
Merge pull request #710 from nspcc-dev/neo-go-nspcc-dev
...
nspcc-dev/neo-go
2020-03-03 17:36:24 +03:00
Roman Khimov
3af28e1de4
go.mod: update dbft to smth compatible with nspcc-dev/neo-go
2020-03-03 17:31:09 +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
59e6dac351
Merge pull request #708 from nspcc-dev/fix/trigger
...
core: convert trigger.Type to byte when pushing on stack
2020-03-03 16:17:01 +03:00
Evgenii Stratonikov
fe3bbbd78a
core: convert trigger.Type to byte when pushing on stack
2020-03-03 16:13:19 +03:00
Roman Khimov
032cb513a6
Merge pull request #707 from nspcc-dev/skip-outdated-headers-on-add
...
core: don't reverify stale headers in addHeader
2020-03-03 15:43:40 +03:00
Roman Khimov
f9a1535c75
Merge pull request #705 from nspcc-dev/rpc-drop-dup-invoke-types
...
Drop duplicating Invoke* types and vm.stackItem
2020-03-03 15:41:20 +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
56e37ad6ba
vm: drop duplicating stackItem structure, build JSON from Parameters
...
smartcontract.Parameter has everything needed now.
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
c3e73c5b7d
core: don't reverify stale headers in addHeader
...
During networked synchronization we expect there to be a lot of duplicate
headers received and it makes no sense for us reverifying them.
2020-03-03 15:34: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
Roman Khimov
657f5e46d0
Merge pull request #694 from nspcc-dev/feature/getclaimable
...
rpc, cli: support gas claim and asset transfer
2020-03-02 18:17:49 +03:00
Evgenii Stratonikov
1264b629f1
smartcontract: parse Struct item type same way as Array
2020-03-02 18:05:26 +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
6541bd4d42
vm: use Boolean
in (*BoolItem).String()
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
6add4f3e50
transaction: disallow negative outputs
...
Otherwise it is possible to make outputs which will sum
to the expected value, but steal GAS from some other account.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
9e9d59b49a
core: set NetworkFee to 0 for Claim and Miner transactions
...
Claim tx have no GAS inputs and a positive output which
can lead to negative network fee.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
21ef2638c0
consensus: log error if GetValidators() failed
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
de5215a564
core: use GetAccountStateOrNew() in (*Blockchain).GetValidators()
...
Target of the transaction output may not yet exist in database.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
ed190dcfd3
cli: add command for asset transfer
...
It uses getunspents RPC for getting UTXO and
forming transaction.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
1b9968df67
core: optimize CalculateClaimable()
...
Because accumulated system fee is stored for every block,
it is easy to calculate sum with just to reads.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
258d8be1dd
core: store all accumulated SystemFee with every block
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
f69c8a763b
core: store system fee together with block
...
Recalculating system fee can be rather costly if done
frequently.
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
907d599edb
cli: add command for GAS claiming
...
GAS can be claimed via `wallet claim` command.
This will claim first get all claimable outputs via
`getclaimable` RPC and then form a transaction signed
byte the private key from the wallet.
2020-03-02 18:01:49 +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
45b8669b42
core: verify Claim transactions
2020-03-02 18:01:49 +03:00
Evgenii Stratonikov
9d5841df38
rpc: make (*Client).SendRawTransaction public
2020-03-02 18:01:49 +03:00