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
41af738c1b
state: drop (*NEP5TransferLog).DecodeBinaryReturnCount
...
It's no longer needed.
2020-09-22 19:21:12 +03:00
Roman Khimov
a53bc6b13e
docs: update RPC documentation with getnep5transfers changes
2020-09-22 16:55:20 +03:00
Roman Khimov
b958b5c9af
rpc/client: update GetNEP5Transfers call
2020-09-22 16:55:20 +03:00
Roman Khimov
6b7ca0ce3f
rpc/server: limit the maximum number of elements for get*transfers
2020-09-22 16:45:01 +03:00
Roman Khimov
970de84130
rpc: add paging to getnep5transfers call
...
And add some tests.
2020-09-22 16:40:29 +03:00
Roman Khimov
db056c1dd8
Merge pull request #1417 from nspcc-dev/fix/errors
...
rpc/client: use standard errors package in tests
2020-09-22 12:39:07 +03:00
Evgenii Stratonikov
3bba853c3e
rpc/client: use standard errors package in tests
2020-09-22 11:28:27 +03:00
Roman Khimov
c50ff7f20e
rpc/server: refactor parameter parsing for getnep5transfers
2020-09-21 22:38:59 +03:00
Roman Khimov
e4b52d3947
core/rpc: add continue
flag to iterating functions
...
Most of the time we don't need to get all transfers from the DB and
deserialize them.
2020-09-21 22:23:34 +03:00
Roman Khimov
373c669c6a
core/state: reverse the order of ForEachTransfer
...
When using limits we're usually concerned about the most recent
transfers. Returning 3 transfers from the middle of the chain isn't very
helpful.
2020-09-21 22:05:15 +03:00
Roman Khimov
ff11a5f990
state: use more efficient encoding for amount
...
It's variable-length anyway, so wasting 8 bytes for what typically is 1 byte
makes no sense.
2020-09-21 21:51:33 +03:00
Roman Khimov
806b89db76
state: store the length of NEP5TransferLog in the first byte
...
We lose `size` field after serialization/deserialization which can lead to
adding more than NEP5TransferBatchSize elements into the NEP5TransferLog.
2020-09-21 21:51:11 +03:00
Roman Khimov
6902003044
rpc/server: add limit to get*transfers calls
...
Return only N transfers requested.
2020-09-21 18:03:59 +03:00
Evgenii Stratonikov
fc77f8b5b2
consensus: exit if wrong password is provided in configuration
2020-09-21 17:56:25 +03:00
Roman Khimov
0c264b1486
mpt: fix comment typo
2020-09-21 17:54:11 +03:00
Roman Khimov
f0f676eb1c
Merge pull request #1416 from nspcc-dev/rpc/getcommittee
...
core, rpc: add GetCommittee method
2020-09-21 17:29:16 +03:00
Anna Shaleva
770c8d774c
core, rpc: add GetCommittee method
...
Closes #1414
2020-09-21 15:56:25 +03:00
Roman Khimov
dbfdfd8e9b
Merge pull request #1413 from nspcc-dev/core/block_aer_marshalling
...
core: do not marshal block hash in application log
2020-09-21 14:22:17 +03:00
Anna Shaleva
c6f099294b
core: do not marshal block hash in application log
...
Closes #1388
2020-09-21 14:08:15 +03:00
Roman Khimov
a439941a71
Merge pull request #1407 from nspcc-dev/core/oracleattr
...
Implement OracleResponse transaction attribute
2020-09-21 12:55:10 +03:00
Roman Khimov
a9f5fe424d
Merge pull request #1411 from nspcc-dev/fix-panic-in-cli-tests
...
consensus: wait goroutine to finish on Shutdown
2020-09-21 09:45:24 +03:00
Roman Khimov
15b621f0f3
consensus: wait goroutine to finish on Shutdown
...
Fixes:
panic: assignment to entry in nil map
goroutine 227 [running]:
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemoryStore).put(...)
/home/rik/dev/neo-go/pkg/core/storage/memory_store.go:53
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemoryStore).PutBatch(0xc00035f580, 0x110a680, 0xc000336750, 0x0, 0x0)
/home/rik/dev/neo-go/pkg/core/storage/memory_store.go:93 +0x286
github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).addHeaders(0xc0000a2340, 0xc0001be301, 0xc00036d428, 0x1, 0x1, 0x0, 0x0)
/home/rik/dev/neo-go/pkg/core/blockchain.go:516 +0xd5a
github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).AddBlock(0xc0000a2340, 0xc0000bc2c0, 0x0, 0x0)
/home/rik/dev/neo-go/pkg/core/blockchain.go:407 +0x9ca
github.com/nspcc-dev/neo-go/pkg/consensus.(*service).processBlock(0xc000152160, 0x1122320, 0xc0000bc2c0)
/home/rik/dev/neo-go/pkg/consensus/consensus.go:440 +0xbf
github.com/nspcc-dev/dbft.(*DBFT).checkCommit(0xc0000d3400)
/home/rik/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20200911152629-be965ee4d449/check.go:71 +0x918
github.com/nspcc-dev/dbft.(*DBFT).checkPrepare(0xc0000d3400)
/home/rik/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20200911152629-be965ee4d449/check.go:36 +0x465
github.com/nspcc-dev/dbft.(*DBFT).sendPrepareRequest(0xc0000d3400)
/home/rik/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20200911152629-be965ee4d449/send.go:42 +0x2f8
github.com/nspcc-dev/dbft.(*DBFT).start(0xc0000d3400)
/home/rik/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20200911152629-be965ee4d449/dbft.go:269 +0x26f
github.com/nspcc-dev/dbft.(*DBFT).Start(0xc0000d3400)
/home/rik/go/pkg/mod/github.com/nspcc-dev/dbft@v0.0.0-20200911152629-be965ee4d449/dbft.go:82 +0x59
github.com/nspcc-dev/neo-go/pkg/consensus.(*service).Start(0xc000152160)
/home/rik/dev/neo-go/pkg/consensus/consensus.go:191 +0x56
github.com/nspcc-dev/neo-go/pkg/network.(*Server).tryStartConsensus(0xc000235040)
/home/rik/dev/neo-go/pkg/network/server.go:311 +0xda
github.com/nspcc-dev/neo-go/pkg/network.(*Server).Start(0xc000235040, 0xc0000faba0)
/home/rik/dev/neo-go/pkg/network/server.go:173 +0x202
created by github.com/nspcc-dev/neo-go/cli.newTestChain
/home/rik/dev/neo-go/cli/executor_test.go:77 +0x47d
FAIL github.com/nspcc-dev/neo-go/cli 14.479s
2020-09-19 21:49:05 +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
Roman Khimov
bdee702f76
Merge pull request #1410 from nspcc-dev/fix-potential-consensus-stall
...
consensus: fix potential system deadlock
2020-09-18 12:42:52 +03:00
Evgenii Stratonikov
bff67c921a
core: wrap dao in GetTestVM
...
MPT must not be shared to the test VM.
Fix DATA RACE between `Collapse()` and RPC calls.
2020-09-18 12:07:02 +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
Evgenii Stratonikov
914b12af44
network: fix datarace in TCPTransport
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
fd98a9194a
cli: add tests for wallet dump
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
40a24bad64
cli: add tests for wallet import-deployed
...
Fix bugs with import, allow to sign tx with contract.
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
583ef546f9
cli: add tests for wallet claim
...
Fix a NEO contract hash used in tx.
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
dff2ac1387
cli: add test for candidate register/unregister/vote
...
Also fix a bug with tx signing.
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
6e5a637da9
cli: add tests for multisig sign
...
This test is also a good example of how to
create and sign multisig transaction from scratch.
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
9817da7c4e
cli: add tests for nep5 import/remove
...
Also unify `remove` and `import` arguments.
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
075f353062
cli: add tests for nep5 multitransfer
...
Also fix a bug when token's hash was incorrectly processed.
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
59157724e3
cli: add tests for wallet remove
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
4c00b26fb8
cli: add tests for wallet import-multisig
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
0a5fe84589
cli: add tests for wallet export
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
5d7f177811
cli: add tests for wallet/account creation
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
d30c7db49a
cli: add tests for NEP5 transfer
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
468f7ee650
cli: add tests for NEP5 balance querying
2020-09-18 12:07:02 +03:00
Evgenii Stratonikov
282b55494b
consensus: allow to shutdown service
2020-09-18 12:07:01 +03:00
Evgenii Stratonikov
0dda247719
cli: move input handling to a separate package
2020-09-18 12:05:31 +03:00
Evgenii Stratonikov
758a88a813
rpc: exit from Start after Listener is running
...
If port is dynamically allocated, `(*Server).Addr` will contain
0 port. This commit executes listener before exiting from `Start()`
and sets Addr to the actual address.
2020-09-18 12:05:31 +03:00
Evgenii Stratonikov
911be78cc7
cli: use Writer from app instead of Stdout
...
It is useful in tests.
2020-09-18 12:05:31 +03:00
Roman Khimov
af6a6f5f30
consensus: fix potential system deadlock
...
There is a notification pushed into the channel when block is being added,
that notification is read by special goroutine that then forwards it to all
subscribers to that particular event. Consensus goroutine is one of that
subscribers, so for the system to properly function it has to read these
events, but at the same time it can generate new blocks inside, so in some
cases it can generate two blocks without ever reading from the subscription
channel and this will lead to a deadlock.
To avoid that we need to check subscription channel for events on every loop.
2020-09-18 10:21:47 +03:00
Roman Khimov
1dc93216ee
Merge pull request #1408 from nspcc-dev/header-hash-list
...
Header hash list optimization
2020-09-16 17:52:44 +03:00
Roman Khimov
61ad82160b
core: remove named return variable from addHeaders()
2020-09-16 17:45:12 +03:00
Roman Khimov
6bffa811d4
core: remove (*block.Block) checks for topBlock
...
If it's non-nil, it has *block.Block inside. If it doesn't --- tell everyone
about it with a nice panic message.
2020-09-16 17:40:27 +03:00
Roman Khimov
33ea179f6e
core: remove forward index check from addHeaders()
...
It can't ever happen. We're guaranteed to have a consistent chain of headers
(we're verifying them above, if we're not verifying --- it's not our fault)
that starts at HeaderHeight that was actual when we were asking for it
previously. HeaderHeight can only move forward, so if that happened that would
be filtered out by the condition below and the first one can't happen. Though
to be absolutely sure change the second check to only pass "+1" headers (which
is what we want).
2020-09-16 16:33:42 +03:00