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
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
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
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
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
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
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
Evgenii Stratonikov
95d9f36c98
core: implement UnclaimedBalance tracking
...
To make it easy to get unclaimed coins for the
specified account they must be tracked together.
2020-03-02 18:00:00 +03:00
Evgenii Stratonikov
7095ec6c51
core: implement (*Blockchain).CalculateClaimable
...
Calculating amount of GAS that can be claimed is required
for getclaimable RPC.
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
7d46404e2d
smartcontract: turn trigger types into Type
...
1) Turn trigger types from byte constants into Type
2) Add auto-generated stringer for future purposes
2020-03-02 17:25:27 +03:00
Anna Shaleva
b3621d4a86
smartcontract: remove unused structures
...
Removed following unused structures:
-smartcontract.ContextItem
-smartcontract.Signature
-smartcontract.ParameterContext
2020-03-02 17:25:27 +03:00
Anna Shaleva
535f391550
smartcontract: add marshaller for Parameter
...
1) Add marshaller and tests for smartcontract.Parameter
2) Add unmarshaller and tests for missing types of smartcontract.Parameter:
- MapType
- BoolType
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
a3dacd3b74
tests: replace t.Fatal with require where possible
...
This makes tests less verbose and unifies the style
they are written in.
2020-03-02 17:22:27 +03:00
Evgenii Stratonikov
66f96e3f32
core: shutdown Blockchain gracefully in tests
2020-03-02 17:22:27 +03:00
Evgenii Stratonikov
3a5224344e
core: verify headers in AddHeaders()
...
Headers can be malformed so public methods should verify them
before adding.
2020-03-02 17:22:26 +03:00
Evgenii Stratonikov
357bb4ce41
core: get rid of global variables in tests
...
It can lead to unnecessary race conditions and is just
a bad practice.
2020-03-02 17:04:08 +03:00
Evgenii Stratonikov
8ca94e23c8
core: replace makeBlocks() with addBlocks() in tests
...
This simplifies tests a bit.
2020-03-02 17:04:08 +03:00
Evgenii Stratonikov
cbf26bac83
mempool: do not allocate new slice for verified transactions
...
Because transactions a iterated in an increasing order,
we can filter slice in-place.
2020-03-02 10:38:27 +03:00
Evgenii Stratonikov
0ef7a76e84
network: batch transactions on broadcast
2020-03-02 10:37:27 +03:00
Roman Khimov
ff551d2015
Merge pull request #700 from nspcc-dev/fix/forloop
...
compiler: do not short-circuit in complex conditions
2020-02-28 20:14:26 +03:00
Roman Khimov
36197056b1
Merge pull request #691 from nspcc-dev/network-conn-overflow-and-shutdown
...
Network conn overflow and shutdown
2020-02-28 18:16:29 +03:00
Evgenii Stratonikov
b461a6ab63
compiler: do not short-circuit in complex conditions
...
Current implementation of short-circuting is just plain wrong
as it uses `last` or `before-last` labels which meaning depend
on context. It doesn't even handle simple assignements like
`a := x == 1 && y == 2`.
This commit makes all jumps in such conditions local
and adds tests.
Closes #699 , #700 .
2020-02-28 17:44:46 +03:00
Roman Khimov
e213e69a33
network: rework shutdown sequence of Server
...
Close transport and disconnect peers right in the Shutdown(), so that no new
connections would be accepted and so that all the peers would be disconnected
correctly (avoiding the same deadlock as in e2116e4c3f
).
2020-02-28 16:22:04 +03:00