Commit graph

124 commits

Author SHA1 Message Date
Evgenii Stratonikov
9f26d7b249 core: add tests for Blockchain.isTxStillRelevant() 2020-11-26 16:04:43 +03:00
Evgenii Stratonikov
3a986d8635 core: add test for RemoveUntraceableBlocks setting 2020-11-26 12:33:34 +03:00
Roman Khimov
882c214646
Merge pull request #1561 from nspcc-dev/removeold
core: remove old blocks and transactions
2020-11-25 19:14:32 +03:00
Anna Shaleva
17842dabd6 core: implement native Notary contract 2020-11-25 18:37:29 +03:00
Anna Shaleva
52cf328296 core: add NotaryAssisted transaction attribute 2020-11-25 18:37:29 +03:00
Anna Shaleva
8cdf2d3464 core: unify verifyTxAttributes errors
We already have pretty ErrInvalidAttribute error, so I think that all
other `verifyTxAttributes` errors should be wrappers around ErrInvalidAttr.
2020-11-25 18:37:29 +03:00
Evgenii Stratonikov
54b177cf40 dao: store blocks/txransactions by big-endian hash
There is no need for additional allocations.
2020-11-25 14:03:43 +03:00
Evgenii Stratonikov
67f26859a8 scripts: implement script for creating dumps
This is useful for creating dumps providing various load
to benchmark restore or check compatibility with C# nodes.

Related #1472.
2020-11-24 16:47:33 +03:00
Evgenii Stratonikov
6f7284906a blockchainer: allow to dump/restore chain 2020-11-24 16:43:11 +03:00
Evgenii Stratonikov
7d91a3a89e pkg: move internal/ package to the root directory
This way we can use it in scripts and cli.
2020-11-24 16:39:56 +03:00
Evgenii Stratonikov
31eca342eb *: replace all NEP5 occurences to NEP17 2020-11-24 13:08:24 +03:00
Evgenii Stratonikov
b97dfae8d8 native: replace NEP-5 with NEP-17 2020-11-24 13:08:23 +03:00
Evgenii Stratonikov
1869d6d460 core: allow to use state root in header 2020-11-20 17:16:32 +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
Roman Khimov
bdd073aad7
Merge pull request #1520 from nspcc-dev/tune-some-limits
Tune some limits
2020-11-06 15:35:44 +03:00
Roman Khimov
9e781bff47 native: implement designate contract history retention
Follow neo-project/neo#2007. Fix getDesignatedByRole price along the way.
2020-11-06 13:46:40 +03:00
Roman Khimov
b233158c9f transaction: lower MaxValidUntilBlockIncrement
Follow neo-project/neo#2042.
2020-11-06 13:41:46 +03:00
Anna Shaleva
ec63d5c456 core: add conflicts attribute
Close #1491
2020-10-29 10:57:31 +03:00
Anna Shaleva
09b8b8de73 core: reserve attributes range for experimantal purposes 2020-10-23 11:04:59 +03:00
Anna Shaleva
368ff820b3 core: add NotValidBefore transaction attribute
Close #1490
2020-10-23 11:02:46 +03:00
Evgenii Stratonikov
aee02ff2e3 core: allow to invoke verify of native contracts 2020-10-14 11:44:27 +03:00
Evgenii Stratonikov
037cecf1ac native: move OracleRequest to state package
It is used by multiple modules outside native
and produces unneeded dependencies.
2020-10-08 13:48:14 +03:00
Evgenii Stratonikov
9733a6f394 core: move CalculateNetworkFee to a separate package 2020-10-07 10:04:19 +03:00
Evgenii Stratonikov
b2a3a0851e emit: accept multiple opcodes in Opcode() 2020-10-06 18:03:25 +03:00
Roman Khimov
b5d138b150
Merge pull request #1451 from nspcc-dev/native/designative
native: implement Designate contract
2020-10-02 16:09:33 +03:00
Evgenii Stratonikov
c468c02ef5 native: implement Designate contract 2020-10-02 11:03:25 +03:00
Roman Khimov
991089593f
Merge pull request #1450 from nspcc-dev/fix/witnessscope
transaction: rename FeeOnly to None
2020-10-01 16:46:07 +03:00
Evgenii Stratonikov
fa09b9af7b transaction: rename FeeOnly to None
Follow missed change from neo-project/neo#1816 .
`None` may be used for any signer. Currently it is used
for sender to only pay fees, or to sign tx attributes.
2020-10-01 15:28:19 +03:00
Anna Shaleva
e34e367a7b core: take into account size fee during verifyTxWitnesses
GasLimit for transaction scripts verification should not include fee for
transaction size.
2020-09-30 21:40:04 +03:00
Anna Shaleva
2b11e99225 core: fix CalculateNetworkFee for signature contracts
First PUSHDATA1 is from invocation script, the second PUSHDATA1 is
from verification script. E.g.:

Invocation script:

INDEX    OPCODE       PARAMETER
0        PUSHDATA1    035913b9588da23a5c3ce14b2886a6b8ebb6a0eb92bdaa948510dfb5ae5194d6cb    <<
35       PUSHNULL
36       SYSCALL      Neo.Crypto.VerifyWithECDsaSecp256r1 (95440d78)

Verification script:

INDEX    OPCODE       PARAMETER
0        PUSHDATA1    3930fe5a9b44682f37741955df4a5f2585ed5aa438fa6e17ae51083673b1d64253e5a859c0cf168be67971e53a23c1c40582777d94a8e391db23ff613849627d    <<
2020-09-30 21:31:43 +03:00
Roman Khimov
adcbb2287f
Merge pull request #1439 from nspcc-dev/core/verify_tx_witnesses_fix
core: take into account gasConsumed during tx witnesses verification
2020-09-29 18:11:39 +03:00
Anna Shaleva
a2bfd16136 core: take into account gasConsumed during tx witnesses verification
We should pay attention to the previously consumed gas during tx
witnesses verification.
2020-09-29 17:43:35 +03:00
Roman Khimov
53c9690bdc interop/runtime: allow calling script hash to pass CheckWitness
See neo-project/neo#1924 and neo-project/neo#1925.
2020-09-29 09:56:19 +03:00
Evgenii Stratonikov
e91d13c615 core: implement oracle tx verification 2020-09-25 17:34:11 +03:00
Evgenii Stratonikov
c5cdaae87a native: support postPersist method
It should be called for NEO contract to distribute
committee bounties.
2020-09-23 14:47:09 +03:00
Evgenii Stratonikov
43b3e15330 native: send GAS to a committee member on persist 2020-09-23 14:42:12 +03:00
Evgenii Stratonikov
7d90d79ae6 core: update claimable GAS calculation 2020-09-23 14:12:42 +03:00
Roman Khimov
19c69618c5 transaction: cache tx size, don't serialize it over and over again 2020-09-11 18:55:19 +03:00
Roman Khimov
26339c75dc vm/core: drop old key caching system
Obsoleted by f5f58a7e91.
2020-09-10 14:43:24 +03:00
Evgenii Stratonikov
1788cf02a1 core: fix VerifyTX test
HighPriority attribute was lost during intermediate code changes.
2020-08-27 18:40:37 +03:00
Evgenii Stratonikov
2661ebd295 transaction: add HighPriority attribute
HighPriority attributes specifies that transaction was
signed by a committee.
2020-08-23 09:39:46 +03:00
Evgenii Stratonikov
e0104679b5 core/tests: make verityTx test more verbose 2020-08-23 09:39:46 +03:00
Roman Khimov
e5813ae8cd
Merge pull request #1346 from nspcc-dev/string-tryboolean
Fail converting long strings to boolean
2020-08-22 17:04:11 +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
93f51f922a stackitem: return error in TryBytes() for big byte strings
Follow neo-project/neo-vm#349.
2020-08-21 21:05:47 +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
c7032022f8 core: don't search through the whole DAO in isTxStillRelevant
New transactions are added to the chain with blocks. If there is no
transaction X at height N in DAO, it could only be added with block N+1, so
it has to be present there. Therefore we can replace `dao.HasTransaction()`
check with a search through in-block transactions. HasTransaction() is nasty
in that it may add useless load the DB and this code is being run with a big
Blockchain lock held, so we don't want to be delayed here at all.

Improves single-node TPS by ~2%.
2020-08-20 18:50:18 +03:00
Roman Khimov
3a379e4f3e core: don't reverify mempooled transactions in AddBlock
The end effect is almost as if `VerifyTransactions: false` was set in the
config, but without actually compromising the guarantees provided by it.

It almost doubles performance for single-mode benchmarks and makes block
processing smoother (more smaller blocks are being produced).
2020-08-19 15:16:19 +03:00
Roman Khimov
eb8122837e core: fix failing TestGetTransaction
3677cc0e2 ruined it:
    TestGetTransaction: blockchain_test.go:413:
                Error Trace:    blockchain_test.go:413
                Error:          Not equal:
                                expected: 467
                                actual  : 399
                Test:           TestGetTransaction
2020-08-19 13:22:31 +03:00