Merge pull request #3878 from mkalinin/remove-compute_state_by_epoch_processing_to

Get rid of compute_state_by_epoch_processing_to
This commit is contained in:
Hsiao-Wei Wang 2024-08-28 14:38:11 +08:00 committed by GitHub
commit 7259a6cf23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 10 deletions

View File

@ -1,6 +1,6 @@
from eth2spec.test.helpers.epoch_processing import ( from eth2spec.test.helpers.epoch_processing import (
run_epoch_processing_with, run_epoch_processing_with,
compute_state_by_epoch_processing_to, run_epoch_processing_to,
) )
from eth2spec.test.context import ( from eth2spec.test.context import (
spec_state_test, spec_state_test,
@ -219,7 +219,8 @@ def test_pending_consolidation_future_epoch(spec, state):
next_epoch_with_full_participation(spec, state) next_epoch_with_full_participation(spec, state)
# Obtain state before the call to process_pending_consolidations # Obtain state before the call to process_pending_consolidations
state_before_consolidation = compute_state_by_epoch_processing_to(spec, state, "process_pending_consolidations") state_before_consolidation = state.copy()
run_epoch_processing_to(spec, state_before_consolidation, "process_pending_consolidations")
yield from run_epoch_processing_with(spec, state, "process_pending_consolidations") yield from run_epoch_processing_with(spec, state, "process_pending_consolidations")
@ -270,7 +271,8 @@ def test_pending_consolidation_compounding_creds(spec, state):
next_epoch_with_full_participation(spec, state) next_epoch_with_full_participation(spec, state)
# Obtain state before the call to process_pending_consolidations # Obtain state before the call to process_pending_consolidations
state_before_consolidation = compute_state_by_epoch_processing_to(spec, state, "process_pending_consolidations") state_before_consolidation = state.copy()
run_epoch_processing_to(spec, state_before_consolidation, "process_pending_consolidations")
yield from run_epoch_processing_with(spec, state, "process_pending_consolidations") yield from run_epoch_processing_with(spec, state, "process_pending_consolidations")
@ -325,7 +327,8 @@ def test_pending_consolidation_with_pending_deposit(spec, state):
next_epoch_with_full_participation(spec, state) next_epoch_with_full_participation(spec, state)
# Obtain state before the call to process_pending_balance_deposits # Obtain state before the call to process_pending_balance_deposits
state_before_consolidation = compute_state_by_epoch_processing_to(spec, state, "process_pending_balance_deposits") state_before_consolidation = state.copy()
run_epoch_processing_to(spec, state_before_consolidation, "process_pending_consolidations")
yield from run_epoch_processing_with(spec, state, "process_pending_consolidations") yield from run_epoch_processing_with(spec, state, "process_pending_consolidations")

View File

@ -74,9 +74,3 @@ def run_epoch_processing_with(spec, state, process_name: str):
yield 'pre', state yield 'pre', state
getattr(spec, process_name)(state) getattr(spec, process_name)(state)
yield 'post', state yield 'post', state
def compute_state_by_epoch_processing_to(spec, state, process_name: str):
state_copy = state.copy()
run_epoch_processing_to(spec, state_copy, process_name)
return state_copy