nimbus-eth2/tests
Jacek Sieka 40a4c01086
chaindag: don't keep backfill block table in memory (#3429)
This PR names and documents the concept of the archive: a range of slots
for which we have degraded functionality in terms of historical access -
in particular:

* we don't support rewinding to states in this range
* we don't keep an in-memory representation of the block dag

The archive de-facto exists in a trusted-node-synced node, but this PR
gives it a name and drops the in-memory digest index.

In order to satisfy `GetBlocksByRange` requests, we ensure that we have
blocks for the entire archive period via backfill. Future versions may
relax this further, adding a "pre-archive" period that is fully pruned.

During by-slot searches in the archive (both for libp2p and rest
requests), an extra database lookup is used to covert the given `slot`
to a `root` - future versions will avoid this using era files which
natively are indexed by `slot`. That said, the lookup is quite
fast compared to the actual block loading given how trivial the table
is - it's hard to measure, even.

A collateral benefit of this PR is that checkpoint-synced nodes will see
100-200MB memory usage savings, thanks to the dropped in-memory cache -
future pruning work will bring this benefit to full nodes as well.

* document chaindag storage architecture and assumptions
* look up parent using block id instead of full block in clearance
(future-proofing the code against a future in which blocks come from era
files)
* simplify finalized block init, always writing the backfill portion to
db at startup (to ensure lookups work as expected)
* preallocate some extra memory for finalized blocks, to avoid immediate
realloc
2022-02-26 19:16:19 +01:00
..
consensus_spec generic putCorruptState; {Merge=>Bellatrix}BeaconStateNoImmutableValidators (#3427) 2022-02-21 12:55:56 +01:00
fork_choice var => let in specs/ and tests/ (#3425) 2022-02-20 20:13:06 +00:00
fuzzing test fixture cleanups (#2976) 2021-10-12 13:36:52 +02:00
helpers Use nim-ssz-serialization module and rm local ssz code 2021-11-10 13:37:24 +02:00
mocking proc -> func, mainly in spec/state transition and adjecent modules (#3405) 2022-02-17 11:53:55 +00:00
simulation restapi.sh: cleanup on exit (#3328) 2022-01-27 13:03:38 +01:00
slashing_protection Slashing prot interchange tests v5.2.1 (#3277) 2022-01-20 17:14:06 +01:00
spec_block_processing var => let in specs/ and tests/ (#3425) 2022-02-20 20:13:06 +00:00
spec_epoch_processing var => let in specs/ and tests/ (#3425) 2022-02-20 20:13:06 +00:00
all_tests.nim Harden handling of unviable forks (#3312) 2022-01-26 13:20:08 +01:00
nim.cfg Revert writing backfill root to database (#3215) 2021-12-21 11:40:14 +01:00
test_action_tracker.nim Backfill support for ChainDAG (#3171) 2021-12-13 14:36:06 +01:00
test_attestation_pool.nim Ignore seen aggregates (#3439) 2022-02-25 17:15:39 +01:00
test_beacon_chain_db.nim generic putCorruptState; {Merge=>Bellatrix}BeaconStateNoImmutableValidators (#3427) 2022-02-21 12:55:56 +01:00
test_beacon_time.nim wss_sim: state transition simulator (#3309) 2022-01-22 10:25:30 +01:00
test_block_dag.nim time: spring cleaning (#3262) 2022-01-11 11:01:54 +01:00
test_block_processor.nim limit by-root requests to non-finalized blocks (#3293) 2022-01-21 13:33:16 +02:00
test_block_quarantine.nim proc -> func, mainly in spec/state transition and adjecent modules (#3405) 2022-02-17 11:53:55 +00:00
test_blockchain_dag.nim chaindag: don't keep backfill block table in memory (#3429) 2022-02-26 19:16:19 +01:00
test_datatypes.nim remove false OnBlockAdded dependency on phase0 HashedBeaconState (#2661) 2021-06-21 08:35:24 +00:00
test_discovery.nim Implementation of the Keymanager API (BETA) 2022-01-04 18:51:45 +02:00
test_eth1_monitor.nim Re-enable the HTTP support in Eth1Monitor 2022-01-16 18:26:21 +02:00
test_eth2_ssz_serialization.nim use isZeroMemory for Eth2Digest comparisons (#3386) 2022-02-14 05:26:19 +00:00
test_exit_pool.nim Validator monitoring (#2925) 2021-12-20 20:20:31 +01:00
test_forks.nim rename MERGE_FORK_EPOCH to BELLATRIX_FORK_EPOCH (#3350) 2022-02-02 14:06:55 +01:00
test_gossip_transition.nim rename Beacon{Block,State}Fork.Merge to Bellatrix; update copyright years (#3240) 2022-01-04 09:45:38 +00:00
test_gossip_validation.nim var => let in specs/ and tests/ (#3425) 2022-02-20 20:13:06 +00:00
test_helpers.nim move `state_transition` to `Result` (#3284) 2022-01-17 12:19:58 +01:00
test_honest_validator.nim dynamic sync committee subscriptions (#3308) 2022-01-24 20:40:59 +00:00
test_interop.nim ncli_db: add putState, putBlock (#3096) 2021-11-18 13:02:43 +01:00
test_keymanager_api.nim Remote KeyManager API and number of fixes/tests for KeyManager API (#3360) 2022-02-07 22:36:09 +02:00
test_keystore.nim var => let in specs/ and tests/ (#3425) 2022-02-20 20:13:06 +00:00
test_keystore_management.nim Remote KeyManager API and number of fixes/tests for KeyManager API (#3360) 2022-02-07 22:36:09 +02:00
test_message_signatures.nim batch-verify sync messages for a small perf boost (#3151) 2021-12-09 14:56:54 +02:00
test_peer_pool.nim proc -> func in ncli/, research/, and test/ (#2818) 2021-08-25 14:51:52 +00:00
test_spec.nim move `state_transition` to `Result` (#3284) 2022-01-17 12:19:58 +01:00
test_statediff.nim var => let in specs/ and tests/ (#3425) 2022-02-20 20:13:06 +00:00
test_sync_committee_pool.nim rename no{R=>r}eturn, no{I=>i}init, short{l=>L}og, E{T=>t}h2Node, Beacon{c=>C}hainDB (#3403) 2022-02-16 23:24:44 +01:00
test_sync_manager.nim harden and speed up block sync (#3358) 2022-02-07 19:20:10 +02:00
test_zero_signature.nim update spec references from eth2.0-specs to consensus-specs and to v1.1.0-beta.2 (#2822) 2021-08-26 10:21:52 +02:00
testblockutil.nim var => let in specs/ and tests/ (#3425) 2022-02-20 20:13:06 +00:00
testdbutil.nim Support starting from altair (#3054) 2021-11-10 13:39:08 +02:00
teststateutil.nim rename MERGE_FORK_EPOCH to BELLATRIX_FORK_EPOCH (#3350) 2022-02-02 14:06:55 +01:00
testutil.nim forkedbeaconstate_helpers -> forks (#2772) 2021-08-10 22:46:35 +02:00