Roman Khimov
85fe111aea
neo: mint GAS after NEO transfer processing
...
See neo-project/neo#2734 .
2022-05-13 18:05:27 +03:00
Anna Shaleva
a94ccf9236
vm: add MODMUL and MODPOW opcodes
...
Close #2470 .
2022-05-12 14:25:14 +03:00
Roman Khimov
7fd0eb14b5
Merge pull request #2469 from nspcc-dev/hardfork
...
core: add ability to create hard-forks
2022-05-12 14:05:48 +03:00
Roman Khimov
c6f8c33e66
Merge pull request #2478 from nspcc-dev/mainnet-fixes
...
Mainnet fixes
2022-05-12 10:04:53 +03:00
Roman Khimov
3d1a81df1f
native: std.itoa uses lower-cased letters, fix #2476
2022-05-11 19:33:17 +03:00
Anna Shaleva
5505acf10e
core: change Create[Standard, Multisig]Account prices
...
And make a hard-fork from this change.
2022-05-11 14:21:43 +03:00
Anna Shaleva
e70bf7d12e
core: allow to create hard-fork
2022-05-11 14:21:38 +03:00
Roman Khimov
7dc0404306
transaction: fix maxSubitems handling in JSON scope unmarshaller
...
Notice that binary deserializer (readArrayOfConditions) does it correctly. Can
be checked with neo-project/neo#2720 case.
2022-05-07 12:05:34 +03:00
Roman Khimov
c410219cba
transaction: fix Rules stringer, it's WitnessRules in C#
...
See neo-project/neo#2720 .
2022-05-07 12:05:25 +03:00
Anna Shaleva
11bfb55b81
core: consider Rules witness scope as valid
2022-05-07 10:50:11 +03:00
Anna Shaleva
a427411a57
core: fix race during native cache persist
...
Fixes the following race:
```
2022-05-06T06:51:33.3980029Z WARNING: DATA RACE
2022-05-06T06:51:33.3980178Z Read at 0x00c0007e02a0 by goroutine 96:
2022-05-06T06:51:33.3980338Z runtime.mapaccess2_fast32()
2022-05-06T06:51:33.3980863Z /opt/hostedtoolcache/go/1.17.9/x64/src/runtime/map_fast32.go:52 +0x0
2022-05-06T06:51:33.3981249Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).getCache()
2022-05-06T06:51:33.3982707Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:905 +0x64
2022-05-06T06:51:33.3983443Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).GetROCache()
2022-05-06T06:51:33.3983900Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:889 +0xd4
2022-05-06T06:51:33.3984231Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).getCache()
2022-05-06T06:51:33.3984869Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:913 +0x196
2022-05-06T06:51:33.3985254Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).GetROCache()
2022-05-06T06:51:33.3985756Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:889 +0xd4
2022-05-06T06:51:33.3986167Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Policy).isBlockedInternal()
2022-05-06T06:51:33.3986824Z /home/runner/work/neo-go/neo-go/pkg/core/native/policy.go:258 +0x6a
2022-05-06T06:51:33.3987264Z github.com/nspcc-dev/neo-go/pkg/core/native.(*Policy).IsBlocked()
2022-05-06T06:51:33.3987743Z /home/runner/work/neo-go/neo-go/pkg/core/native/policy.go:250 +0x2f7
2022-05-06T06:51:33.3988155Z github.com/nspcc-dev/neo-go/pkg/core/native.(*NEO).getAllCandidatesCall.func1()
2022-05-06T06:51:33.3988645Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_neo.go:948 +0x109
2022-05-06T06:51:33.3989053Z github.com/nspcc-dev/neo-go/pkg/core/native.(*NEO).getAllCandidatesCall.func2()
2022-05-06T06:51:33.3989550Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_neo.go:959 +0x137
2022-05-06T06:51:33.3989561Z
2022-05-06T06:51:33.3989735Z Previous write at 0x00c0007e02a0 by goroutine 40:
2022-05-06T06:51:33.3989891Z runtime.mapassign_fast32()
2022-05-06T06:51:33.3990260Z /opt/hostedtoolcache/go/1.17.9/x64/src/runtime/map_fast32.go:92 +0x0
2022-05-06T06:51:33.3990640Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).persistNativeCache()
2022-05-06T06:51:33.3991084Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:876 +0x12d
2022-05-06T06:51:33.3991411Z github.com/nspcc-dev/neo-go/pkg/core/dao.(*Simple).Persist()
2022-05-06T06:51:33.3991852Z /home/runner/work/neo-go/neo-go/pkg/core/dao/dao.go:850 +0x1d4
2022-05-06T06:51:33.3992186Z github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).runPersist()
2022-05-06T06:51:33.3992650Z /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:1285 +0x28a
2022-05-06T06:51:33.3992971Z github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).storeBlock()
2022-05-06T06:51:33.3993845Z /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:1143 +0x1b9c
2022-05-06T06:51:33.3994241Z github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).AddBlock()
2022-05-06T06:51:33.3994707Z /home/runner/work/neo-go/neo-go/pkg/core/blockchain.go:910 +0x791
2022-05-06T06:51:33.3995053Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).AddNewBlock()
2022-05-06T06:51:33.3995492Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:334 +0xa7
2022-05-06T06:51:33.3995842Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).InvokeScript()
2022-05-06T06:51:33.3996288Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:178 +0x169
2022-05-06T06:51:33.3996725Z github.com/nspcc-dev/neo-go/pkg/core/native/native_test_test.TestNEO_GetCandidates.func2()
2022-05-06T06:51:33.3997253Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_test/neo_test.go:549 +0x4cb
2022-05-06T06:51:33.3997672Z github.com/nspcc-dev/neo-go/pkg/core/native/native_test_test.TestNEO_GetCandidates()
2022-05-06T06:51:33.3998404Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_test/neo_test.go:574 +0x2103
2022-05-06T06:51:33.3998751Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).AddNewBlock()
2022-05-06T06:51:33.3999193Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:334 +0xa7
2022-05-06T06:51:33.3999541Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).InvokeScript()
2022-05-06T06:51:33.3999988Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:178 +0x169
2022-05-06T06:51:33.4000305Z github.com/nspcc-dev/neo-go/pkg/neotest.AddSystemFee()
2022-05-06T06:51:33.4000733Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:291 +0x85
2022-05-06T06:51:33.4001062Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).SignTx()
2022-05-06T06:51:33.4001509Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:111 +0x109
2022-05-06T06:51:33.4001885Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).PrepareInvocation()
2022-05-06T06:51:33.4002435Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:191 +0x1b2
2022-05-06T06:51:33.4002808Z github.com/nspcc-dev/neo-go/pkg/neotest.(*Executor).InvokeScript()
2022-05-06T06:51:33.4003249Z /home/runner/work/neo-go/neo-go/pkg/neotest/basic.go:177 +0xed
2022-05-06T06:51:33.4003685Z github.com/nspcc-dev/neo-go/pkg/core/native/native_test_test.TestNEO_GetCandidates.func2()
2022-05-06T06:51:33.4004216Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_test/neo_test.go:549 +0x4cb
2022-05-06T06:51:33.4004634Z github.com/nspcc-dev/neo-go/pkg/core/native/native_test_test.TestNEO_GetCandidates()
2022-05-06T06:51:33.4005165Z /home/runner/work/neo-go/neo-go/pkg/core/native/native_test/neo_test.go:558 +0x1bbb
2022-05-06T06:51:33.4005298Z testing.tRunner()
2022-05-06T06:51:33.4005674Z /opt/hostedtoolcache/go/1.17.9/x64/src/testing/testing.go:1259 +0x22f
2022-05-06T06:51:33.4005916Z testing.(*T).Run·dwrap·21()
2022-05-06T06:51:33.4006298Z /opt/hostedtoolcache/go/1.17.9/x64/src/testing/testing.go:1306 +0x47
...
```
2022-05-06 13:46:17 +03:00
Anna Shaleva
2a8ffd9318
core: refactor (*NEO).GetCandidates and add (*NEO).GetAllCandidates
2022-05-06 13:43:12 +03:00
Roman Khimov
75d06d18c9
Merge pull request #2466 from nspcc-dev/rules-fixes
...
Rules scope fixes
2022-05-06 11:09:39 +03:00
Roman Khimov
acb1151d71
transaction: fix maxSubitems handling in JSON scope unmarshaller
...
Notice that binary deserializer (readArrayOfConditions) does it correctly. Can
be checked with neo-project/neo#2720 case.
2022-05-06 10:20:55 +03:00
Roman Khimov
bd352daab4
transaction: fix Rules stringer, it's WitnessRules in C#
...
See neo-project/neo#2720 .
2022-05-06 10:08:09 +03:00
Roman Khimov
740488f7f3
Merge pull request #2442 from EliChin/feature/eng_review
...
English Check
2022-05-05 17:12:37 +03:00
Elizaveta Chichindaeva
28908aa3cf
[ #2442 ] English Check
...
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-04 19:48:27 +03:00
Anna Shaleva
ffdcdf4a95
core: restrict the maximum number of contract updates
2022-05-04 13:56:52 +03:00
Anna Shaleva
42e4021898
core: block destroyed contracts
2022-05-04 13:56:45 +03:00
Anna Shaleva
473955c2d6
core: use proper current block height/hash for interop API
2022-04-29 18:00:46 +03:00
Anna Shaleva
9cc41528ef
core: avoid unnecessary NEO cached values copying
2022-04-29 16:10:04 +03:00
Anna Shaleva
335c1ee369
core: optimize access to NEO cache
...
Do not copy RW cache each block. Instead we should get RO cache and
change it only if there's a necessity.
2022-04-29 16:10:04 +03:00
Anna Shaleva
a6a0c1eb12
core: avoid lock copy in private DAO constructor
...
Fix the following linter warning:
```
pkg/core/dao/dao.go:101:7 govet copylocks: assignment copies lock value to *d: github.com/nspcc-dev/neo-go/pkg/core/dao.Simple contains sync.RWMutex
```
2022-04-29 16:10:04 +03:00
Anna Shaleva
8d2d48f360
core: move native cache from MemCachedStore to DAO
2022-04-29 16:10:04 +03:00
Anna Shaleva
b77b412b04
core: refactor signature of (*NEO).dropCandidateIfZero
...
It never returns an error.
2022-04-29 16:10:04 +03:00
Anna Shaleva
c36448f27e
core: don't reset NEO's registerPrice cache
2022-04-29 16:10:04 +03:00
Anna Shaleva
adec635f0e
core: don't reset NEO's gasPerBlock cache
2022-04-29 16:10:04 +03:00
Anna Shaleva
35d160075d
core: keep Policy cache always valid and up-to-date
2022-04-29 16:10:04 +03:00
Anna Shaleva
78b584053d
core: keep Oracle cache always valid and up-to-date
2022-04-29 16:10:04 +03:00
Anna Shaleva
0f6bf33f86
core: keep Notary cache always valid and up-to-date
2022-04-29 16:10:04 +03:00
Anna Shaleva
27b0193da0
core: use native cache to check whether the same contract exists on deploy
2022-04-29 16:10:04 +03:00
Anna Shaleva
c0b490c7bf
core: keep Management cache always valid and up-to-date
2022-04-29 16:10:04 +03:00
Anna Shaleva
11ab42d91c
core: keep Designation cache always valid and up-to-date
...
Always use cache instead of DAO where possible. Update cache in-place
each time new designated node is chosen.
2022-04-29 16:10:04 +03:00
Anna Shaleva
c8bdd2ad1a
core: remove Persist from NativeCache interface
...
Lower native cache should be assigned to the upper's value during persist.
2022-04-29 16:10:04 +03:00
Anna Shaleva
8ec8511d9d
core: remove mutexes and atomic values from native cache
...
Native cache is always wrapped into independant layers, so concurrent
RW access is no-op.
2022-04-29 16:10:04 +03:00
Anna Shaleva
7b632c8ee8
core: refactor natives cache
...
1. Use layered natives cache. With layered cache the storeblock
process includes the following steps: create a wrapper over
current nativeCache, put changes into upper nativeCache layer,
persist (or discard) changes.
2. Split contract getters to read-only and read-and-change. Read-only
ones doesn't require the copy of an existing nativeCache item.
Read-and-change ones create a copy and after that change the copy.
2022-04-29 16:10:04 +03:00
Anna Shaleva
aa886f67ce
core: use dao-binded cache for native contracts
...
All native cached values are binded to DAO, so that it's possible
to properly handle historic calls.
2022-04-29 16:10:04 +03:00
Anna Shaleva
812fa3f76a
core: initialize NEO config cache in constructor
...
It isn't changed within the contract lifetime, thus initialisation can be
safely performed in constructor.
2022-04-29 16:10:04 +03:00
Anna Shaleva
e63d6aeff7
core: move natives cache initialisation to a separate method
2022-04-29 16:10:04 +03:00
Anna Shaleva
93fde3b4e6
core: fix typo in TestCreateBasicChain
2022-04-29 16:10:04 +03:00
Anna Shaleva
63c26ca270
core, rpc: support [invokefunction, invokescript, invokecontractverify]historic
2022-04-29 16:10:04 +03:00
Anna Shaleva
f8b5972f61
core: support Store interface over MPT
2022-04-29 16:10:04 +03:00
Anna Shaleva
0cf525d62e
core: add ability to traverse backwards for Billet
2022-04-29 16:10:04 +03:00
Roman Khimov
3ae1647940
Merge pull request #2447 from nspcc-dev/gettransactionsigners
...
core: add GetTransactionSigners method to native Ledger
2022-04-29 11:58:38 +03:00
Anna Shaleva
1762fd9128
core: add test to check GetTransactionSigners interop API
2022-04-29 11:34:26 +03:00
Anna Shaleva
47d52bd9c5
core: add getTransactionSigners method to native Ledger
2022-04-29 11:18:58 +03:00
Anna Shaleva
aaf7c423b4
core: remove voter reward per committee properly
...
(*Simple).Seek cuts search prefix, thus to remove voterRewardPerCommittee
we need to append it again to the height value. May affect dumps.
2022-04-28 17:15:18 +03:00
Roman Khimov
10acdbe40e
Merge pull request #2453 from nspcc-dev/check-policy-for-committee-members
...
Check policy for committee members
2022-04-28 12:58:07 +03:00
Roman Khimov
a8607e43b1
native: check candidates againt Policy blocked list
...
Follow neo-project/neo#2695 and neo-project/neo#2707 .
2022-04-27 22:58:52 +03:00
Anna Shaleva
35d930951c
core: consider Rules witness scope as valid
2022-04-27 12:48:33 +03:00
Anna Shaleva
1890e7cdc1
core: upgrade storage version
2022-04-22 18:38:05 +03:00
Anna Shaleva
8be6823cb1
core: fix broken stateroot storage
...
Store stateroot by DataMPTAux prefix instead of storing it by index only.
2022-04-22 18:37:56 +03:00
Anna Shaleva
d942940a82
core: support System.Runtime.GetAddressVersion syscall
2022-04-21 19:26:16 +03:00
Anna Shaleva
51a54fa248
core: return default BaseExecFee if blockchain height is 0
...
For (bc *Blockchain).GetBaseExecFee().
2022-04-08 14:28:30 +03:00
Anna Shaleva
d3672eb14a
core: use BaseExecFee from InteropContext instead of Blockchain's one
...
The InteropContext's one contains all relevant fee changes applied in
the prevouse transactions of the current block.
2022-04-08 12:56:46 +03:00
Anna Shaleva
544f2c2cb2
core: use proper storage price within the whole interop context
...
We shouldn't use StoragePrice from Blockchain because its dao doesn't
contain the whole set of changes from previouse transactions in the
current block. Instead, we should use an updated storage price for
each transaction and retrieve the price from cached DAO.
2022-04-08 12:50:56 +03:00
Anna Shaleva
91a4bc5beb
core: use proper DAO to get ExecFeeFactor
...
The usage of the Blockchain's one leads to the same ExecFeeFactor within
a single block. What we need is to update ExecFeeFactor after each
transaction invocation, thus, cached DAO should be used as it contains
all relevant changes.
2022-04-08 12:50:50 +03:00
Anna Shaleva
16f952270c
core: add murmur32 to CryptoLib native contract
...
Close #2415 .
2022-04-05 10:46:52 +03:00
Anna Shaleva
b431e47d2a
core: add GetTransactionVMState to native Ledger contract
...
Close #2343 .
2022-04-05 10:37:02 +03:00
Anna Shaleva
4254407a9b
dao: add GetTxExecResult method
2022-04-05 10:36:50 +03:00
Anna Shaleva
18c5f638b9
dao: adjust usages of Internal DB inconsistency
error
2022-04-04 19:16:58 +03:00
Anna Shaleva
6343720adf
dao: return ErrKeyNotFound from GetAppExecResults for dummy txs
...
Otherwise decoding error may be returned which can be misleading.
2022-04-04 12:49:52 +03:00
Anna Shaleva
9a41356a3b
core: add getUint256FromItem helper to native ledger
2022-04-04 12:33:29 +03:00
Roman Khimov
4e375fd8f4
Merge pull request #2414 from nspcc-dev/eliminate-getstorageitems
...
Eliminate GetStorageItems
2022-04-01 09:16:42 +03:00
Roman Khimov
c12a3b71d4
dao: drop GetStorageItems* APIs
...
They're just adding another useless caching layer to the Seek.
2022-03-31 19:18:51 +03:00
Roman Khimov
60375e9db3
core: drop GetStorageItems interface
...
It's not used and not useful.
2022-03-31 16:46:41 +03:00
Roman Khimov
3ab2ab5cba
core: drop outdated comment from storageFind
2022-03-31 16:39:11 +03:00
Anna Shaleva
8965441288
core: rebase core tests onto neotest
2022-03-30 19:00:53 +03:00
Anna Shaleva
35ef58a47e
core: move Oracle response script creation to a separate function
2022-03-30 18:59:43 +03:00
Anna Shaleva
a4dab3a5ba
core: adjust error message of native call
2022-03-30 12:18:01 +03:00
Anna Shaleva
59f3fa1ef1
neotest: adapt framework to work with *testing.B
2022-03-30 12:17:55 +03:00
Anna Shaleva
ff13af804d
core: adjust persist-related Blockchain tests
...
`newTestChain` runs blockchain, so persist is likely already happened
before the first test iteration. Explicit call to persist makes no sence
here.
2022-03-30 11:46:44 +03:00
Anna Shaleva
28e936eb95
core: export GetMaxNotValidBeforeDelta blockchain API
...
Mostly for tests, but it can also be useful as a separate API.
2022-03-30 11:46:44 +03:00
Anna Shaleva
e0ab4ec6f0
core: adjust helper test contract
...
Method is allowed to have single return value on stack after its invocation.
Make sure that test contract follows this rule.
2022-03-30 11:46:44 +03:00
Anna Shaleva
13252bb941
core: refactor helper test contracts generation
...
* Move generator to a separate package.
* Move loader to a separate package and get rid of the code duplications.
2022-03-30 11:46:29 +03:00
Anna Shaleva
889a7ec378
rpc: regenerate basic chain and adjust RPC server tests
2022-03-30 11:32:30 +03:00
Anna Shaleva
4a74c117ee
*: refactor TestCreateBasicChain and its dependencies
...
Close #2355
2022-03-30 11:32:26 +03:00
Anna Shaleva
150041d25e
core: unexport native Management's GetMinimumDeploymentFee
...
This method is used only from Management contract. We also have
neotest-based tests for `getMinimumDeploymentFee`, it should be enough.
2022-03-29 15:01:10 +03:00
Roman Khimov
d5a9af5860
Revert "Revert "interop: use All flags for management deploy and update calls""
...
This reverts commit 526c423a61
, heading to 3.2.0.
2022-03-21 17:41:37 +03:00
Roman Khimov
526c423a61
Revert "interop: use All flags for management deploy and update calls"
...
This reverts commit 37ca96c20b
and a part of
7945097543
, we need 0.98.2 release to be
3.1.0-compatible and this one breaks the testnet.
2022-03-21 14:32:11 +03:00
Roman Khimov
906d99571b
Merge pull request #2369 from nspcc-dev/goshechka
...
*: go 1.18 support 🎉 😍 🎊 🍰 🥂
2022-03-18 15:07:20 +03:00
Roman Khimov
5616585697
block/dao: simplify trimming, avoid allocations
...
The only user of (*Block).Trim() is in DAO and it already has a nice buffer
usually, so creating another one makes no sense. It also simplifies error
handling a lot.
2022-03-18 10:49:25 +03:00
Anna Shaleva
2096ad6e81
*: remove io/ioutil uses
...
Close #1764 .
2022-03-17 19:39:18 +03:00
Roman Khimov
6ece74a7c7
Merge pull request #2383 from nspcc-dev/oracle-redirection
...
services: check Oracle response redirections
2022-03-04 22:19:22 +03:00
AnnaShaleva
537de18ac3
services: check Oracle response redirections
...
1. Move redirections check to the tcp level. Manually resolve request address
and create connection for the first suitable resolved address.
2. Remove URIValidator. Redirections checks are set in the custom http client,
so the user should take care of validation by himself when customizing the
client.
2022-03-04 13:10:22 +03:00
Roman Khimov
ff60571869
Merge pull request #2378 from nspcc-dev/notary-adjustments
...
*: several Notary subsystem adjustments, part 1
2022-03-02 11:58:36 +03:00
AnnaShaleva
92282c70cb
*: support customisable NotaryServiceFeePerKey value
...
* Add corresponding methods to Notary contract.
* Extend RPC Client API.
* Adjust tests.
2022-03-01 19:08:16 +03:00
Anna Shaleva
49c995ec06
core: add tests for blockchain initialisation
...
Close #1577 .
2022-02-28 19:00:43 +03:00
AnnaShaleva
8e3f2417f4
core: add check for native activations history
...
It should be consistent with storage states.
2022-02-28 18:49:18 +03:00
Anna Shaleva
032d9749c2
core: improve blockchain error messages
2022-02-28 18:49:18 +03:00
Anna Shaleva
a57c3f4842
core: fix InitWithIncompleteStateJump test
2022-02-28 18:49:18 +03:00
Anna Shaleva
9adcefc2ef
core: gracefully wrap Seek error if failed to retrieve header hases
2022-02-28 18:49:18 +03:00
Anna Shaleva
8d6aa1782d
core: fix StateRootInHeader error message for (*Blockchain).init()
2022-02-28 18:49:18 +03:00
Anna Shaleva
ad0c53c067
core: unify the format of error messages for (*Blockchain).init()
2022-02-28 18:49:12 +03:00
Anna Shaleva
21515e1835
core: refactor Level store creation for tests
...
We don't need to create the whole DB configuration structure.
2022-02-25 12:14:17 +03:00
Anna Shaleva
339bec1632
core: adjust TestDumpAndRestore test
...
`with state root` test should consider StateRootInHeader set to true.
2022-02-25 11:47:13 +03:00
Roman Khimov
7d6f087337
storage: drop (KeyPrefix).Bytes() API
...
It allocates and most of the time we can avoid that.
2022-02-18 15:19:57 +03:00
Roman Khimov
7223caf369
dao: improve PutCurrentHeader logic
...
Move serialization out of the core.
2022-02-18 15:05:25 +03:00
Roman Khimov
522229d731
storage: drop AppendPrefix/AppendPrefixInt APIs
...
We're not using them anymore and they allocate.
2022-02-18 14:59:59 +03:00
Roman Khimov
d2db58d748
dao: move header hash store logic out of the core
...
Which allows for more efficient buffer use along the way.
2022-02-18 14:54:05 +03:00
Roman Khimov
de2579ec07
dao: put contract IDs into keys using big endianness
...
We don't have a need to iterate over them at the moment, but since we're
changing the DB format in the next release anyway let's add this ability also,
just in case.
2022-02-18 14:38:51 +03:00
Roman Khimov
600da6909c
storage: put uint32 into keys using in big endianness
...
Which allows to iterate over the contents easily.
2022-02-18 14:35:17 +03:00
Roman Khimov
1ca918e631
dao: delay buffer creation until it's needed
...
Verification contexts don't ever touch the storage, so these allocations can
be avoided for them.
2022-02-18 14:24:45 +03:00
Roman Khimov
e864768c88
dao: simplify NewPrivate
2022-02-18 14:18:56 +03:00
Roman Khimov
5402e654d1
core: don't create useless DAO layer in GetTestVM
...
We're already wrapping in interop.NewContext.
2022-02-18 14:12:44 +03:00
Roman Khimov
b60d4ff191
dao: deduplicate header->KV conversion
2022-02-18 14:12:44 +03:00
Roman Khimov
d8cf879499
dao: deduplicate DeleteBlock, no functional changes
2022-02-18 14:12:44 +03:00
Roman Khimov
f80680187e
storage: expose private storage map for more efficient MPT batch
...
It couldn't be done previously with two maps and mixed storage, but now all of
the storage changes are located in a single map, so it's trivial to do exact
slice allocations and avoid string->[]byte conversions.
2022-02-17 23:41:10 +03:00
Roman Khimov
7dc8fc443f
dao: simplify buffer management for private DAO
...
Private DAO is only used in a single thread which means we can safely reuse
key/data buffers most of the time and handle it all in DAO.
Doesn't affect any benchmarks.
2022-02-17 22:27:39 +03:00
Roman Khimov
9bfb3357f2
storage: add "private" mode to MemCachedStore
...
Most of the time we don't need locking on the higher-level stores and we drop
them after Persist, so that's what private MemCachedStore is for.
It doesn't improve things in any noticeable way, some ~1% can be observed in
neo-bench under various loads and even less than that in chain processing. But
it seems to be a bit better anyway (less allocations, less locks).
2022-02-17 22:27:39 +03:00
Roman Khimov
aefb26255a
dao: drop DAO interface
...
It's a remnant from the days when we had Simple and Cached DAO
implementations, now it makes zero sense.
2022-02-16 18:24:20 +03:00
Roman Khimov
9d2ef775cf
storage: simplify (*MemCachedStore).Put/Delete interface
...
They never return errors, so their interface should reflect that. This allows
to remove quite a lot of useless and never tested code.
Notice that Get still does return an error. It can be made not to do that, but
usually we need to differentiate between successful/unsuccessful accesses
anyway, so this doesn't help much.
2022-02-16 18:24:20 +03:00
Roman Khimov
be24bf6412
storage: drop Put and Delete from Store interface
...
It's only changed with PutChangeSet, single KV operations are handled by
MemCachedStore.
2022-02-16 18:24:20 +03:00
Roman Khimov
017795c9c1
storage: completely remove MemoryBatch
...
If you need something like that, just wrap another MemCachedStore layer around
it.
2022-02-16 16:13:12 +03:00
Roman Khimov
17a43b19e0
storage: remove Batch from Store
...
We never use it for real underlying stores, so these implementations are
useless (everything goes though PutChangeSet now).
2022-02-16 15:55:48 +03:00
Roman Khimov
35bdfc5eca
storage: use two maps for MemoryStore
...
Simple and dumb as it is, this allows to separate contract storage from other
things and dramatically improve Seek() time over storage (even though it's
still unordered!) which in turn improves block processing speed.
LevelDB LevelDB (KeepOnlyLatest) BoltDB BoltDB (KeepOnlyLatest)
Master real 16m27,936s real 10m9,440s real 16m39,369s real 8m1,227s
user 20m12,619s user 26m13,925s user 18m9,162s user 18m5,846s
sys 2m56,377s sys 1m32,051s sys 9m52,576s sys 2m9,455s
2 maps real 10m49,495s real 8m53,342s real 11m46,204s real 5m56,043s
user 14m19,922s user 24m6,225s user 13m25,691s user 15m4,694s
sys 1m53,021s sys 1m23,006s sys 4m31,735s sys 2m8,714s
neo-bench performance is mostly unaffected, ~0.5% for 1-1 test and 4% for
10K-10K test both fall within regular test error range.
2022-02-16 15:55:48 +03:00
Roman Khimov
b6a4947cfd
storage: drop STAccount prefix
...
It's unused for a long time.
2022-02-16 13:06:57 +03:00
Roman Khimov
54bc603831
core: remove old storage items synchronously during jump
...
There won't be a lot of them and GC experience we have shows that iterating
over 1-2M of entries is not a huge problem for DBs we have.
2022-02-16 13:03:13 +03:00
Roman Khimov
805d81e441
core: drop old transfer data during state jump
2022-02-16 12:12:03 +03:00
Roman Khimov
3a2b800e5f
core: remove stale transfer entries, fix #2096
...
Initially I thought of doing it in the next persist cycle, but testing shows
that it needs just ~2-5% of the time MPT GC does, so doing it in the same
cycle doesn't affect anything.
2022-02-15 15:51:03 +03:00
Roman Khimov
c4b49a2d52
storage: deduplicate storage closing in tests
2022-02-14 17:29:21 +03:00
Roman Khimov
261552516b
stateroot: use a better word for logs
2022-02-14 17:29:21 +03:00
Roman Khimov
ccdda21718
stateroot: add and use DataMPTAux for auxiliary data
...
Use DataMPT for nodes only, otherwise with 1M blocks with have 1M
height-stateroot mapping entries that our GC has to iterate over for no
reason.
2022-02-14 17:29:21 +03:00
Roman Khimov
ad606101c7
storage: add SeekGC interface for GC
...
It's very special, single-purpose thing, but it improves cumulative time spent
in GC by ~10% for LevelDB and by ~36% for BoltDB during 1050K mainnet chain
processing. While the overall chain import time doesn't change in any
noticeable way (~1%), I think it's still worth it, for machines with slower
disks the difference might be more noticeable.
2022-02-14 17:29:21 +03:00
Roman Khimov
51b804ab0e
storage: generalize Level/Bolt seek implementations
...
Too much in common. Just refactoring. no functional changes.
2022-02-12 23:09:37 +03:00
Roman Khimov
a5f8b8870a
storage: use Update for changeset processing
...
Batch is only relevant in multithreaded context, internally it'll do some
magic and use the same locking/updating Update does, so it makes little sense
for us. This doesn't change benchmarks in any noticeable way.
2022-02-11 16:48:35 +03:00
Roman Khimov
6380647770
Merge pull request #2354 from nspcc-dev/mpt-value-based-gc
...
Value-based MPT GC
2022-02-11 16:25:08 +03:00
Roman Khimov
c5f1e2fbcd
mpt: don't allocate for every key
...
Microoptimization.
2022-02-11 14:19:54 +03:00
Roman Khimov
423c7883b8
core: implement basic GC for value-based storage scheme
...
The key idea here is that even though we can't ensure MPT code won't make the
node active again we can order the changes made to the persistent store in
such a way that it practically doesn't matter. What happens is:
* after persist if it's time to collect our garbage we do it synchronously
right in the same thread working the underlying persistent store directly
* all the other node code doesn't see much of it, it works with bc.dao or
layers above it
* if MPT doesn't find some stale deactivated node in the storage it's OK,
it'll recreate it in bc.dao
* if MPT finds it and activates it, it's OK too, bc.dao will store it
* while GC is being performed nothing else changes the persistent store
* all subsequent bc.dao persists only happen after the GC is completed which
means that any changes to the (potentially) deleted nodes have a priority,
it's OK for GC to delete something that'll be recreated with the next
persist cycle
Otherwise it's a simple scheme with node status/last active height stored in
the value. Preliminary tests show that it works ~18% worse than the simple
KeepOnlyLatest scheme, but this seems to be the best result so far.
Fixes #2095 .
2022-02-11 14:19:54 +03:00
Roman Khimov
c4ee310e85
mpt: modify refcounted storage scheme to make GC possible
...
Add "active" flag into the node data and make the remainder modal, for active
nodes it's a reference counter, for inactive ones the deactivation height is
stored.
Technically, refcounted chains storing just one trie don't need a flag, but
it's a bit simpler this way.
2022-02-10 21:56:20 +03:00
Roman Khimov
86cb4ed80f
mpt: add the notion of MPT mode
...
It directly affects the storage format, so it's important. ModeGC is not used
at the moment, but defined for future extensibility.
2022-02-10 19:15:18 +03:00
Anna Shaleva
e306a90554
rpc: add NEP11-D tests to server and client
...
Also refactor basic chain creation.
2022-02-09 11:57:16 +03:00
Roman Khimov
de99c3acdb
storage: provide a way to escape from SeekAsync goroutine
...
A routine blocked on channel send here can't really exit, so avoid goroutine
leak:
goroutine 2813725 [chan send, 6 minutes]:
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync.func1.1(0xc01a7118f7, 0x2, 0x25, 0xc01a7118f9, 0x23, 0x23, 0xc0366c7c01)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:120 +0x86
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek.func2(0xc0079e7920, 0xa, 0x30, 0xc0079e792a, 0x26, 0x26, 0x1)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:183 +0x347
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek(0xc000458480, 0x135c028, 0xc0000445d0, 0xc00f1721d0, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:224 +0x4f4
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).Seek(0xc000458480, 0xc00f1721d0, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, 0xc0357c6620)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:110 +0x8a
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek(0xc0331a4f00, 0x135bff0, 0xc00ae26ec0, 0xc00f1721d0, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:210 +0x379
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync.func1(0xc0331a4f00, 0x135bff0, 0xc00ae26ec0, 0xc00f1721d0, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:119 +0xc5
created by github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:118 +0xc8
goroutine 2822823 [chan send, 6 minutes]:
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync.func1.1(0xc011859b77, 0x3, 0x3, 0xc017bea8d0, 0x26, 0x26, 0xc00f1afc00)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:120 +0x86
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek.func2(0xc011859b60, 0xa, 0xa, 0xc017bea8a0, 0x26, 0x26, 0xc00ad9fb00)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:200 +0x47e
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek.func2(0xc01d5d8c90, 0xa, 0x30, 0xc01d5d8c9a, 0x26, 0x26, 0x1)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:200 +0x47e
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek(0xc035e12900, 0x135c028, 0xc0000445d0, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:224 +0x4f4
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).Seek(0xc035e12900, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, 0xc030c9e0e0)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:110 +0x8a
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek(0xc000458480, 0x135c028, 0xc0000445d0, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:210 +0x379
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).Seek(0xc000458480, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, 0xc030c9e070)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:110 +0x8a
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).seek(0xc00b340c60, 0x135bff0, 0xc00f1afbc0, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:210 +0x379
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync.func1(0xc00b340c60, 0x135bff0, 0xc00f1afbc0, 0xc01773bf60, 0x7, 0x7, 0x0, 0x0, 0x0, 0x0, ...)
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:119 +0xc5
created by github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemCachedStore).SeekAsync
github.com/nspcc-dev/neo-go/pkg/core/storage/memcached_store.go:118 +0xc8
...
2022-02-09 00:22:42 +03:00
Roman Khimov
3307292597
storage: rework MemoryStore with a single map
...
Doesn't affect any benchmarks or tests, but makes things a bit simpler.
2022-02-09 00:22:42 +03:00
Roman Khimov
2bc493a839
mpt: simplify makeStorageKey() interface
2022-02-08 12:38:03 +03:00
Roman Khimov
9719191770
Merge pull request #2342 from nspcc-dev/fix-management-contract-callflags
...
Fix management contract callflags
2022-02-01 12:30:53 +03:00
Roman Khimov
7945097543
native: fix ContractManagement's call flags for update/deploy
...
See neo-project/neo#2653 .
2022-02-01 12:21:00 +03:00
Roman Khimov
1df447cd68
Merge pull request #2334 from nspcc-dev/extendable-validators
...
Extendable validators
2022-02-01 12:09:56 +03:00
Roman Khimov
cda1c75db3
core: drop GetStandBy* methods
...
They're misleading now that we have variable number of committee
members/validators. The standby list can be seen in the configuration and the
appropriate numbers can be received from it also.
2022-01-31 23:14:38 +03:00
Roman Khimov
e621f746a7
config/core: allow to change the number of validators
...
Fixes #2320 .
2022-01-31 23:14:38 +03:00
Evgeniy Stratonikov
e890c32dcc
rpc/client: remove dependency on examples
...
Duplicate necessary structures in a dedicated micropackage.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-25 12:41:06 +03:00
Roman Khimov
6e9d725a29
config: consolidate ProtocolConfiguration consistency checks
2022-01-24 18:42:57 +03:00
Evgeniy Stratonikov
9871dc8f5a
compiler: update x/tools package
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:26 +03:00
Evgeniy Stratonikov
e7a0ecb349
compiler: provide .go
filename to Compile
...
First argument contains filename, thus we use '.go' suffix to
distinguish between directories and files.
Contract name should be provided in options.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:21:24 +03:00
Evgeniy Stratonikov
8af9c870b1
compiler: remove CompileWithDebugInfo
...
It is a simple wrapper over `CompileWithOptions` which we don't really
need. Custom options can be specified explicitly instead of using some
random default. This default was introduced in 1578904da
, however tests
written there use `CompileWithOptions` and all other tests
pass on that commit even without this default.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-01-20 13:15:48 +03:00
Roman Khimov
42769d11ff
Merge pull request #2330 from nspcc-dev/transfer-logs-opt
...
core: improve Seek and optimise seek time for transfer logs
2022-01-19 21:55:40 +03:00
Anna Shaleva
9b841b9b8f
core, rpc: use Seek to iterate over NEP* transfers
...
The results are controversial a bit. MemoryPS is a special storage
and the new approach doesn't help it to iterate through NEP17 transfers.
However, on long distances (if transfers are requested for more than
1000 blocks, which is ~4.1 hours of mainnet chain) both LevelDB and
BoltDB perform good enough with the new approach. Taking into account
the fact that default value for the query period of `getnep17transfers`
RPC handler is a week (~40K mainnet blocks) we can sacrifice MemoryPS
performance in favour of BoltDB and LevelDB optimisation.
Close #2263 .
Benchmark results:
name old time/op new time/op delta
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take100Blocks-8 783µs ±13% 1762µs ± 4% +125.12% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take1000Blocks-8 6.91ms ± 2% 9.00ms ± 2% +30.28% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take100Blocks-8 1.43ms ± 8% 1.79ms ± 4% +24.93% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take1000Blocks-8 7.78ms ± 3% 8.93ms ± 2% +14.78% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take100Blocks-8 7.69ms ± 3% 1.73ms ±10% -77.50% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take1000Blocks-8 14.1ms ± 2% 9.0ms ± 2% -36.53% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take100Blocks-8 768µs ± 3% 801µs ± 2% +4.24% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take1000Blocks-8 8.03ms ± 2% 8.05ms ± 8% ~ (p=0.436 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take100Blocks-8 1.70ms ±16% 0.85ms ± 7% -49.85% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take1000Blocks-8 10.8ms ± 2% 8.1ms ± 2% -25.21% (p=0.000 n=10+8)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take100Blocks-8 10.8ms ± 2% 0.9ms ± 7% -92.12% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take1000Blocks-8 18.2ms ±13% 8.2ms ± 6% -54.95% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take100Blocks-8 874µs ± 6% 823µs ± 2% -5.81% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take1000Blocks-8 9.35ms ± 2% 8.14ms ± 2% -12.91% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take100Blocks-8 1.85ms ± 4% 0.89ms ±10% -51.68% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take1000Blocks-8 10.6ms ± 4% 8.2ms ± 2% -22.44% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take100Blocks-8 10.7ms ± 2% 0.9ms ± 2% -91.90% (p=0.000 n=8+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take1000Blocks-8 21.8ms ±15% 8.2ms ± 1% -62.25% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take100Blocks-8 650kB ± 0% 1010kB ± 7% +55.45% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take1000Blocks-8 6.39MB ± 0% 9.89MB ± 1% +54.74% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take100Blocks-8 1.28MB ± 0% 1.14MB ± 0% -11.25% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take1000Blocks-8 7.02MB ± 0% 10.01MB ± 0% +42.54% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take100Blocks-8 7.02MB ± 0% 1.08MB ± 0% -84.64% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take1000Blocks-8 12.8MB ± 0% 10.0MB ± 0% -22.04% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take100Blocks-8 823kB ± 3% 866kB ± 5% +5.19% (p=0.001 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take1000Blocks-8 9.92MB ± 0% 9.85MB ± 0% -0.71% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take100Blocks-8 1.84MB ± 4% 1.01MB ± 5% -44.75% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take1000Blocks-8 11.0MB ± 0% 10.0MB ± 1% -8.45% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take100Blocks-8 11.0MB ± 0% 1.0MB ± 1% -90.55% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take1000Blocks-8 20.0MB ± 0% 10.1MB ± 0% -49.69% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take100Blocks-8 913kB ± 5% 907kB ± 6% ~ (p=0.497 n=9+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take1000Blocks-8 10.0MB ± 1% 10.0MB ± 1% -0.63% (p=0.001 n=10+8)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take100Blocks-8 1.92MB ± 2% 1.04MB ± 0% -45.53% (p=0.000 n=9+8)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take1000Blocks-8 11.1MB ± 1% 10.1MB ± 0% -9.22% (p=0.000 n=10+7)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take100Blocks-8 11.1MB ± 1% 1.0MB ± 0% -90.61% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take1000Blocks-8 20.4MB ± 1% 10.1MB ± 0% -50.46% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take100Blocks-8 11.1k ± 0% 11.7k ± 0% +5.35% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1_Take1000Blocks-8 110k ± 0% 110k ± 0% +0.55% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take100Blocks-8 22.0k ± 0% 11.9k ± 0% -46.14% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-100_Take1000Blocks-8 120k ± 0% 110k ± 0% -8.44% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take100Blocks-8 120k ± 0% 12k ± 0% -90.36% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/MemPS_StartFromBlockN-1000_Take1000Blocks-8 219k ± 0% 110k ± 0% -49.73% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take100Blocks-8 11.3k ± 0% 11.2k ± 0% -1.06% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1_Take1000Blocks-8 112k ± 0% 110k ± 0% -2.36% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take100Blocks-8 22.5k ± 0% 11.3k ± 0% -49.65% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-100_Take1000Blocks-8 124k ± 0% 110k ± 0% -11.08% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take100Blocks-8 124k ± 0% 11k ± 0% -90.84% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/BoltPS_StartFromBlockN-1000_Take1000Blocks-8 225k ± 0% 110k ± 0% -51.07% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take100Blocks-8 11.4k ± 0% 11.3k ± 0% -1.36% (p=0.000 n=9+9)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1_Take1000Blocks-8 114k ± 0% 111k ± 0% -2.33% (p=0.000 n=10+9)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take100Blocks-8 22.7k ± 0% 11.5k ± 0% -49.56% (p=0.000 n=9+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-100_Take1000Blocks-8 125k ± 0% 111k ± 0% -11.12% (p=0.000 n=10+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take100Blocks-8 125k ± 0% 11k ± 0% -90.82% (p=0.000 n=8+10)
Blockchain_ForEachNEP17Transfer/LevelPS_StartFromBlockN-1000_Take1000Blocks-8 229k ± 1% 111k ± 0% -51.42% (p=0.000 n=10+10)
2022-01-19 20:55:08 +03:00
Anna Shaleva
e3af21ab4a
core: add benchmark for ForEachNEP17Transfer
2022-01-19 20:54:35 +03:00
Anna Shaleva
cd42b8b20c
core: allow early Seek stop
...
This simple approach allows to improve the performance of
BoltDB and LevelDB in both terms of speed and allocations
for retrieving GasPerVote value from the storage.
MemoryPS's speed suffers a bit, but we don't use it for
production environment.
Part of #2322 .
Benchmark results:
name old time/op new time/op delta
NEO_GetGASPerVote/MemPS_10RewardRecords_1RewardDistance-8 25.3µs ± 1% 26.4µs ± 9% +4.41% (p=0.043 n=10+9)
NEO_GetGASPerVote/MemPS_10RewardRecords_10RewardDistance-8 27.9µs ± 1% 30.1µs ±15% +7.97% (p=0.000 n=10+9)
NEO_GetGASPerVote/MemPS_10RewardRecords_100RewardDistance-8 55.1µs ± 1% 60.2µs ± 7% +9.27% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_1000RewardDistance-8 353µs ± 2% 416µs ±13% +17.88% (p=0.000 n=8+8)
NEO_GetGASPerVote/MemPS_100RewardRecords_1RewardDistance-8 195µs ± 1% 216µs ± 7% +10.42% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_10RewardDistance-8 200µs ± 4% 214µs ± 9% +6.99% (p=0.002 n=9+8)
NEO_GetGASPerVote/MemPS_100RewardRecords_100RewardDistance-8 223µs ± 2% 247µs ± 9% +10.60% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_1000RewardDistance-8 612µs ±23% 855µs ±52% +39.60% (p=0.001 n=9+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1RewardDistance-8 11.3ms ±53% 10.7ms ±50% ~ (p=0.739 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_10RewardDistance-8 12.0ms ±37% 10.4ms ±65% ~ (p=0.853 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_100RewardDistance-8 11.3ms ±40% 10.4ms ±49% ~ (p=0.631 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1000RewardDistance-8 3.80ms ±45% 3.69ms ±27% ~ (p=0.931 n=6+5)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1RewardDistance-8 23.0µs ± 9% 22.6µs ± 4% ~ (p=0.059 n=8+9)
NEO_GetGASPerVote/BoltPS_10RewardRecords_10RewardDistance-8 25.9µs ± 5% 24.8µs ± 4% -4.17% (p=0.006 n=10+8)
NEO_GetGASPerVote/BoltPS_10RewardRecords_100RewardDistance-8 42.7µs ±13% 38.9µs ± 1% -8.85% (p=0.000 n=9+8)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1000RewardDistance-8 80.8µs ±12% 84.9µs ± 9% ~ (p=0.114 n=8+9)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1RewardDistance-8 64.3µs ±16% 22.1µs ±23% -65.64% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_10RewardDistance-8 61.0µs ±34% 23.2µs ± 8% -62.04% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_100RewardRecords_100RewardDistance-8 62.2µs ±14% 25.7µs ±13% -58.66% (p=0.000 n=9+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1000RewardDistance-8 359µs ±60% 325µs ±60% ~ (p=0.739 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1RewardDistance-8 242µs ±21% 13µs ±28% -94.49% (p=0.000 n=10+8)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_10RewardDistance-8 229µs ±23% 18µs ±70% -92.02% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_100RewardDistance-8 238µs ±28% 20µs ±109% -91.38% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1000RewardDistance-8 265µs ±20% 77µs ±62% -71.04% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1RewardDistance-8 25.5µs ± 3% 24.7µs ± 7% ~ (p=0.143 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_10RewardDistance-8 27.4µs ± 2% 27.9µs ± 6% ~ (p=0.280 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_100RewardDistance-8 50.2µs ± 7% 47.4µs ±10% ~ (p=0.156 n=9+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1000RewardDistance-8 98.2µs ± 9% 94.6µs ±10% ~ (p=0.218 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1RewardDistance-8 82.9µs ±13% 32.1µs ±22% -61.30% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_10RewardDistance-8 92.2µs ±11% 33.7µs ±12% -63.42% (p=0.000 n=10+9)
NEO_GetGASPerVote/LevelPS_100RewardRecords_100RewardDistance-8 88.3µs ±22% 39.4µs ±14% -55.36% (p=0.000 n=10+9)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1000RewardDistance-8 106µs ±18% 78µs ±24% -26.20% (p=0.000 n=9+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1RewardDistance-8 360µs ±24% 29µs ±53% -91.91% (p=0.000 n=10+9)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_10RewardDistance-8 353µs ±16% 50µs ±70% -85.72% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_100RewardDistance-8 381µs ±20% 47µs ±111% -87.64% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1000RewardDistance-8 434µs ±19% 113µs ±41% -74.04% (p=0.000 n=10+10)
name old alloc/op new alloc/op delta
NEO_GetGASPerVote/MemPS_10RewardRecords_1RewardDistance-8 4.82kB ± 0% 4.26kB ± 1% -11.62% (p=0.000 n=10+9)
NEO_GetGASPerVote/MemPS_10RewardRecords_10RewardDistance-8 4.99kB ± 0% 4.41kB ± 1% -11.56% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_100RewardDistance-8 8.45kB ± 0% 7.87kB ± 0% -6.88% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_1000RewardDistance-8 55.0kB ± 0% 54.5kB ± 0% -0.81% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_1RewardDistance-8 29.1kB ± 0% 21.7kB ± 2% -25.56% (p=0.000 n=9+9)
NEO_GetGASPerVote/MemPS_100RewardRecords_10RewardDistance-8 29.3kB ± 1% 21.8kB ± 2% -25.74% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_100RewardDistance-8 31.3kB ± 1% 23.6kB ± 1% -24.50% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_1000RewardDistance-8 92.5kB ± 5% 84.7kB ± 3% -8.50% (p=0.000 n=10+9)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1RewardDistance-8 324kB ±29% 222kB ±44% -31.33% (p=0.007 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_10RewardDistance-8 308kB ±32% 174kB ±14% -43.56% (p=0.000 n=10+8)
NEO_GetGASPerVote/MemPS_1000RewardRecords_100RewardDistance-8 298kB ±23% 178kB ±36% -40.26% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1000RewardDistance-8 362kB ± 6% 248kB ± 6% -31.54% (p=0.004 n=6+5)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1RewardDistance-8 5.15kB ± 3% 4.64kB ± 2% -9.92% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_10RewardRecords_10RewardDistance-8 5.36kB ± 1% 4.75kB ± 5% -11.42% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_10RewardRecords_100RewardDistance-8 8.15kB ± 4% 7.53kB ± 1% -7.62% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1000RewardDistance-8 33.2kB ± 5% 33.2kB ± 7% ~ (p=0.829 n=8+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1RewardDistance-8 20.1kB ± 7% 5.8kB ±13% -70.90% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_10RewardDistance-8 19.8kB ±14% 6.2kB ± 5% -68.87% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_100RewardRecords_100RewardDistance-8 21.7kB ± 6% 8.0kB ± 7% -63.20% (p=0.000 n=9+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1000RewardDistance-8 98.5kB ±44% 81.8kB ±48% ~ (p=0.143 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1RewardDistance-8 130kB ± 4% 4kB ± 9% -96.69% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_10RewardDistance-8 131kB ± 4% 5kB ±21% -96.48% (p=0.000 n=9+9)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_100RewardDistance-8 132kB ± 4% 6kB ±10% -95.39% (p=0.000 n=10+8)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1000RewardDistance-8 151kB ± 4% 26kB ±10% -82.46% (p=0.000 n=9+9)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1RewardDistance-8 5.92kB ± 3% 5.32kB ± 2% -10.01% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_10RewardDistance-8 6.09kB ± 2% 5.48kB ± 2% -10.00% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_100RewardDistance-8 9.61kB ± 1% 9.00kB ± 0% -6.29% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1000RewardDistance-8 33.4kB ± 7% 32.2kB ± 5% -3.60% (p=0.037 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1RewardDistance-8 22.3kB ±10% 9.0kB ±16% -59.78% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_10RewardDistance-8 23.6kB ± 6% 8.5kB ±20% -63.76% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_100RewardDistance-8 24.2kB ± 9% 11.5kB ± 4% -52.34% (p=0.000 n=10+8)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1000RewardDistance-8 44.2kB ± 6% 30.8kB ± 9% -30.24% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1RewardDistance-8 144kB ± 4% 10kB ±24% -93.39% (p=0.000 n=9+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_10RewardDistance-8 146kB ± 1% 11kB ±37% -92.14% (p=0.000 n=7+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_100RewardDistance-8 149kB ± 3% 11kB ±12% -92.28% (p=0.000 n=10+9)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1000RewardDistance-8 171kB ± 4% 34kB ±12% -80.00% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
NEO_GetGASPerVote/MemPS_10RewardRecords_1RewardDistance-8 95.0 ± 0% 74.0 ± 0% -22.11% (p=0.001 n=8+9)
NEO_GetGASPerVote/MemPS_10RewardRecords_10RewardDistance-8 100 ± 0% 78 ± 1% -21.70% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_100RewardDistance-8 153 ± 0% 131 ± 2% -14.25% (p=0.000 n=6+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_1000RewardDistance-8 799 ± 2% 797 ± 4% ~ (p=0.956 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_1RewardDistance-8 438 ± 6% 167 ± 0% -61.86% (p=0.000 n=10+9)
NEO_GetGASPerVote/MemPS_100RewardRecords_10RewardDistance-8 446 ± 5% 172 ± 0% -61.38% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_100RewardDistance-8 506 ± 4% 232 ± 1% -54.21% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_1000RewardDistance-8 1.31k ± 5% 0.97k ± 4% -26.20% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1RewardDistance-8 5.06k ± 1% 1.09k ± 2% -78.53% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_10RewardDistance-8 5.02k ± 3% 1.08k ± 0% -78.45% (p=0.000 n=10+8)
NEO_GetGASPerVote/MemPS_1000RewardRecords_100RewardDistance-8 5.09k ± 3% 1.15k ± 2% -77.48% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1000RewardDistance-8 5.83k ± 1% 1.87k ± 3% -68.02% (p=0.004 n=6+5)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1RewardDistance-8 103 ± 2% 82 ± 1% -20.83% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_10RewardRecords_10RewardDistance-8 107 ± 0% 86 ± 0% -19.63% (p=0.000 n=8+8)
NEO_GetGASPerVote/BoltPS_10RewardRecords_100RewardDistance-8 164 ± 1% 139 ± 0% -15.45% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1000RewardDistance-8 820 ± 1% 789 ± 1% -3.70% (p=0.000 n=9+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1RewardDistance-8 475 ± 0% 94 ± 3% -80.15% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_100RewardRecords_10RewardDistance-8 481 ± 0% 100 ± 2% -79.26% (p=0.000 n=9+9)
NEO_GetGASPerVote/BoltPS_100RewardRecords_100RewardDistance-8 549 ± 0% 161 ± 2% -70.69% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1000RewardDistance-8 1.61k ±19% 1.19k ±25% -26.05% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1RewardDistance-8 4.12k ± 0% 0.08k ± 2% -98.02% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_10RewardDistance-8 4.14k ± 0% 0.09k ± 3% -97.90% (p=0.000 n=9+9)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_100RewardDistance-8 4.19k ± 0% 0.15k ± 3% -96.52% (p=0.000 n=9+9)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1000RewardDistance-8 4.82k ± 1% 0.74k ± 1% -84.58% (p=0.000 n=10+9)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1RewardDistance-8 112 ± 4% 90 ± 3% -19.45% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_10RewardDistance-8 116 ± 2% 95 ± 2% -17.90% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_100RewardDistance-8 170 ± 3% 148 ± 3% -12.99% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1000RewardDistance-8 800 ± 2% 772 ± 2% -3.50% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1RewardDistance-8 480 ± 3% 118 ± 3% -75.32% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_10RewardDistance-8 479 ± 2% 123 ± 3% -74.33% (p=0.000 n=10+9)
NEO_GetGASPerVote/LevelPS_100RewardRecords_100RewardDistance-8 542 ± 1% 183 ± 3% -66.34% (p=0.000 n=10+9)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1000RewardDistance-8 1.19k ± 1% 0.79k ± 1% -33.41% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1RewardDistance-8 4.21k ± 1% 0.13k ±21% -96.83% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_10RewardDistance-8 4.23k ± 1% 0.15k ±17% -96.48% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_100RewardDistance-8 4.27k ± 0% 0.19k ± 6% -95.51% (p=0.000 n=10+9)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1000RewardDistance-8 4.89k ± 1% 0.79k ± 2% -83.80% (p=0.000 n=10+10)
2022-01-19 20:54:35 +03:00
Roman Khimov
4e864ca7fb
Merge pull request #2331 from nspcc-dev/extend-invokefunction-results
...
Extend invokefunction results
2022-01-19 18:25:41 +03:00
Anna Shaleva
cc60bca491
core: adjust native Notary withdraw
call flags
...
It changes states and calls `transfer` method of GAS which emits `transfer`
notification, so it requires States | AllowCall | AllowNotify, i.e. the
widest permission.
See
https://github.com/nspcc-dev/neo-go/issues/1990#issuecomment-1014911528 .
2022-01-19 11:33:33 +03:00
Roman Khimov
2e452df13a
rpc/storage: add storage changes to invoke* diagnostics
2022-01-19 00:02:19 +03:00
Roman Khimov
9c8ba5777e
Merge pull request #2323 from nspcc-dev/drop-blockchainer
...
Reduce blockchainer.Blockchainer use
2022-01-14 20:47:26 +03:00
Roman Khimov
294a70646e
core: lock block addition on state jump
...
It should be performed before we're able to process blocks or before we
shutdown (which uses addition lock), fix
panic: assignment to entry in nil map
goroutine 5755 [running]:
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemoryStore).drop(...)
/home/rik/dev/neo-go/pkg/core/storage/memory_store.go:74
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemoryStore).PutChangeSet(0xc00093e700, 0xc0002051a0, 0xc000205200, 0x1, 0x1)
/home/rik/dev/neo-go/pkg/core/storage/memory_store.go:100 +0x25c
github.com/nspcc-dev/neo-go/pkg/core/storage.(*MemoryStore).PutBatch(...)
/home/rik/dev/neo-go/pkg/core/storage/memory_store.go:90
github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).removeOldStorageItems(0xc000206a00)
/home/rik/dev/neo-go/pkg/core/blockchain.go:495 +0x33a
created by github.com/nspcc-dev/neo-go/pkg/core.(*Blockchain).jumpToStateInternal
/home/rik/dev/neo-go/pkg/core/blockchain.go:553 +0x68a
FAIL github.com/nspcc-dev/neo-go/pkg/core 52.084s
2022-01-14 20:25:39 +03:00
Roman Khimov
746644a4eb
network: decouple it from blockchainer.Blockchainer
...
We don't need all of it.
2022-01-14 19:57:16 +03:00
Roman Khimov
ddb23ccf78
core: shrink blockchainer.StateRoot further, leave simple RO methods
2022-01-14 19:57:16 +03:00
Roman Khimov
077d5ccb03
core: drop dangerous methods from blockchainer.StateRoot
...
CleanStorage and UpdateStateValidators should only be availabe to appropriate
core modules.
2022-01-14 19:57:16 +03:00
Roman Khimov
380e706255
core/state*: drop blockchainer.Blockchainer use
2022-01-14 19:57:16 +03:00
Roman Khimov
59b2696849
services/consensus: drop blockchainer.Blockchainer use
...
Simplify testing, avoid monstrous Blockchainer interface.
2022-01-14 19:57:16 +03:00
Roman Khimov
fc45d3b132
blockchain: properly set invocation counter for verification ctx
...
Fix problem noted in #2270 .
2022-01-14 19:57:16 +03:00
Roman Khimov
9f9bd7261c
core: return *interop.Context from GetTestVM
...
Return everything needed, fix #2273 .
2022-01-14 19:57:16 +03:00
Roman Khimov
ab2e60458d
interop: drop blockchainer dependency
...
Use local interface.
2022-01-14 19:57:16 +03:00
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
0ad3ea5944
network/cli: move Oracle service instantiation out of the network
2022-01-14 19:53:45 +03:00
Roman Khimov
5dd4db2c02
network/services: unify service lifecycle management
...
Run with Start, Stop with Shutdown, make behavior uniform.
2022-01-14 19:53:45 +03:00
AnnaShaleva
ce5dfdbe90
nativetest: migrate Notary contract tests to neotest
2022-01-14 17:56:10 +03:00
Anna Shaleva
df6a7d4258
nativetest: migrate Oracle contract tests to neotest
2022-01-14 17:56:10 +03:00
Anna Shaleva
0e1f85b2bf
vm: optimise emit.Array() to use NEWARRAY0 for zero-lenght arrays
2022-01-14 17:56:10 +03:00
Anna Shaleva
2f18b114f2
nativetest: migrate NEO contract tests to neotest
2022-01-14 17:56:10 +03:00
Anna Shaleva
e0ca05f62c
nativetest: migrate Management contract tests to neotest
2022-01-14 17:56:04 +03:00
Anna Shaleva
7927c8d8f5
nativetest: migrate Designation contract tests to neotest
2022-01-14 16:47:31 +03:00
Anna Shaleva
3f1af71f52
nativetest: migrate GAS contract tests to neotest framework
2022-01-14 16:47:31 +03:00
Anna Shaleva
4e7435081f
nativetest: migrate Ledger contract tests to neotest
2022-01-14 16:47:27 +03:00
Anna Shaleva
bbe92c21ea
nativetest: migrate Policy contract tests to neotest
2022-01-14 16:34:33 +03:00
Anna Shaleva
2c46b81864
native: optimize gas per vote calculation
...
GAS per vote records are being returned from Seek in ascending way, and
we need the last record before the specified index which is close to
the current chain's height (most of the time). To optimize we can
iterate backwards strting from the last record using SeekBackwards.
name old time/op new time/op delta
NEO_GetGASPerVote/MemPS_10RewardRecords_1RewardDistance-8 27.7µs ± 8% 30.3µs ± 2% +9.36% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_10RewardDistance-8 32.1µs ± 6% 37.4µs ± 5% +16.41% (p=0.000 n=9+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_100RewardDistance-8 60.9µs ± 8% 68.1µs ± 9% +11.72% (p=0.001 n=10+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_1000RewardDistance-8 384µs ± 9% 437µs ± 2% +13.68% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_1RewardDistance-8 227µs ± 5% 255µs ± 6% +12.37% (p=0.000 n=9+9)
NEO_GetGASPerVote/MemPS_100RewardRecords_10RewardDistance-8 222µs ± 9% 332µs ±47% +49.64% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_100RewardDistance-8 245µs ± 8% 293µs ±13% +19.64% (p=0.000 n=10+9)
NEO_GetGASPerVote/MemPS_100RewardRecords_1000RewardDistance-8 731µs ±14% 1071µs ±57% +46.58% (p=0.001 n=9+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1RewardDistance-8 7.45ms ±48% 9.83ms ±44% +32.00% (p=0.019 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_10RewardDistance-8 8.54ms ±46% 10.18ms ±46% ~ (p=0.218 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_100RewardDistance-8 7.35ms ±43% 7.72ms ±56% ~ (p=0.579 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1000RewardDistance-8 3.52ms ±32% 3.91ms ±24% ~ (p=0.684 n=10+10)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1RewardDistance-8 25.2µs ± 5% 23.8µs ± 4% -5.25% (p=0.016 n=10+8)
NEO_GetGASPerVote/BoltPS_10RewardRecords_10RewardDistance-8 29.5µs ± 8% 26.2µs ± 3% -11.13% (p=0.000 n=10+8)
NEO_GetGASPerVote/BoltPS_10RewardRecords_100RewardDistance-8 44.9µs ±11% 40.2µs ± 9% -10.50% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1000RewardDistance-8 100µs ± 9% 83µs ±15% -16.75% (p=0.000 n=9+9)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1RewardDistance-8 88.4µs ± 8% 65.8µs ±17% -25.52% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_100RewardRecords_10RewardDistance-8 88.9µs ± 7% 65.4µs ±20% -26.44% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_100RewardDistance-8 94.4µs ± 9% 63.1µs ±18% -33.15% (p=0.000 n=9+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1000RewardDistance-8 354µs ±35% 443µs ±49% ~ (p=0.190 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1RewardDistance-8 469µs ±20% 227µs ±21% -51.66% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_10RewardDistance-8 468µs ±17% 267µs ±32% -42.92% (p=0.000 n=9+9)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_100RewardDistance-8 480µs ±14% 253µs ±20% -47.25% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1000RewardDistance-8 497µs ±15% 311µs ±37% -37.39% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1RewardDistance-8 27.2µs ± 8% 28.3µs ± 6% ~ (p=0.165 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_10RewardDistance-8 29.3µs ± 4% 30.2µs ± 8% ~ (p=0.089 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_100RewardDistance-8 51.7µs ±10% 54.3µs ±16% ~ (p=0.218 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1000RewardDistance-8 107µs ± 8% 112µs ±15% ~ (p=0.190 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1RewardDistance-8 103µs ± 3% 97µs ±27% ~ (p=0.633 n=8+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_10RewardDistance-8 98.5µs ±10% 89.2µs ± 9% -9.46% (p=0.004 n=10+9)
NEO_GetGASPerVote/LevelPS_100RewardRecords_100RewardDistance-8 100µs ±10% 95µs ±14% ~ (p=0.243 n=9+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1000RewardDistance-8 222µs ± 7% 135µs ±40% -39.16% (p=0.000 n=9+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1RewardDistance-8 587µs ± 3% 448µs ±29% -23.58% (p=0.000 n=8+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_10RewardDistance-8 569µs ± 9% 438µs ±24% -22.98% (p=0.000 n=9+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_100RewardDistance-8 578µs ±17% 436µs ±19% -24.49% (p=0.000 n=9+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1000RewardDistance-8 683µs ±10% 480µs ±29% -29.76% (p=0.000 n=9+9)
name old alloc/op new alloc/op delta
NEO_GetGASPerVote/MemPS_10RewardRecords_1RewardDistance-8 5.43kB ± 0% 4.83kB ± 0% -11.06% (p=0.000 n=9+9)
NEO_GetGASPerVote/MemPS_10RewardRecords_10RewardDistance-8 5.74kB ± 0% 5.00kB ± 0% -12.91% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_100RewardDistance-8 9.90kB ± 0% 8.49kB ± 0% -14.24% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_1000RewardDistance-8 62.9kB ± 0% 55.6kB ± 0% -11.63% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_1RewardDistance-8 37.5kB ± 0% 29.5kB ± 1% -21.31% (p=0.000 n=9+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_10RewardDistance-8 37.8kB ± 1% 30.0kB ± 2% -20.71% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_100RewardDistance-8 40.6kB ± 1% 32.0kB ± 1% -21.20% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_1000RewardDistance-8 105kB ±13% 81kB ± 9% -22.81% (p=0.000 n=10+9)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1RewardDistance-8 374kB ± 1% 282kB ±24% -24.58% (p=0.000 n=8+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_10RewardDistance-8 376kB ± 9% 280kB ±11% -25.55% (p=0.000 n=8+9)
NEO_GetGASPerVote/MemPS_1000RewardRecords_100RewardDistance-8 359kB ± 9% 289kB ±19% -19.60% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1000RewardDistance-8 443kB ± 1% 362kB ± 8% -18.30% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1RewardDistance-8 5.71kB ± 1% 5.17kB ± 1% -9.40% (p=0.000 n=10+7)
NEO_GetGASPerVote/BoltPS_10RewardRecords_10RewardDistance-8 6.04kB ± 1% 5.40kB ± 1% -10.61% (p=0.000 n=10+8)
NEO_GetGASPerVote/BoltPS_10RewardRecords_100RewardDistance-8 9.59kB ± 4% 8.19kB ± 1% -14.60% (p=0.000 n=10+8)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1000RewardDistance-8 41.6kB ± 2% 33.7kB ± 8% -18.98% (p=0.000 n=9+9)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1RewardDistance-8 29.2kB ± 2% 20.2kB ± 7% -30.94% (p=0.000 n=9+9)
NEO_GetGASPerVote/BoltPS_100RewardRecords_10RewardDistance-8 29.6kB ± 4% 20.3kB ± 8% -31.58% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_100RewardDistance-8 32.4kB ± 4% 21.7kB ± 5% -33.25% (p=0.000 n=9+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1000RewardDistance-8 98.8kB ±17% 109.8kB ±41% ~ (p=0.353 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1RewardDistance-8 220kB ± 2% 129kB ± 3% -41.40% (p=0.000 n=9+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_10RewardDistance-8 219kB ± 4% 135kB ± 7% -38.52% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_100RewardDistance-8 223kB ± 5% 132kB ± 6% -40.69% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1000RewardDistance-8 263kB ± 5% 155kB ± 8% -41.23% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1RewardDistance-8 6.19kB ± 1% 5.94kB ± 1% -4.15% (p=0.000 n=10+9)
NEO_GetGASPerVote/LevelPS_10RewardRecords_10RewardDistance-8 6.51kB ± 0% 6.10kB ± 2% -6.27% (p=0.000 n=8+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_100RewardDistance-8 10.1kB ± 2% 9.7kB ± 3% -4.45% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1000RewardDistance-8 35.4kB ± 1% 33.6kB ± 3% -5.13% (p=0.000 n=9+9)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1RewardDistance-8 28.1kB ± 3% 22.6kB ±10% -19.58% (p=0.000 n=9+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_10RewardDistance-8 28.0kB ± 3% 23.7kB ± 9% -15.54% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_100RewardDistance-8 29.5kB ± 3% 24.8kB ±10% -16.08% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1000RewardDistance-8 53.7kB ± 4% 44.6kB ± 5% -16.83% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1RewardDistance-8 207kB ± 2% 148kB ± 3% -28.58% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_10RewardDistance-8 206kB ± 2% 148kB ± 4% -28.20% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_100RewardDistance-8 208kB ± 1% 149kB ± 3% -28.07% (p=0.000 n=9+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1000RewardDistance-8 234kB ± 2% 171kB ± 5% -26.71% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
NEO_GetGASPerVote/MemPS_10RewardRecords_1RewardDistance-8 129 ± 1% 95 ± 1% -26.33% (p=0.000 n=10+9)
NEO_GetGASPerVote/MemPS_10RewardRecords_10RewardDistance-8 139 ± 1% 100 ± 1% -27.85% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_100RewardDistance-8 225 ± 1% 155 ± 1% -31.11% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_10RewardRecords_1000RewardDistance-8 1.22k ± 3% 0.86k ± 1% -29.14% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_1RewardDistance-8 863 ± 2% 468 ± 4% -45.72% (p=0.000 n=9+9)
NEO_GetGASPerVote/MemPS_100RewardRecords_10RewardDistance-8 872 ± 2% 490 ± 7% -43.89% (p=0.000 n=8+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_100RewardDistance-8 973 ± 1% 550 ± 5% -43.44% (p=0.000 n=9+10)
NEO_GetGASPerVote/MemPS_100RewardRecords_1000RewardDistance-8 2.11k ± 1% 1.37k ± 2% -35.11% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1RewardDistance-8 9.00k ± 1% 5.05k ± 1% -43.94% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_10RewardDistance-8 9.04k ± 1% 5.06k ± 1% -43.97% (p=0.000 n=10+9)
NEO_GetGASPerVote/MemPS_1000RewardRecords_100RewardDistance-8 9.15k ± 1% 5.10k ± 2% -44.24% (p=0.000 n=10+10)
NEO_GetGASPerVote/MemPS_1000RewardRecords_1000RewardDistance-8 10.2k ± 0% 5.8k ± 1% -42.60% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1RewardDistance-8 136 ± 1% 103 ± 0% -24.15% (p=0.000 n=10+7)
NEO_GetGASPerVote/BoltPS_10RewardRecords_10RewardDistance-8 146 ± 0% 107 ± 0% -26.71% (p=0.000 n=9+6)
NEO_GetGASPerVote/BoltPS_10RewardRecords_100RewardDistance-8 232 ± 1% 164 ± 0% -29.46% (p=0.000 n=10+7)
NEO_GetGASPerVote/BoltPS_10RewardRecords_1000RewardDistance-8 1.21k ± 1% 0.82k ± 1% -31.99% (p=0.000 n=10+8)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1RewardDistance-8 876 ± 0% 474 ± 0% -45.85% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_10RewardDistance-8 888 ± 0% 481 ± 0% -45.82% (p=0.000 n=9+10)
NEO_GetGASPerVote/BoltPS_100RewardRecords_100RewardDistance-8 990 ± 1% 550 ± 0% -44.49% (p=0.000 n=10+9)
NEO_GetGASPerVote/BoltPS_100RewardRecords_1000RewardDistance-8 2.29k ± 8% 1.70k ±19% -25.86% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1RewardDistance-8 8.18k ± 1% 4.15k ± 2% -49.33% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_10RewardDistance-8 8.19k ± 1% 4.14k ± 0% -49.41% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_100RewardDistance-8 8.29k ± 1% 4.21k ± 2% -49.20% (p=0.000 n=10+10)
NEO_GetGASPerVote/BoltPS_1000RewardRecords_1000RewardDistance-8 9.31k ± 1% 4.84k ± 1% -48.05% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1RewardDistance-8 144 ± 1% 112 ± 3% -22.09% (p=0.000 n=8+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_10RewardDistance-8 153 ± 2% 116 ± 3% -23.66% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_100RewardDistance-8 236 ± 1% 172 ± 4% -27.33% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_10RewardRecords_1000RewardDistance-8 1.16k ± 0% 0.81k ± 1% -30.00% (p=0.000 n=9+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1RewardDistance-8 859 ± 1% 481 ± 2% -44.07% (p=0.000 n=9+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_10RewardDistance-8 872 ± 1% 478 ± 2% -45.14% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_100RewardRecords_100RewardDistance-8 968 ± 1% 550 ± 2% -43.21% (p=0.000 n=10+8)
NEO_GetGASPerVote/LevelPS_100RewardRecords_1000RewardDistance-8 1.89k ± 1% 1.19k ± 1% -37.21% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1RewardDistance-8 8.14k ± 0% 4.22k ± 0% -48.10% (p=0.000 n=10+9)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_10RewardDistance-8 8.17k ± 0% 4.21k ± 1% -48.43% (p=0.000 n=10+10)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_100RewardDistance-8 8.23k ± 0% 4.28k ± 0% -48.00% (p=0.000 n=10+8)
NEO_GetGASPerVote/LevelPS_1000RewardRecords_1000RewardDistance-8 9.14k ± 0% 4.90k ± 1% -46.45% (p=0.000 n=10+10)
2022-01-13 13:47:05 +03:00
Anna Shaleva
04a8e6666f
storage: allow to seek backwards
2022-01-13 12:44:29 +03:00
AnnaShaleva
6bc92abe19
storage: allow to seek starting from some point
2022-01-13 12:44:29 +03:00
Anna Shaleva
7d5b20d8dd
core: fix comments formatting
2022-01-13 12:44:29 +03:00
Anna Shaleva
5770a581c3
store: improve Seek tests
...
After #2193 Seek results are sorted in an ascending way, so technically
the test was needed to be fixed along with these changes.
2022-01-13 12:44:29 +03:00
Anna Shaleva
9879514412
core: add benchmark for (*NEO).getGASPerVote
2022-01-13 12:44:19 +03:00
Roman Khimov
c942402957
blockchainer: drop Policer interface
...
We never use it as a proper interface, so it makes no sense keeping it this
way.
2022-01-12 00:58:03 +03:00
AnnaShaleva
8c6de35ec2
core: fix GAS distribution to primary node when notary enabled
...
Close #2310 .
2021-12-14 12:18:47 +03:00
Roman Khimov
b43335e591
Merge pull request #2306 from nspcc-dev/call-tokens
...
compiler: use CALLT for native contract calls, fix #2257
2021-12-10 13:05:55 +03:00
Roman Khimov
299a7ea614
compiler: use CALLT for native contract calls, fix #2257
2021-12-10 11:58:50 +03:00
Roman Khimov
4c39b6600d
*: store application long along with tx/block
...
Two times less keys inserted into the DB per tx leads to ~13% TPS
improvement. We also drop one goroutine with it which isn't bad as well.
2021-12-09 15:39:26 +03:00
Roman Khimov
f87c595d94
core: fix TestRestoreAfterDeploy
...
A bit longer script easily solves the size problem.
2021-12-08 12:05:31 +03:00
Roman Khimov
ac7e922606
native: avoid big.Int allocation in burn()
...
addTokens and incBalance only read the amount, so it's not a problem.
2021-12-02 15:40:43 +03:00
Roman Khimov
a003879b84
native: avoid allocations in increaseBalance
2021-12-02 15:33:30 +03:00
Roman Khimov
ffeb3b8473
transaction: microoptimize Hash()
...
It doesn't cost much, but it's used _a lot_, so optimizing it makes sense.
name old time/op new time/op delta
TxHash-8 4.89ns ± 5% 0.54ns ± 2% -88.86% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
TxHash-8 0.00B 0.00B ~ (all equal)
name old allocs/op new allocs/op delta
TxHash-8 0.00 0.00 ~ (all equal)
2021-12-02 14:48:35 +03:00
Roman Khimov
418ba1dbc3
*: use internal variables for simple big.NewInt() values
...
Avoid additional allocations.
2021-12-01 21:36:25 +03:00
Roman Khimov
9576e10d04
storage: use map size hints to optimize subsequent persist()
...
We're likely to have something comparable to the current changeset in the
subsequent one. If it's bigger, no big deal, it'll be reallocated, if it's
smaller, no big deal, the next one will be preallocated smaller.
2021-12-01 21:36:25 +03:00
Roman Khimov
428ba48444
mempool: use capacity parameter to avoid map reallocations
...
Which is what happens in AddBlock that fills a new pool with exactly the
number of transactions we know already.
2021-12-01 21:36:25 +03:00
Roman Khimov
748a70569a
mempool: use uint256 library for fee tracking
...
It's very effective in avoiding allocations for big.Int, we don't have a
microbenchmark for memppol, but this improves TPS metrics by ~1-2%, so it's
noticeable.
2021-12-01 21:36:25 +03:00
Roman Khimov
01d15ff473
Merge pull request #2270 from nspcc-dev/vm-invoked-contracts
...
Add invoked contract tracing
2021-12-01 11:27:27 +03:00
Anna Shaleva
1d1538c566
services: fix Oracle response transaction creation
...
Problem: transactions with wrong hashes are accepted to the chain if
consensus nodes are designated as Oracle nodes. The result is wrong
MerkleRoot for the accepted block. Consensus nodes got such blocks
right from the dbft and store them without errors, but if
non-consensus nodes are present in the network, they just can't accept
these "bad" blocks:
```
2021-11-29T12:56:40.533+0300 WARN blockQueue: failed adding block into the blockchain {"error": "invalid block: MerkleRoot mismatch (expected a866b57ad637934f7a7700e3635a549387e644970b42681d865a54c3b3a46122, calculated d465aafabaf4539a3f619d373d178eeeeab7acb9847e746e398706c8c1582bf8)", "blockHeight": 17, "nextIndex": 18}
```
This problem happens because of transaction hash caching. We can't set
transaction hash if transaction construction wasn't yet completed.
2021-11-30 10:43:58 +03:00
Roman Khimov
33e37e60e5
Merge pull request #2264 from nspcc-dev/fix-win-tests
...
*: Windows compatibility fixes
2021-11-29 11:25:35 +03:00
AnnaShaleva
aefb6f9fee
*: fix tests failing due to path.Join usage
...
Solution:
Use `file/filepath` package to construct expected path. This package is OS-aware, see https://github.com/golang/go/issues/30616 .
2021-11-29 11:11:09 +03:00
AnnaShaleva
06beb4d534
core: fix TestMemCachedPersist test
...
Problem:
```
--- FAIL: TestMemCachedPersist (0.07s)
--- FAIL: TestMemCachedPersist/BoltDBStore (0.07s)
testing.go:894: TempDir RemoveAll cleanup: remove C:\Users\Anna\AppData\Local\Temp\TestMemCachedPersist_BoltDBStore294966711\001\test_bolt_db: The process cannot access the file because it is being used by another process.
```
Solution:
Release the resources occupied by the DB.
2021-11-26 18:26:27 +03:00
Evgeniy Stratonikov
fac595bbdf
core: remove old storage items asynchronously
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-24 16:25:11 +03:00
Evgeniy Stratonikov
582d489c90
dao: add P2PStateExchangeExtensions
setting to dao.Version
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-24 16:22:27 +03:00
Evgeniy Stratonikov
f1767f361d
dao: add KeepOnlyLatestState
setting to dao.Version
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-24 16:22:27 +03:00
Evgeniy Stratonikov
f7e2d3d717
dao: add stateroot-related settings to Version
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-24 16:22:27 +03:00
Evgeniy Stratonikov
856e9cf67b
statesync: copy state by swapping prefix
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-24 16:22:27 +03:00
Evgeniy Stratonikov
6c5a7d9b29
dao: include settings in Version
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-24 16:22:26 +03:00
Evgeniy Stratonikov
856385b106
dao: use custom storage prefix
...
We use 2 prefixes for storing items because of state synchronization.
This commit allows to parametrize dao with the default prefix.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-24 16:22:07 +03:00
Roman Khimov
5fbe838fd4
core: add and use synchronous persist to avoid OOM
...
b9be892bf9
has made Persist asynchronous which
is very effective in allowing the system to continue processing
blocks/transactions while flushing things to disk. It at the same time is very
dangerous in that if the disk is slow and it takes much time to flush KV set
(more than persisting interval), there might be even bigger new KV set in
MemCachedStore by the time it finishes. Even if the system immediately starts
to flush this new data set it (being bigger) can take more time than the
previous one. And while doing so a new data set will appear in memory,
potentially again bigger than this.
So we can easily end up with the system going out of control, consuming more
and more memory and taking more and more time to persist a single set of
data. To avoid this we need to detect such condition and just wait for Persist
to really finish its job and release the resources.
2021-11-22 10:41:40 +03:00
Roman Khimov
83d0b2f465
interop: move invocation counter from VM to Context
...
It's created for interop and used by interop, VM doesn't care.
2021-11-20 21:57:41 +03:00
Roman Khimov
29cda5112a
vm: simplify NEF loading by providing a special method
...
Offsets are still handled outside of VM to avoid introducing manifest
dependency (that's likely to be circular).
2021-11-20 21:57:41 +03:00
Roman Khimov
c53d978edd
vm: drop ParamCount from Context
...
It's unused and it's useless.
2021-11-20 21:57:41 +03:00
Roman Khimov
765235eca3
vm: omit context parameter from Call()
...
It's not used and should not be used to switch from contract to contract.
2021-11-20 21:57:41 +03:00
Roman Khimov
7b713762be
vm: do not increment invocation counter in Call
...
Everywhere it matters (and that's callExFromNative() now) it's incremented
already, so when we're doing Call() at the same time (and it's done to invoke
`_initialize` method) we're effectively double-incrementing it.
2021-11-20 21:57:41 +03:00
Roman Khimov
a577d40de9
vm: move Jump method to the Context
...
Because it's only relevant for execution context itself.
2021-11-20 21:57:35 +03:00
Roman Khimov
8c704a49b5
interop/contract: micro-optimize argument pushes
...
Calling Estack() again and again is not very productive.
2021-11-19 16:26:01 +03:00
Roman Khimov
d1f4928e29
contract: drop useless code from call processing
...
It's done already by LoadScriptWithCallingHash()
2021-11-19 16:22:30 +03:00
Roman Khimov
aa06770b3d
Merge pull request #2266 from nspcc-dev/nep-11-tracking
...
NEP-11 tracking
2021-11-19 13:07:37 +03:00
Roman Khimov
ce9d0b22cf
*: use NEP-XX naming consistently in docs/comments
...
Standards are NEP-11 and NEP-17, not NEP11, not NEP17, not anything
else. Variable/function names of course can use whatever fits, but documents
and comments should be consistent wrt this.
2021-11-19 12:58:46 +03:00
Roman Khimov
b622c1934d
core: only save token logs if there is something to save
...
Makes no sense storing empty ones.
2021-11-18 00:09:10 +03:00
Roman Khimov
f3278ea5b2
core: reuse the transfer log buffer
...
Make it a bit more efficient.
2021-11-18 00:09:10 +03:00
Roman Khimov
125e4231b0
core: store NEP-11 transfers, add accessor functions
2021-11-18 00:09:10 +03:00
Roman Khimov
7f40a0cfd8
state: prime token transfer info with the demand for new logs
...
Setting NewNEPXXBatch avoids the need to get them from the database which is
useful for newly tracked accounts.
2021-11-16 22:52:10 +03:00
Roman Khimov
095ed3f64e
dao: drop unused AppendNEP17Transfer()
2021-11-16 22:51:04 +03:00
Roman Khimov
c63aeb38bb
state: prepare for NEP-11 data tracking, refactor/rename
...
There is a lot of similarity, so try reusing common code and use more neutral
naming.
2021-11-16 19:18:06 +03:00
Roman Khimov
ecfe3e7247
Merge pull request #2260 from nspcc-dev/fix-notary-test-failure
...
Fix notary test failure
2021-11-16 16:09:41 +03:00
Roman Khimov
3b08b5b19b
native: add NEP-11 tracking to management contract
2021-11-16 13:28:59 +03:00
Roman Khimov
f96d9d168e
native/interop: use oracle request signers for oracle response witness
...
Oracle responses must use the same set of signers as oracle requests even
though the transaction itself is signed by oracle nodes/contract.
We can probably improve interop.Context by removing Tx field completely and
adding more functionality to Container, but it's not very convenient for
VerifyWitness and will require adding more stub-like methods for Block, so Tx
is used for now (and we do have it in every relevant case).
2021-11-16 11:51:15 +03:00
Roman Khimov
65016e8070
core: fix data race in notary test
...
I don't think it's possible with regular service functioning, but it happens
during testing because of pointer reuse:
WARNING: DATA RACE
Read at 0x00c003a0e3f0 by goroutine 114:
github.com/nspcc-dev/neo-go/pkg/services/notary.(*Notary).verifyIncompleteWitnesses()
/home/runner/work/neo-go/neo-go/pkg/services/notary/notary.go:441 +0x1dc
github.com/nspcc-dev/neo-go/pkg/services/notary.(*Notary).OnNewRequest()
/home/runner/work/neo-go/neo-go/pkg/services/notary/notary.go:188 +0x205
github.com/nspcc-dev/neo-go/pkg/core.TestNotary.func11()
/home/runner/work/neo-go/neo-go/pkg/core/notary_test.go:347 +0x612
github.com/nspcc-dev/neo-go/pkg/core.TestNotary()
/home/runner/work/neo-go/neo-go/pkg/core/notary_test.go:443 +0xe33
testing.tRunner()
/opt/hostedtoolcache/go/1.16.10/x64/src/testing/testing.go:1193 +0x202
Previous write at 0x00c003a0e3f0 by goroutine 104:
github.com/nspcc-dev/neo-go/pkg/services/notary.(*Notary).finalize()
/home/runner/work/neo-go/neo-go/pkg/services/notary/notary.go:338 +0x50a
github.com/nspcc-dev/neo-go/pkg/services/notary.(*Notary).PostPersist()
/home/runner/work/neo-go/neo-go/pkg/services/notary/notary.go:314 +0x297
github.com/nspcc-dev/neo-go/pkg/services/notary.(*Notary).Run()
/home/runner/work/neo-go/neo-go/pkg/services/notary/notary.go:169 +0x4a7
2021-11-15 17:33:02 +03:00
Roman Khimov
f48dffe0e6
core: fix fallback VUB value in notary test
...
Serializing/deserializing the payload yields this:
Error: Received unexpected error:
both main and fallback transactions should have the same ValidUntil value
2021-11-15 17:32:14 +03:00
Roman Khimov
b31a8d750e
Merge pull request #2252 from nspcc-dev/packmap-packstruct
...
vm: add PACKMAP/PACKSTRUCT, extend UNPACK
2021-11-12 18:25:54 +03:00
Roman Khimov
9cdd360606
Merge pull request #2251 from nspcc-dev/rules-witness-scope
...
transaction: add new Rules witness scope
2021-11-12 18:25:39 +03:00
Roman Khimov
3e6ce3c221
vm: add PACKMAP/PACKSTRUCT, extend UNPACK
...
See neo-project/neo-vm#443 .
2021-11-12 17:19:59 +03:00
Roman Khimov
9875799893
transaction: add new Rules witness scope
...
See neo-project/neo#2622 . The implementation is somewhat asymmetric (and not
very efficient) for binary/JSON encoding/decoding, but it should be
sufficient.
2021-11-12 15:29:28 +03:00
Roman Khimov
0a7f8afcea
Merge pull request #2229 from nspcc-dev/contract-test
...
Generic contract testing infrastructure
2021-11-11 11:46:55 +03:00
Evgeniy Stratonikov
ce549e4cb2
core/test: allow to determine system fee automatically
...
Eventually this will be replaced by `pkg/neotest` invocations but for
now it allows us to remove NNS constants together with the tests.
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Evgeniy Stratonikov
e3625152c6
core: move NNS test out of core
...
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2021-11-11 11:15:15 +03:00
Roman Khimov
6b8e615094
Merge pull request #2234 from nspcc-dev/rpc/params-parsing
...
rpc: method-specific parameters parsing optimisation
2021-11-10 20:45:44 +03:00
Anna Shaleva
1a32fcb2dc
core: specify method not found
call error
...
It's useful for debugging and external users.
2021-11-08 17:19:00 +03:00
Roman Khimov
328f8b7954
Merge pull request #2238 from nspcc-dev/fix-block-queue
...
network: remove priority queue from block queue
2021-11-01 12:03:45 +03:00
Roman Khimov
8bb1ecb45a
network: remove priority queue from block queue
...
Use circular buffer which is a bit more appropriate. The problem is that
priority queue accepts and stores equal items which wastes memory even in
normal usage scenario, but it's especially dangerous if the node is stuck for
some reason. In this case it'll accept from peers and put into queue the same
blocks again and again leaking memory up to OOM condition.
Notice that queue length calculation might be wrong in case circular buffer
wraps, but it's not very likely to happen (usually blocks not coming from the
queue are added by consensus and it's not very fast in doing so).
2021-11-01 11:49:01 +03:00
Roman Khimov
67eac3a27f
Merge pull request #2196 from nspcc-dev/drop-badger-and-redis
...
Drop Badger and Redis
2021-10-28 16:08:49 +03:00
AnnaShaleva
3fed7b8eec
core: handle empty MPT batch properly
...
It's OK to have it.
2021-10-27 18:44:39 +03:00
Roman Khimov
1144a03486
storage: drop RedisDB, close #2130
2021-10-27 17:32:25 +03:00
Roman Khimov
fb4b87bb96
storage: drop BadgerDB support, close #2130
2021-10-27 17:31:55 +03:00
AnnaShaleva
2d196b3f35
rpc: refactor calculatenetworkfee
handler
...
Use (Blockchainer).VerifyWitness() to calculate network fee for
contract-based witnesses.
2021-10-25 19:07:25 +03:00
Anna Shaleva
75d7891ca1
services: add ability to combine notary signers
...
Notes for witnesses:
* [N sig + M multisig + K contract] combination is possible where N, M, K >=0.
* Each verification script should be properly filled in.
* Each invocation script should either be empty or contain exactly one
signature.
2021-10-25 12:22:13 +03:00
Roman Khimov
d551439654
Merge pull request #2193 from nspcc-dev/optimize-find
...
core: optimise (*MemCachedStorage).Seek
2021-10-21 21:20:33 +03:00
Anna Shaleva
3450371910
core: split (*MemCachedStore) Seek and SeekAsync methods
...
Use SeekAsync for System.Storage.Find and Seek for the rest of cases.
2021-10-21 10:05:12 +03:00
Anna Shaleva
dcda7bec63
core: squash PS-seeking and merging routines in (*MemCachedStore).Seek
...
We don't need a separate routine to merge seek results.
2021-10-21 10:05:12 +03:00
Anna Shaleva
c88720bf45
core: remove memstore routine from (*MemCachedStore).SeekAsync
...
It adds unnecessary overhead to computations.
2021-10-21 10:05:12 +03:00
Anna Shaleva
dfe2c667e1
core: do not hold the lock while seeking over persistent store
2021-10-21 10:05:12 +03:00
Anna Shaleva
07cbe4d253
core: add finalizer functions to interop context
...
These functions are aimed to free the resources occupied by storage
iterator by the end of script execution or whenever Finilize is called.
2021-10-21 10:05:12 +03:00