Roman Khimov
bf1604454c
blockchainer/network: move StateSync interface to the user
...
Only network package cares about it.
2022-01-14 19:57:14 +03:00
Roman Khimov
508d36f698
network: drop consensus dependency
2022-01-14 19:55:53 +03:00
Anna Shaleva
6357af0bb0
network: fix race in TestHandleGetMPTData
...
Init server config before server start. Fixes the following data race:
```
WARNING: DATA RACE
Write at 0x00c00032ef20 by goroutine 26:
github.com/nspcc-dev/neo-go/pkg/network.TestHandleGetMPTData.func2()
/go/src/github.com/nspcc-dev/neo-go/pkg/network/server_test.go:755 +0x10a
testing.tRunner()
/usr/local/go/src/testing/testing.go:1193 +0x202
Previous read at 0x00c00032ef20 by goroutine 24:
github.com/nspcc-dev/neo-go/internal/fakechain.(*FakeChain).GetConfig()
/go/src/github.com/nspcc-dev/neo-go/internal/fakechain/fakechain.go:167 +0x6f
github.com/nspcc-dev/neo-go/pkg/network.(*Server).initStaleMemPools()
/go/src/github.com/nspcc-dev/neo-go/pkg/network/server.go:1433 +0x89
github.com/nspcc-dev/neo-go/pkg/network.(*Server).Start()
/go/src/github.com/nspcc-dev/neo-go/pkg/network/server.go:284 +0x288
github.com/nspcc-dev/neo-go/pkg/network.startWithChannel.func1()
/go/src/github.com/nspcc-dev/neo-go/pkg/network/server_test.go:91 +0x44
Goroutine 26 (running) created at:
testing.(*T).Run()
/usr/local/go/src/testing/testing.go:1238 +0x5d7
github.com/nspcc-dev/neo-go/pkg/network.TestHandleGetMPTData()
/go/src/github.com/nspcc-dev/neo-go/pkg/network/server_test.go:752 +0x8c
testing.tRunner()
/usr/local/go/src/testing/testing.go:1193 +0x202
Goroutine 24 (running) created at:
github.com/nspcc-dev/neo-go/pkg/network.startWithChannel()
/go/src/github.com/nspcc-dev/neo-go/pkg/network/server_test.go:90 +0x78
github.com/nspcc-dev/neo-go/pkg/network.startTestServer()
/go/src/github.com/nspcc-dev/neo-go/pkg/network/server_test.go:384 +0xbd
github.com/nspcc-dev/neo-go/pkg/network.TestHandleGetMPTData.func2()
/go/src/github.com/nspcc-dev/neo-go/pkg/network/server_test.go:753 +0x55
testing.tRunner()
/usr/local/go/src/testing/testing.go:1193 +0x202
```
2021-09-13 11:45:48 +03:00
Roman Khimov
601841ef35
*: drop unused structure fields
...
Found by structcheck:
`good` is unused (structcheck)
and alike.
2021-05-12 19:41:23 +03:00
Roman Khimov
0888cf9ed2
network: drop Network from Message
...
It's not used any more.
2021-03-26 13:45:18 +03:00
Anna Shaleva
2c81fc8b8e
*: upgrade tests to use T.Cleanup()
2021-03-01 17:08:00 +03:00
Anna Shaleva
4ad9c7929b
internals: move testchain from network to internals
...
It'll be useful for tests outside of the network pkg.
2021-02-02 22:01:32 +03:00
Anna Shaleva
bfbd096fed
core: introduce mempool notifications
2021-02-02 22:01:32 +03:00
Anna Shaleva
19fa0daaa6
core, network: add Notary module
2021-02-02 22:01:20 +03:00
Evgeniy Stratonikov
9592f3e052
network: implement pool for Extensible
payloads
2021-01-28 17:09:06 +03:00
Evgenii Stratonikov
43e4d3af88
oracle: integrate module in core and RPC
...
1. Initialization is performed via `Blockchain` methods.
2. Native Oracle contract updates list of oracle nodes
and in-fly requests in `PostPersist`.
3. RPC uses Oracle module directly.
2021-01-28 13:00:58 +03:00
Evgenii Stratonikov
0a5049658f
network: support non-blocking broadcast
...
Right now a single slow peer can slow down whole network.
Do broadcast in 2 parts:
1. Perform non-blocking send to all peers if possible.
2. Perform blocking sends until message is sent to 2/3 of good peers.
2020-12-25 14:36:52 +03:00
Roman Khimov
dee97d8542
Merge pull request #1524 from nspcc-dev/rpc/invoke_verify
...
rpc: add `invokecontractverify` RPC-method
2020-12-21 10:36:54 +03:00
Evgenii Stratonikov
62da365302
native: allow to modify StoragePrice
in the policy contract
2020-12-16 13:55:40 +03:00
Evgenii Stratonikov
1840c1c80d
core: redefine opcode prices
...
Prices are defined in as a coefficients to `BaseExecFee` which
is defined by Policy contract (TBD later).
Native method prices are defined without need to multiply.
2020-12-16 13:55:39 +03:00
Anna Shaleva
da5eb67e85
rpc: implement invokecontractverify
RPC method
2020-12-15 15:53:36 +03:00
Roman Khimov
ab12eee346
native: move contract deployment to management contract
...
See neo-project/neo#2119 .
2020-12-14 15:23:46 +03:00
Anna Shaleva
0b5cf78468
network: add notary request payload
2020-12-10 18:17:31 +03:00
Evgenii Stratonikov
27624946d9
network/test: add tests for server commands
2020-12-09 15:23:49 +03:00
Roman Khimov
2ce3c8b75f
network: treat unsolicited addr commands as errors
...
See neo-project/neo#2097 .
2020-11-25 13:34:38 +03:00
Evgenii Stratonikov
31eca342eb
*: replace all NEP5 occurences to NEP17
2020-11-24 13:08:24 +03:00
Evgenii Stratonikov
a5914f89fa
core: allow to provide block in GetTestVM()
...
Sometimes amount of GAS consumed depends on block height.
2020-11-24 12:17:29 +03:00
Evgenii Stratonikov
e38e8aa48a
rpc: implement getproof RPC
2020-11-20 18:06:22 +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
Evgenii Stratonikov
54992ad4f3
core: provide account in calculate claimable
...
`getunclaimedgas` RPC should return all GAS available to claim.
2020-11-10 16:08:21 +03:00
Anna Shaleva
15a939b1da
rpc: allow to getcontractstate
by address, id or name
...
close #1423
2020-11-03 17:23:49 +03:00
Anna Shaleva
ec63d5c456
core: add conflicts attribute
...
Close #1491
2020-10-29 10:57:31 +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
Anna Shaleva
770c8d774c
core, rpc: add GetCommittee method
...
Closes #1414
2020-09-21 15:56:25 +03:00
Evgenii Stratonikov
7e34072519
core: implement (*Blockchain).VerifyWitness
...
`ScriptFromWitness` is no longer useful, because we support
contract verification.
2020-08-22 12:45:20 +03:00
Roman Khimov
55b2cbb74d
core: refactor and improve verification and pooling
...
Now we have VerifyTx() and PoolTx() APIs that either verify transaction in
isolation or verify it against the mempool (either the primary one or the one
given) and then add it there. There is no possibility to check against the
mempool, but not add a transaction to it, but I doubt we really need it.
It allows to remove some duplication between old PoolTx and verifyTx where
they both tried to check transaction against mempool (verifying first and then
adding it). It also saves us utility token balance check because it's done by
the mempool anyway and we no longer need to do that explicitly in verifyTx.
It makes AddBlock() and verifyBlock() transaction's checks more correct,
because previously they could miss that even though sender S has enough
balance to pay for A, B or C, he can't pay for all of them.
Caveats:
* consensus is running concurrently to other processes, so things could
change while verifyBlock() is iterating over transactions, this will be
mitigated in subsequent commits
Improves TPS value for single node by at least 11%.
Fixes #667 , fixes #668 .
2020-08-20 18:50:18 +03:00
Roman Khimov
c8cc91eeee
network: request blocks when there is a ping with bigger than ours height
...
Turns out, C# node no longer broadcasts an Inv when it's creating a block,
instead it sends a ping and if we're not paying attention to the height
specified there we're technically missing a new block. Of course we'll get it
later after ping timer expiration and regular ping/pong sequence, but that's
delaying it for no good reason.
2020-08-14 16:22:15 +03:00
Roman Khimov
b1034d8ed6
state: drop Neo 2 Account and everything related
...
It's substituted with NEP5Balances now.
2020-08-11 20:42:02 +03:00
Evgenii Stratonikov
807338f97e
core: do not store NEP5 transfer log in memory
...
Traversing transfer log instead of accumulating and returning it
is faster and takes less memory.
2020-08-07 18:21:06 +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
791c983304
core: drop GetScriptHashesForVerifying
...
It no longer depends on blockchain state and there can't ever be an error, in
fact we can always iterate over signers, so copying these hashes doesn't make
much sense at all as well as sorting arrays in verifyTxWitnesses (witnesses
order must match signers order).
2020-08-07 12:21:52 +03:00
Evgenii Stratonikov
27169d140f
core: implement (*Blockchain).GetStandByCommitee()
2020-08-06 20:39:13 +03:00
Anna Shaleva
db65ed04d9
consensus: apply policy during verifyBlock
...
To follow C# implementation we should also check proposed block on
policy matching.
2020-08-04 10:59:09 +03:00
fyrchik
e4fc655115
Merge pull request #1239 from nspcc-dev/store_nep5_with_id
...
core: store contract IDs instead of hashes for NEP5Balances and Transfers
2020-07-30 12:56:19 +03:00
Evgenii Stratonikov
0e29382035
core: update MPT during block processing
...
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-07-30 12:42:15 +03:00
Anna Shaleva
dbd460d883
core: retrieve contract hash by ID
...
We'll need this ability further to retrieve contracts hashes for Nep5Balances.
2020-07-29 15:14:24 +03:00
Roman Khimov
7eef895061
consensus: use GetNextBlockValidators where appropriate
...
GetValidators without parameter is called upon DBFT initialization and it
should receive validators for the next block (that will create it),
parameterized GetValidators is used for NextConsensus calculation where we
need a list for the current state of the chain.
2020-07-11 19:54:50 +03:00
Anna Shaleva
abe3c94b95
core: use big.Int to store NEP5 balances
...
closes #1133
2020-07-09 13:26:39 +03:00
Anna Shaleva
0aaaf7f787
*: switch from fixed8 to int64 in (Blockchain).CalculateClaimable
2020-06-29 21:40:54 +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
e5f05790d5
core: cache standby validators in the Blockchain
...
They never change, so it makes no sense parsing the keys over and over
again. It also simplifies the interface a little.
2020-06-24 10:22:17 +03:00
Anna Shaleva
f1cdcbc99c
core: store smartcontract items by id
...
closes #1037
2020-06-19 20:48:45 +03:00
Evgenii Stratonikov
5354352d63
core: remove transaction priority
...
There is no such thing as high/low priority transactions, as there are
no free transactions anymore and they are ordered by fees contained
in transaction itself.
Closes #1063 .
2020-06-18 22:44:10 +03:00
Anna Shaleva
d5355acfa9
rpc: update RPC server invoke* calls
...
part of #1036
2020-06-11 19:34:13 +03:00
Roman Khimov
63f4f34659
mempool: drop TxWithFee type
...
All the fees are in transaction, this makes no sense.
2020-06-05 19:21:40 +03:00