nimbus-eth1/tests
Jacek Sieka 188d689d9d
Speed up initial MPT root computation after import (#2788)
When `nimbus import` runs, we end up with a database without MPT roots
leading to long startup times the first time one is needed.

Computing the state root is slow because the on-disk order based on
VertexID sorting does not match the trie traversal order and therefore
makes lookups inefficent.

Here we introduce a helper that speeds up this computation by traversing
the trie in on-disk order and computing the trie hashes bottom up
instead - even though this leads to some redundant reads of nodes that
we cannot yet compute, it's still a net win as leaves and "bottom"
branches make up the majority of the database.

This PR also addresses a few other sources of inefficiency largely due
to the separation of AriKey and AriVtx into their own column families.

Each column family is its own LSM tree that produces hundreds of SST
filtes - with a limit of 512 open files, rocksdb must keep closing and
opening files which leads to expensive metadata reads during random
access.

When rocksdb makes a lookup, it has to read several layers of files for
each lookup. Ribbon filters to skip over files that don't have the
requested data but when these filters are not in memory, reading them is
slow - this happens in two cases: when opening a file and when the
filter has been evicted from the LRU cache. Addressing the open file
limit solves one source of inefficiency, but we must also increase the
block cache size to deal with this problem.

* rocksdb.max_open_files increased to 2048
* per-file size limits increased so that fewer files are created
* WAL size increased to avoid partial flushes which lead to small files
* rocksdb block cache increased

All these increases of course lead to increased memory usage, but at
least performance is acceptable - in the future, we'll need to explore
options such as joining AriVtx and AriKey and/or reducing the row count
(by grouping branch layers under a single vertexid).

With this PR, the mainnet state root can be computed in ~8 hours (down
from 2-3 days) - not great, but still better.

Further, we write all keys to the database, also those that are less
than 32 bytes - because the mpt path is part of the input, it is very
rare that we actually hit a key like this (about 200k such entries on
mainnet), so the code complexity is not worth the benefit really, in the
current database layout / design.
2024-10-27 11:08:37 +00:00
..
bootstrap config: fix new config based on input from jamie and zahary 2021-09-18 17:34:51 +07:00
customgenesis ForkedChainRef.forkchoice: Skip newBase calculation and skip chain finalization if finalizedHash is zero (#2654) 2024-09-27 07:53:27 +07:00
db Added support for namespaces to RocksDb kvstore. (#2066) 2024-03-12 11:04:46 +08:00
fixtures Fix EIP-2537: Precompile for BLS12-381 curve operations (#2603) 2024-09-10 06:56:08 +00:00
graphql Workaround for 0 gas price estimation (#2180) 2024-05-28 13:36:38 +07:00
invalid_keystore Fix keystore loader bug (#2774) 2024-10-24 04:07:06 +00:00
keystore implement more eth rpc and keystore management 2020-07-23 14:54:32 +07:00
replay Bump nim-eth and nimbus-eth2 (#2741) 2024-10-16 13:51:38 +07:00
test_aristo Speed up initial MPT root computation after import (#2788) 2024-10-27 11:08:37 +00:00
test_coredb Aristo lazily delete larger subtrees (#2560) 2024-08-14 08:54:44 +00:00
test_jwt_auth Enable JWT authentication for websockets (#1039) 2022-04-06 15:11:13 +01:00
test_txpool Bump nim-eth and nimbus-eth2 (#2741) 2024-10-16 13:51:38 +07:00
all_tests.nim Use eth/common transaction signature utilities (#2696) 2024-10-04 16:34:31 +02:00
all_tests_macro.nim Cache code and invalid jump destination tables (fixes #2268) (#2404) 2024-06-21 09:44:10 +02:00
asynctest.nim Core db and aristo updates for destructor and tx logic (#1894) 2023-11-16 19:35:03 +00:00
macro_assembler.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
nim.cfg import: read from era files (#2254) 2024-05-31 09:13:56 +02:00
persistBlockTestGen.nim Use eth/common transaction signature utilities (#2696) 2024-10-04 16:34:31 +02:00
test_allowed_to_fail.nim ForkedChain implementation (#2405) 2024-06-26 07:27:48 +07:00
test_aristo.nim Ordered trie (#2712) 2024-10-09 09:44:15 +02:00
test_block_fixture.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_blockchain_json.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_config.nim Bump nim-eth, nim-web3, nimbus-eth2 (#2344) 2024-06-14 14:31:08 +07:00
test_configuration.nim Fix keystore loader bug (#2774) 2024-10-24 04:07:06 +00:00
test_coredb.nim Cleanup (#2565) 2024-08-15 12:31:07 +00:00
test_difficulty.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_engine_api.nim Fixes related to executionRequests of Pectra (#2787) 2024-10-26 11:10:54 +00:00
test_evm_support.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_filters.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_forked_chain.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_forkid.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_generalstate_json.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_genesis.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_getproof_json.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_graphql.nim move db init to init (#2552) 2024-08-08 07:45:30 +02:00
test_helpers.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_jwt_auth.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_ledger.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_multi_keys.nim Cleanup stateless and block witness code. (#2295) 2024-06-08 15:05:00 +07:00
test_op_arith.nim Fix styles and reduce compiler warnings (#2086) 2024-03-20 14:35:38 +07:00
test_op_bit.nim Fix styles and reduce compiler warnings (#2086) 2024-03-20 14:35:38 +07:00
test_op_custom.nim Fix styles and reduce compiler warnings (#2086) 2024-03-20 14:35:38 +07:00
test_op_env.nim post-merge nrpc fix (#2685) 2024-10-03 11:42:24 +00:00
test_op_memory.nim Fix CodeBytes: invalidPositions out of bound crash (#2523) 2024-07-25 19:23:53 +07:00
test_op_misc.nim Fix styles and reduce compiler warnings (#2086) 2024-03-20 14:35:38 +07:00
test_persistblock_json.nim Consolidate block type for block processing (#2325) 2024-06-09 16:32:20 +02:00
test_precompiles.nim Bump nim-eth and nimbus-eth2 (#2741) 2024-10-16 13:51:38 +07:00
test_rpc.nim Bump nim-eth and nimbus-eth2 (#2741) 2024-10-16 13:51:38 +07:00
test_tools_build.nim Remove `hunter` (#2697) 2024-10-06 10:11:44 +00:00
test_tracer_json.nim replace deprecated types (#2704) 2024-10-16 08:34:12 +07:00
test_transaction_json.nim Unify tx validation (#2777) 2024-10-26 09:19:48 +02:00
test_txpool.nim Bump nim-eth and nimbus-eth2 (#2741) 2024-10-16 13:51:38 +07:00
test_txpool2.nim Fix leftover eth types changes warnings (#2766) 2024-10-22 13:42:16 +07:00
test_wire_protocol.nim Add check copyright year linter to CI 2023-11-01 10:41:20 +07:00
tracerTestGen.nim Remove EVM indirect imports and unused EVM errors (#2370) 2024-06-17 09:56:39 +02:00