forked from ethereum/consensus-specs
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for
process_historical_batches_update
- Loading branch information
Showing
11 changed files
with
163 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
27 changes: 27 additions & 0 deletions
27
...e/pyspec/eth2spec/test/capella/epoch_processing/test_process_historical_batches_update.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from eth2spec.test.context import ( | ||
CAPELLA, | ||
spec_state_test, | ||
with_phases, | ||
) | ||
from eth2spec.test.helpers.epoch_processing import ( | ||
run_epoch_processing_with | ||
) | ||
|
||
|
||
def run_process_historical_batches_update(spec, state): | ||
yield from run_epoch_processing_with(spec, state, 'process_historical_batches_update') | ||
|
||
|
||
@with_phases([CAPELLA]) | ||
@spec_state_test | ||
def test_historical_batches_accumulator(spec, state): | ||
# skip ahead to near the end of the historical batch period (excl block before epoch processing) | ||
state.slot = spec.SLOTS_PER_HISTORICAL_ROOT - 1 | ||
pre_historical_batches = state.historical_batches.copy() | ||
|
||
yield from run_process_historical_batches_update(spec, state) | ||
|
||
assert len(state.historical_batches) == len(pre_historical_batches) + 1 | ||
summary = state.historical_batches[len(state.historical_batches) - 1] | ||
assert summary.block_batch_root == state.block_roots.hash_tree_root() | ||
assert summary.state_batch_root == state.state_roots.hash_tree_root() |
Empty file.
23 changes: 23 additions & 0 deletions
23
...e/pyspec/eth2spec/test/eip4844/epoch_processing/test_process_historical_batches_update.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from eth2spec.test.context import ( | ||
spec_state_test, | ||
with_eip4844_and_later, | ||
) | ||
from eth2spec.test.helpers.epoch_processing import ( | ||
run_epoch_processing_with | ||
) | ||
|
||
|
||
def run_process_historical_batches_update(spec, state): | ||
yield from run_epoch_processing_with(spec, state, 'process_historical_batches_update') | ||
|
||
|
||
@with_eip4844_and_later | ||
@spec_state_test | ||
def test_no_op(spec, state): | ||
# skip ahead to near the end of the historical batch period (excl block before epoch processing) | ||
state.slot = spec.SLOTS_PER_HISTORICAL_ROOT - 1 | ||
historical_batches_len = len(state.historical_batches) | ||
|
||
yield from run_process_historical_batches_update(spec, state) | ||
|
||
assert len(state.historical_batches) == historical_batches_len |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters