From 79c78d0221d3dfd051feb5b663b56d67fce33ec2 Mon Sep 17 00:00:00 2001 From: dapplion <35266934+dapplion@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:01:51 +0900 Subject: [PATCH 1/3] Stricter bound for consolidation queue --- specs/_features/eip7251/beacon-chain.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/specs/_features/eip7251/beacon-chain.md b/specs/_features/eip7251/beacon-chain.md index ef61e3d3a9..9e085f3b0a 100644 --- a/specs/_features/eip7251/beacon-chain.md +++ b/specs/_features/eip7251/beacon-chain.md @@ -75,6 +75,7 @@ - [New `process_execution_layer_withdraw_request`](#new-process_execution_layer_withdraw_request) - [Consolidations](#consolidations) - [New `process_consolidation`](#new-process_consolidation) + - [New `is_consolidation_queue_full`](#new-is_consolidation_queue_full) - [Voluntary exits](#voluntary-exits) - [Updated `process_voluntary_exit`](#updated-process_voluntary_exit) - [Testing](#testing) @@ -996,7 +997,7 @@ def process_execution_layer_withdraw_request( ```python def process_consolidation(state: BeaconState, signed_consolidation: SignedConsolidation) -> None: # If the pending consolidations queue is full, no consolidations are allowed in the block - assert len(state.pending_consolidations) < PENDING_CONSOLIDATIONS_LIMIT + assert is_consolidation_queue_full(state) # If there is too little available consolidation churn limit, no consolidations are allowed in the block assert get_consolidation_churn_limit(state) > MIN_ACTIVATION_BALANCE consolidation = signed_consolidation.message @@ -1039,6 +1040,14 @@ def process_consolidation(state: BeaconState, signed_consolidation: SignedConsol )) ``` +###### New `is_consolidation_queue_full` + +```python +def is_consolidation_queue_full(state: BeaconState) -> bool: + return (state.earliest_consolidation_epoch < get_current_epoch(state) + + MIN_VALIDATOR_WITHDRAWABILITY_DELAY + 1 + MAX_SEED_LOOKAHEAD) +``` + ##### Voluntary exits ###### Updated `process_voluntary_exit` From 634f8463e4c0f6a1774b6a7692ab8ef865de9cf2 Mon Sep 17 00:00:00 2001 From: Lion - dapplion <35266934+dapplion@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:32:47 +0900 Subject: [PATCH 2/3] Update specs/_features/eip7251/beacon-chain.md Co-authored-by: Hsiao-Wei Wang --- specs/_features/eip7251/beacon-chain.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/_features/eip7251/beacon-chain.md b/specs/_features/eip7251/beacon-chain.md index 9e085f3b0a..837b3e9879 100644 --- a/specs/_features/eip7251/beacon-chain.md +++ b/specs/_features/eip7251/beacon-chain.md @@ -1044,8 +1044,8 @@ def process_consolidation(state: BeaconState, signed_consolidation: SignedConsol ```python def is_consolidation_queue_full(state: BeaconState) -> bool: - return (state.earliest_consolidation_epoch < get_current_epoch(state) + - MIN_VALIDATOR_WITHDRAWABILITY_DELAY + 1 + MAX_SEED_LOOKAHEAD) + epoch = get_current_epoch(state) + MIN_VALIDATOR_WITHDRAWABILITY_DELAY + 1 + MAX_SEED_LOOKAHEAD + return state.earliest_consolidation_epoch < epoch ``` ##### Voluntary exits From 6c0d80181f3cdc3ec84ae356ef5f0a84d7591790 Mon Sep 17 00:00:00 2001 From: Lion - dapplion <35266934+dapplion@users.noreply.github.com> Date: Tue, 16 Apr 2024 19:44:14 +0900 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: fradamt <104826920+fradamt@users.noreply.github.com> --- specs/_features/eip7251/beacon-chain.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/_features/eip7251/beacon-chain.md b/specs/_features/eip7251/beacon-chain.md index 837b3e9879..992951e706 100644 --- a/specs/_features/eip7251/beacon-chain.md +++ b/specs/_features/eip7251/beacon-chain.md @@ -997,7 +997,7 @@ def process_execution_layer_withdraw_request( ```python def process_consolidation(state: BeaconState, signed_consolidation: SignedConsolidation) -> None: # If the pending consolidations queue is full, no consolidations are allowed in the block - assert is_consolidation_queue_full(state) + assert not is_consolidation_queue_full(state) # If there is too little available consolidation churn limit, no consolidations are allowed in the block assert get_consolidation_churn_limit(state) > MIN_ACTIVATION_BALANCE consolidation = signed_consolidation.message @@ -1045,7 +1045,7 @@ def process_consolidation(state: BeaconState, signed_consolidation: SignedConsol ```python def is_consolidation_queue_full(state: BeaconState) -> bool: epoch = get_current_epoch(state) + MIN_VALIDATOR_WITHDRAWABILITY_DELAY + 1 + MAX_SEED_LOOKAHEAD - return state.earliest_consolidation_epoch < epoch + return state.earliest_consolidation_epoch > epoch ``` ##### Voluntary exits