From acc6d08e2122b2a9700c570c48d89feb0b613832 Mon Sep 17 00:00:00 2001 From: Mikhail Kalinin Date: Tue, 12 Mar 2024 02:41:29 +0600 Subject: [PATCH] Update EIP-6110: add pubkey2index cache analysis by @naviechan Merged by EIP-Bot. --- EIPS/eip-6110.md | 2 ++ .../pubkey_to_index_cache_analysis.md | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 assets/eip-6110/pubkey_to_index_cache_analysis.md diff --git a/EIPS/eip-6110.md b/EIPS/eip-6110.md index d4226f1ea4c81..767c8db360bf2 100644 --- a/EIPS/eip-6110.md +++ b/EIPS/eip-6110.md @@ -176,6 +176,8 @@ Detailed consensus layer specification can be found in following documents: Due to the large follow distance of `Eth1Data` poll an index of a new validator assigned during deposit processing remains the same across different branches of a block tree, i.e. with existing mechanism `(pubkey, index)` cache utilized by consensus layer clients is re-org resilient. The new deposit machinery breaks this invariant and consensus layer clients will have to deal with a fact that a validator index becomes fork dependent, i.e. a validator with the same `pubkey` can have different indexes in different block tree branches. +Detailed [analysis](../assets/eip-6110/pubkey_to_index_cache_analysis.md) shows that `process_deposit` function is *the only* place requiring a fork dependent `(pubkey, index)` cache. + #### `Eth1Data` poll deprecation Consensus layer clients will be able to remove `Eth1Data` poll mechanism in an uncoordinated fashion once transition period is finished. The transition period is considered as finished when a network reaches the point where `state.eth1_deposit_index == state.deposit_receipts_start_index`. diff --git a/assets/eip-6110/pubkey_to_index_cache_analysis.md b/assets/eip-6110/pubkey_to_index_cache_analysis.md new file mode 100644 index 0000000000000..9710c0e6d9c4e --- /dev/null +++ b/assets/eip-6110/pubkey_to_index_cache_analysis.md @@ -0,0 +1,26 @@ +Here is a copy of the tl;dr section from an [extended analysis](https://hackmd.io/@adrninistrator1/SkHmz972n) of `pubkey2index` and `index2pubkey` cache usage provided by Navie Chan: + +tl;dr: `index2Pubkey` is used in a lot more scenarios than `pubkey2Index`. The use cases for `index2Pubkey` do not require unfinalized information. `process_deposit()` is the only place in consensus spec that needs unfinalized information and it utilizes `pubkey2Index`. +In terms of the two-cache approach, `unfinalizedIndex2Pubkey` is not needed since there is not a place that utilizes it. `unfinalizedPubkey2Index`, however, is needed for `process_deposit()`. + +| | unfinalized pubkey2Index? | unfinalized index2Pubkey? | +|-|-|-| +| onBlock - state_transition - verify_block_signature | N/A | No | +| onBlock - state_transition - process_block - process_randao | N/A | No | +| onBlock - state_transition - process_block - process_operations - process_proposer_slashing | N/A | No | +| onBlock - state_transition - process_block - process_operations - process_attester_slashing - is_valid_indexed_attestation | N/A | No | +| onBlock - state_transition - process_block - process_operations - process_attestation - is_valid_indexed_attestation | N/A | No | +| onBlock - state_transition - process_block - process_operations - process_deposit - apply_deposit | Yes | N/A | +| onBlock - state_transition - process_block - process_operations - process_sync_aggregate - eth_fast_aggregate_verify | No | No | +| onBlock - state_transition - process_block - process_bls_to_execution_change | N/A | N/A | +| onBlock - state_transition - process_block - process_voluntary_exit | N/A | No | +| p2p - beacon_block ---- onBlock | N/A | No | +| p2p - beacon_aggregate_and_proof ---- onAttestation | N/A | No | +| p2p - voluntary_exit - process_voluntary_exit | N/A | No | +| p2p - proposer_slashing - process_proposer_slashing | N/A | No | +| p2p - attester_slashing - process_attester_slashing | N/A | No | +| p2p - beacon_attestation_{subnet_id} ---- onAttestation | N/A | No | +| p2p - sync_committee_contribution_and_proof | N/A | No | +| p2p - sync_committee_{subnet_id} | N/A | No | +| p2p - bls_to_execution_change - process_bls_to_execution_change | N/A | N/A | +| p2p - blob_sidecar_{subnet_id} - verify_blob_sidecar_signature | N/A | No |