consolidate consensus spec transition test fixtures (#4428)

* consolidate consensus spec transition test fixtures

* include capella

* consoliate fork test fixtures

* note change in EIP-4844 process_block in alpha.2
This commit is contained in:
tersec 2022-12-15 22:51:04 +00:00 committed by GitHub
parent bb4ea37baa
commit 110401394b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 346 additions and 612 deletions

View File

@ -2,6 +2,20 @@ ConsensusSpecPreset-mainnet
===
##
```diff
+ EF - Altair - Fork - altair_fork_random_0 [Preset: mainnet] OK
+ EF - Altair - Fork - altair_fork_random_1 [Preset: mainnet] OK
+ EF - Altair - Fork - altair_fork_random_2 [Preset: mainnet] OK
+ EF - Altair - Fork - altair_fork_random_3 [Preset: mainnet] OK
+ EF - Altair - Fork - altair_fork_random_duplicate_attestations [Preset: mainnet] OK
+ EF - Altair - Fork - altair_fork_random_low_balances [Preset: mainnet] OK
+ EF - Altair - Fork - altair_fork_random_misc_balances [Preset: mainnet] OK
+ EF - Altair - Fork - altair_fork_random_mismatched_attestations [Preset: mainnet] OK
+ EF - Altair - Fork - fork_base_state [Preset: mainnet] OK
+ EF - Altair - Fork - fork_many_next_epoch [Preset: mainnet] OK
+ EF - Altair - Fork - fork_next_epoch [Preset: mainnet] OK
+ EF - Altair - Fork - fork_next_epoch_with_block [Preset: mainnet] OK
+ EF - Altair - Fork - fork_random_low_balances [Preset: mainnet] OK
+ EF - Altair - Fork - fork_random_misc_balances [Preset: mainnet] OK
+ EF - Altair - Rewards - all_balances_too_low_for_reward [Preset: mainnet] OK
+ EF - Altair - Rewards - empty [Preset: mainnet] OK
+ EF - Altair - Rewards - empty_leak [Preset: mainnet] OK
@ -62,6 +76,18 @@ ConsensusSpecPreset-mainnet
+ EF - Altair - Transition - transition_with_proposer_slashing_right_before_fork [Preset: ma OK
+ EF - Altair - Transition - transition_with_random_half_participation [Preset: mainnet] OK
+ EF - Altair - Transition - transition_with_random_three_quarters_participation [Preset: ma OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_0 [Preset: mainnet] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_1 [Preset: mainnet] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_2 [Preset: mainnet] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_3 [Preset: mainnet] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_low_balances [Preset: mainnet] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_misc_balances [Preset: mainnet] OK
+ EF - Bellatrix - Fork - fork_base_state [Preset: mainnet] OK
+ EF - Bellatrix - Fork - fork_many_next_epoch [Preset: mainnet] OK
+ EF - Bellatrix - Fork - fork_next_epoch [Preset: mainnet] OK
+ EF - Bellatrix - Fork - fork_next_epoch_with_block [Preset: mainnet] OK
+ EF - Bellatrix - Fork - fork_random_low_balances [Preset: mainnet] OK
+ EF - Bellatrix - Fork - fork_random_misc_balances [Preset: mainnet] OK
+ EF - Bellatrix - Rewards - all_balances_too_low_for_reward [Preset: mainnet] OK
+ EF - Bellatrix - Rewards - empty [Preset: mainnet] OK
+ EF - Bellatrix - Rewards - empty_leak [Preset: mainnet] OK
@ -122,6 +148,18 @@ ConsensusSpecPreset-mainnet
+ EF - Bellatrix - Transition - transition_with_proposer_slashing_right_before_fork [Preset: OK
+ EF - Bellatrix - Transition - transition_with_random_half_participation [Preset: mainnet] OK
+ EF - Bellatrix - Transition - transition_with_random_three_quarters_participation [Preset: OK
+ EF - Capella - Fork - capella_fork_random_0 [Preset: mainnet] OK
+ EF - Capella - Fork - capella_fork_random_1 [Preset: mainnet] OK
+ EF - Capella - Fork - capella_fork_random_2 [Preset: mainnet] OK
+ EF - Capella - Fork - capella_fork_random_3 [Preset: mainnet] OK
+ EF - Capella - Fork - capella_fork_random_low_balances [Preset: mainnet] OK
+ EF - Capella - Fork - capella_fork_random_misc_balances [Preset: mainnet] OK
+ EF - Capella - Fork - fork_base_state [Preset: mainnet] OK
+ EF - Capella - Fork - fork_many_next_epoch [Preset: mainnet] OK
+ EF - Capella - Fork - fork_next_epoch [Preset: mainnet] OK
+ EF - Capella - Fork - fork_next_epoch_with_block [Preset: mainnet] OK
+ EF - Capella - Fork - fork_random_low_balances [Preset: mainnet] OK
+ EF - Capella - Fork - fork_random_misc_balances [Preset: mainnet] OK
+ EF - Capella - Rewards - all_balances_too_low_for_reward [Preset: mainnet] OK
+ EF - Capella - Rewards - empty [Preset: mainnet] OK
+ EF - Capella - Rewards - empty_leak [Preset: mainnet] OK
@ -182,6 +220,18 @@ ConsensusSpecPreset-mainnet
+ EF - Capella - Transition - transition_with_proposer_slashing_right_before_fork [Preset: m OK
+ EF - Capella - Transition - transition_with_random_half_participation [Preset: mainnet] OK
+ EF - Capella - Transition - transition_with_random_three_quarters_participation [Preset: m OK
+ EF - EIP4844 - Fork - eip4844_fork_random_0 [Preset: mainnet] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_1 [Preset: mainnet] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_2 [Preset: mainnet] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_3 [Preset: mainnet] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_low_balances [Preset: mainnet] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_misc_balances [Preset: mainnet] OK
+ EF - EIP4844 - Fork - fork_base_state [Preset: mainnet] OK
+ EF - EIP4844 - Fork - fork_many_next_epoch [Preset: mainnet] OK
+ EF - EIP4844 - Fork - fork_next_epoch [Preset: mainnet] OK
+ EF - EIP4844 - Fork - fork_next_epoch_with_block [Preset: mainnet] OK
+ EF - EIP4844 - Fork - fork_random_low_balances [Preset: mainnet] OK
+ EF - EIP4844 - Fork - fork_random_misc_balances [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - all_balances_too_low_for_reward [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - empty [Preset: mainnet] OK
+ EF - EIP4844 - Rewards - empty_leak [Preset: mainnet] OK
@ -748,40 +798,8 @@ ConsensusSpecPreset-mainnet
+ [Valid] EF - Phase 0 - Sanity - Blocks - skipped_slots [Preset: mainnet] OK
+ [Valid] EF - Phase 0 - Sanity - Blocks - slash_and_exit_diff_index [Preset: mainnet] OK
+ [Valid] EF - Phase 0 - Sanity - Blocks - voluntary_exit [Preset: mainnet] OK
+ altair_fork_random_0 OK
+ altair_fork_random_1 OK
+ altair_fork_random_2 OK
+ altair_fork_random_3 OK
+ altair_fork_random_duplicate_attestations OK
+ altair_fork_random_low_balances OK
+ altair_fork_random_misc_balances OK
+ altair_fork_random_mismatched_attestations OK
+ bellatrix_fork_random_0 OK
+ bellatrix_fork_random_1 OK
+ bellatrix_fork_random_2 OK
+ bellatrix_fork_random_3 OK
+ bellatrix_fork_random_low_balances OK
+ bellatrix_fork_random_misc_balances OK
+ capella_fork_random_0 OK
+ capella_fork_random_1 OK
+ capella_fork_random_2 OK
+ capella_fork_random_3 OK
+ capella_fork_random_low_balances OK
+ capella_fork_random_misc_balances OK
+ eip4844_fork_random_0 OK
+ eip4844_fork_random_1 OK
+ eip4844_fork_random_2 OK
+ eip4844_fork_random_3 OK
+ eip4844_fork_random_low_balances OK
+ eip4844_fork_random_misc_balances OK
+ fork_base_state OK
+ fork_many_next_epoch OK
+ fork_next_epoch OK
+ fork_next_epoch_with_block OK
+ fork_random_low_balances OK
+ fork_random_misc_balances OK
```
OK: 769/778 Fail: 0/778 Skip: 9/778
OK: 787/796 Fail: 0/796 Skip: 9/796
## Attestation
```diff
+ [Invalid] EF - Altair - Operations - Attestation - invalid_after_epoch_slots OK
@ -2474,4 +2492,4 @@ OK: 63/63 Fail: 0/63 Skip: 0/63
OK: 51/51 Fail: 0/51 Skip: 0/51
---TOTAL---
OK: 2179/2188 Fail: 0/2188 Skip: 9/2188
OK: 2197/2206 Fail: 0/2206 Skip: 9/2206

View File

@ -2,6 +2,22 @@ ConsensusSpecPreset-minimal
===
##
```diff
+ EF - Altair - Fork - altair_fork_random_0 [Preset: minimal] OK
+ EF - Altair - Fork - altair_fork_random_1 [Preset: minimal] OK
+ EF - Altair - Fork - altair_fork_random_2 [Preset: minimal] OK
+ EF - Altair - Fork - altair_fork_random_3 [Preset: minimal] OK
+ EF - Altair - Fork - altair_fork_random_duplicate_attestations [Preset: minimal] OK
+ EF - Altair - Fork - altair_fork_random_large_validator_set [Preset: minimal] OK
+ EF - Altair - Fork - altair_fork_random_low_balances [Preset: minimal] OK
+ EF - Altair - Fork - altair_fork_random_misc_balances [Preset: minimal] OK
+ EF - Altair - Fork - altair_fork_random_mismatched_attestations [Preset: minimal] OK
+ EF - Altair - Fork - fork_base_state [Preset: minimal] OK
+ EF - Altair - Fork - fork_many_next_epoch [Preset: minimal] OK
+ EF - Altair - Fork - fork_next_epoch [Preset: minimal] OK
+ EF - Altair - Fork - fork_next_epoch_with_block [Preset: minimal] OK
+ EF - Altair - Fork - fork_random_large_validator_set [Preset: minimal] OK
+ EF - Altair - Fork - fork_random_low_balances [Preset: minimal] OK
+ EF - Altair - Fork - fork_random_misc_balances [Preset: minimal] OK
+ EF - Altair - Rewards - all_balances_too_low_for_reward [Preset: minimal] OK
+ EF - Altair - Rewards - empty [Preset: minimal] OK
+ EF - Altair - Rewards - empty_leak [Preset: minimal] OK
@ -66,6 +82,20 @@ ConsensusSpecPreset-minimal
+ EF - Altair - Transition - transition_with_random_three_quarters_participation [Preset: mi OK
+ EF - Altair - Transition - transition_with_voluntary_exit_right_after_fork [Preset: minima OK
+ EF - Altair - Transition - transition_with_voluntary_exit_right_before_fork [Preset: minim OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_0 [Preset: minimal] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_1 [Preset: minimal] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_2 [Preset: minimal] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_3 [Preset: minimal] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_large_validator_set [Preset: minimal] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_low_balances [Preset: minimal] OK
+ EF - Bellatrix - Fork - bellatrix_fork_random_misc_balances [Preset: minimal] OK
+ EF - Bellatrix - Fork - fork_base_state [Preset: minimal] OK
+ EF - Bellatrix - Fork - fork_many_next_epoch [Preset: minimal] OK
+ EF - Bellatrix - Fork - fork_next_epoch [Preset: minimal] OK
+ EF - Bellatrix - Fork - fork_next_epoch_with_block [Preset: minimal] OK
+ EF - Bellatrix - Fork - fork_random_large_validator_set [Preset: minimal] OK
+ EF - Bellatrix - Fork - fork_random_low_balances [Preset: minimal] OK
+ EF - Bellatrix - Fork - fork_random_misc_balances [Preset: minimal] OK
+ EF - Bellatrix - Rewards - all_balances_too_low_for_reward [Preset: minimal] OK
+ EF - Bellatrix - Rewards - empty [Preset: minimal] OK
+ EF - Bellatrix - Rewards - empty_leak [Preset: minimal] OK
@ -130,6 +160,20 @@ ConsensusSpecPreset-minimal
+ EF - Bellatrix - Transition - transition_with_random_three_quarters_participation [Preset: OK
+ EF - Bellatrix - Transition - transition_with_voluntary_exit_right_after_fork [Preset: min OK
+ EF - Bellatrix - Transition - transition_with_voluntary_exit_right_before_fork [Preset: mi OK
+ EF - Capella - Fork - capella_fork_random_0 [Preset: minimal] OK
+ EF - Capella - Fork - capella_fork_random_1 [Preset: minimal] OK
+ EF - Capella - Fork - capella_fork_random_2 [Preset: minimal] OK
+ EF - Capella - Fork - capella_fork_random_3 [Preset: minimal] OK
+ EF - Capella - Fork - capella_fork_random_large_validator_set [Preset: minimal] OK
+ EF - Capella - Fork - capella_fork_random_low_balances [Preset: minimal] OK
+ EF - Capella - Fork - capella_fork_random_misc_balances [Preset: minimal] OK
+ EF - Capella - Fork - fork_base_state [Preset: minimal] OK
+ EF - Capella - Fork - fork_many_next_epoch [Preset: minimal] OK
+ EF - Capella - Fork - fork_next_epoch [Preset: minimal] OK
+ EF - Capella - Fork - fork_next_epoch_with_block [Preset: minimal] OK
+ EF - Capella - Fork - fork_random_large_validator_set [Preset: minimal] OK
+ EF - Capella - Fork - fork_random_low_balances [Preset: minimal] OK
+ EF - Capella - Fork - fork_random_misc_balances [Preset: minimal] OK
+ EF - Capella - Rewards - all_balances_too_low_for_reward [Preset: minimal] OK
+ EF - Capella - Rewards - empty [Preset: minimal] OK
+ EF - Capella - Rewards - empty_leak [Preset: minimal] OK
@ -194,6 +238,20 @@ ConsensusSpecPreset-minimal
+ EF - Capella - Transition - transition_with_random_three_quarters_participation [Preset: m OK
+ EF - Capella - Transition - transition_with_voluntary_exit_right_after_fork [Preset: minim OK
+ EF - Capella - Transition - transition_with_voluntary_exit_right_before_fork [Preset: mini OK
+ EF - EIP4844 - Fork - eip4844_fork_random_0 [Preset: minimal] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_1 [Preset: minimal] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_2 [Preset: minimal] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_3 [Preset: minimal] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_large_validator_set [Preset: minimal] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_low_balances [Preset: minimal] OK
+ EF - EIP4844 - Fork - eip4844_fork_random_misc_balances [Preset: minimal] OK
+ EF - EIP4844 - Fork - fork_base_state [Preset: minimal] OK
+ EF - EIP4844 - Fork - fork_many_next_epoch [Preset: minimal] OK
+ EF - EIP4844 - Fork - fork_next_epoch [Preset: minimal] OK
+ EF - EIP4844 - Fork - fork_next_epoch_with_block [Preset: minimal] OK
+ EF - EIP4844 - Fork - fork_random_large_validator_set [Preset: minimal] OK
+ EF - EIP4844 - Fork - fork_random_low_balances [Preset: minimal] OK
+ EF - EIP4844 - Fork - fork_random_misc_balances [Preset: minimal] OK
+ EF - EIP4844 - Rewards - all_balances_too_low_for_reward [Preset: minimal] OK
+ EF - EIP4844 - Rewards - empty [Preset: minimal] OK
+ EF - EIP4844 - Rewards - empty_leak [Preset: minimal] OK
@ -845,45 +903,8 @@ ConsensusSpecPreset-minimal
+ [Valid] EF - Phase 0 - Sanity - Blocks - skipped_slots [Preset: minimal] OK
+ [Valid] EF - Phase 0 - Sanity - Blocks - slash_and_exit_diff_index [Preset: minimal] OK
+ [Valid] EF - Phase 0 - Sanity - Blocks - voluntary_exit [Preset: minimal] OK
+ altair_fork_random_0 OK
+ altair_fork_random_1 OK
+ altair_fork_random_2 OK
+ altair_fork_random_3 OK
+ altair_fork_random_duplicate_attestations OK
+ altair_fork_random_large_validator_set OK
+ altair_fork_random_low_balances OK
+ altair_fork_random_misc_balances OK
+ altair_fork_random_mismatched_attestations OK
+ bellatrix_fork_random_0 OK
+ bellatrix_fork_random_1 OK
+ bellatrix_fork_random_2 OK
+ bellatrix_fork_random_3 OK
+ bellatrix_fork_random_large_validator_set OK
+ bellatrix_fork_random_low_balances OK
+ bellatrix_fork_random_misc_balances OK
+ capella_fork_random_0 OK
+ capella_fork_random_1 OK
+ capella_fork_random_2 OK
+ capella_fork_random_3 OK
+ capella_fork_random_large_validator_set OK
+ capella_fork_random_low_balances OK
+ capella_fork_random_misc_balances OK
+ eip4844_fork_random_0 OK
+ eip4844_fork_random_1 OK
+ eip4844_fork_random_2 OK
+ eip4844_fork_random_3 OK
+ eip4844_fork_random_large_validator_set OK
+ eip4844_fork_random_low_balances OK
+ eip4844_fork_random_misc_balances OK
+ fork_base_state OK
+ fork_many_next_epoch OK
+ fork_next_epoch OK
+ fork_next_epoch_with_block OK
+ fork_random_large_validator_set OK
+ fork_random_low_balances OK
+ fork_random_misc_balances OK
```
OK: 871/880 Fail: 0/880 Skip: 9/880
OK: 892/901 Fail: 0/901 Skip: 9/901
## Attestation
```diff
+ [Invalid] EF - Altair - Operations - Attestation - invalid_after_epoch_slots OK
@ -2638,4 +2659,4 @@ OK: 68/68 Fail: 0/68 Skip: 0/68
OK: 52/52 Fail: 0/52 Skip: 0/52
---TOTAL---
OK: 2327/2336 Fail: 0/2336 Skip: 9/2336
OK: 2348/2357 Fail: 0/2357 Skip: 9/2357

View File

@ -988,7 +988,7 @@ proc process_block*(
ok()
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.1/specs/eip4844/beacon-chain.md#block-processing
# https://github.com/ethereum/consensus-specs/blob/v1.3.0-alpha.2/specs/eip4844/beacon-chain.md#block-processing
# TODO workaround for https://github.com/nim-lang/Nim/issues/18095
type SomeEIP4844Block =
eip4844.BeaconBlock | eip4844.SigVerifiedBeaconBlock | eip4844.TrustedBeaconBlock
@ -1020,8 +1020,7 @@ proc process_block*(
? process_blob_kzg_commitments(state, blck.body) # [New in EIP-4844]
# New in EIP-4844, note: Can sync optimistically without this condition, see
# note on `is_data_available`
# New in EIP-4844
if not is_data_available(
blck.slot, hash_tree_root(blck), blck.body.blob_kzg_commitments.asSeq):
return err("not is_data_available")

View File

@ -8,9 +8,7 @@
{.used.}
import
./test_fixture_fork,
./test_fixture_light_client_sync_protocol,
./test_fixture_operations,
./test_fixture_ssz_consensus_objects,
./test_fixture_state_transition_epoch,
./test_fixture_transition
./test_fixture_state_transition_epoch

View File

@ -1,45 +0,0 @@
# beacon_chain
# Copyright (c) 2021 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
import
# Beacon chain internals
../../../beacon_chain/spec/[beaconstate, helpers],
../../../beacon_chain/spec/datatypes/[phase0, altair],
# Test utilities
../../testutil,
../fixtures_utils,
../../helpers/debug_state
from std/os import walkDir, `/`
const OpForkDir = SszTestsDir/const_preset/"altair"/"fork"/"fork"/"pyspec_tests"
proc runTest(identifier: string) =
let testDir = OpForkDir / identifier
proc `testImpl _ fork _ identifier`() =
test identifier:
let
preState = newClone(
parseTest(testDir/"pre.ssz_snappy", SSZ, phase0.BeaconState))
postState = newClone(
parseTest(testDir/"post.ssz_snappy", SSZ, altair.BeaconState))
var cfg = defaultRuntimeConfig
cfg.ALTAIR_FORK_EPOCH = preState[].slot.epoch
let upgradedState = upgrade_to_altair(cfg, preState[])
check: upgradedState[].hash_tree_root() == postState[].hash_tree_root()
reportDiff(upgradedState, postState)
`testImpl _ fork _ identifier`()
suite "Ethereum Foundation - Altair - Fork " & preset():
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(path)

View File

@ -1,82 +0,0 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
import
chronicles,
yaml,
# Standard library
os, sequtils,
# Status internal
faststreams, streams,
# Beacon chain internals
../../../beacon_chain/spec/[state_transition, forks, helpers],
../../../beacon_chain/spec/datatypes/[phase0, altair],
# Test utilities
../../testutil,
../fixtures_utils
const
TransitionDir = SszTestsDir/const_preset/"altair"/"transition"/"core"/"pyspec_tests"
type
TransitionInfo = object
post_fork: string
fork_epoch: int
blocks_count: int
fork_block {.defaultVal: -1.}: int
bls_setting {.defaultVal: 1.}: int
proc runTest(testName, testDir, unitTestName: string) =
let testPath = testDir / unitTestName
var transitionInfo: TransitionInfo
let s = openFileStream(testPath/"meta.yaml")
defer: close(s)
yaml.load(s, transitionInfo)
proc `testImpl _ blck _ testName`() =
test testName & " - " & unitTestName & preset():
var
preState = newClone(parseTest(testPath/"pre.ssz_snappy", SSZ, phase0.BeaconState))
fhPreState = (ref ForkedHashedBeaconState)(phase0Data: phase0.HashedBeaconState(
data: preState[], root: hash_tree_root(preState[])), kind: BeaconStateFork.Phase0)
cache = StateCache()
info = ForkedEpochInfo()
cfg = defaultRuntimeConfig
cfg.ALTAIR_FORK_EPOCH = transitionInfo.fork_epoch.Epoch
# In test cases with more than 10 blocks the first 10 aren't 0-prefixed,
# so purely lexicographic sorting wouldn't sort properly.
let numBlocks = toSeq(walkPattern(testPath/"blocks_*.ssz_snappy")).len
for i in 0 ..< numBlocks:
if i <= transitionInfo.fork_block:
let blck = parseTest(testPath/"blocks_" & $i & ".ssz_snappy", SSZ, phase0.SignedBeaconBlock)
let res = state_transition(
cfg, fhPreState[], blck, cache, info,
flags = {skipStateRootValidation}, noRollback)
res.expect("no failure when applying block " & $i)
else:
let blck = parseTest(testPath/"blocks_" & $i & ".ssz_snappy", SSZ, altair.SignedBeaconBlock)
let res = state_transition(
cfg, fhPreState[], blck, cache, info,
flags = {skipStateRootValidation}, noRollback)
res.expect("no failure when applying block " & $i)
let postState = newClone(parseTest(testPath/"post.ssz_snappy", SSZ, altair.BeaconState))
when false:
reportDiff(fhPreState.data, postState)
doAssert getStateRoot(fhPreState[]) == postState[].hash_tree_root()
`testImpl _ blck _ testName`()
suite "EF - Altair - Transition " & preset():
for kind, path in walkDir(TransitionDir, relative = true, checkDir = true):
runTest("EF - Altair - Transition", TransitionDir, path)

View File

@ -8,8 +8,6 @@
{.used.}
import
./test_fixture_fork,
./test_fixture_operations,
./test_fixture_ssz_consensus_objects,
./test_fixture_state_transition_epoch,
./test_fixture_transition
./test_fixture_state_transition_epoch

View File

@ -1,44 +0,0 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
import
# Beacon chain internals
../../../beacon_chain/spec/[beaconstate, helpers],
../../../beacon_chain/spec/datatypes/[altair, bellatrix],
# Test utilities
../../testutil,
../fixtures_utils,
../../helpers/debug_state
from std/os import walkDir, `/`
const OpForkDir = SszTestsDir/const_preset/"bellatrix"/"fork"/"fork"/"pyspec_tests"
proc runTest(identifier: string) =
let testDir = OpForkDir / identifier
proc `testImpl _ fork _ identifier`() =
test identifier:
let
preState = newClone(
parseTest(testDir/"pre.ssz_snappy", SSZ, altair.BeaconState))
postState = newClone(
parseTest(testDir/"post.ssz_snappy", SSZ, bellatrix.BeaconState))
let cfg = defaultRuntimeConfig
let upgradedState = upgrade_to_bellatrix(cfg, preState[])
check: upgradedState[].hash_tree_root() == postState[].hash_tree_root()
reportDiff(upgradedState, postState)
`testImpl _ fork _ identifier`()
suite "EF - Bellatrix - Fork " & preset():
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(path)

View File

@ -1,87 +0,0 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
import
chronicles,
yaml,
# Standard library
std/[os, sequtils, strutils],
# Status internal
faststreams, streams,
# Beacon chain internals
../../../beacon_chain/spec/[state_transition, forks, helpers],
../../../beacon_chain/spec/datatypes/[altair, bellatrix],
# Test utilities
../../testutil,
../fixtures_utils
const
TransitionDir = SszTestsDir/const_preset/"bellatrix"/"transition"/"core"/"pyspec_tests"
type
TransitionInfo = object
post_fork: string
fork_epoch: int
blocks_count: int
fork_block {.defaultVal: -1.}: int
bls_setting {.defaultVal: 1.}: int
proc runTest(testName, testDir, unitTestName: string) =
let testPath = testDir / unitTestName
var transitionInfo: TransitionInfo
let s = openFileStream(testPath/"meta.yaml")
defer: close(s)
yaml.load(s, transitionInfo)
proc `testImpl _ blck _ testName`() =
test testName & " - " & unitTestName & preset():
var
preState = newClone(parseTest(testPath/"pre.ssz_snappy", SSZ, altair.BeaconState))
fhPreState = (ref ForkedHashedBeaconState)(altairData: altair.HashedBeaconState(
data: preState[], root: hash_tree_root(preState[])), kind: BeaconStateFork.Altair)
cache = StateCache()
info = ForkedEpochInfo()
cfg = defaultRuntimeConfig
cfg.BELLATRIX_FORK_EPOCH = transitionInfo.fork_epoch.Epoch
# In test cases with more than 10 blocks the first 10 aren't 0-prefixed,
# so purely lexicographic sorting wouldn't sort properly.
let numBlocks = toSeq(walkPattern(testPath/"blocks_*.ssz_snappy")).len
for i in 0 ..< numBlocks:
if i <= transitionInfo.fork_block:
let blck = parseTest(
testPath/"blocks_" & $i & ".ssz_snappy", SSZ,
altair.SignedBeaconBlock)
let res = state_transition(
cfg, fhPreState[], blck, cache, info,
flags = {skipStateRootValidation}, noRollback)
res.expect("no failure when applying block " & $i)
else:
let blck = parseTest(
testPath/"blocks_" & $i & ".ssz_snappy", SSZ,
bellatrix.SignedBeaconBlock)
let res = state_transition(
cfg, fhPreState[], blck, cache, info,
flags = {skipStateRootValidation}, noRollback)
res.expect("no failure when applying block " & $i)
let postState = newClone(parseTest(
testPath/"post.ssz_snappy", SSZ, bellatrix.BeaconState))
when false:
reportDiff(fhPreState.data, postState)
doAssert getStateRoot(fhPreState[]) == postState[].hash_tree_root()
`testImpl _ blck _ testName`()
suite "EF - Bellatrix - Transition " & preset():
for kind, path in walkDir(TransitionDir, relative = true, checkDir = true):
runTest("EF - Bellatrix - Transition", TransitionDir, path)

View File

@ -8,8 +8,6 @@
{.used.}
import
./test_fixture_fork,
./test_fixture_operations,
./test_fixture_ssz_consensus_objects,
./test_fixture_state_transition_epoch,
./test_fixture_transition
./test_fixture_state_transition_epoch

View File

@ -1,44 +0,0 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
import
# Standard library
os,
# Beacon chain internals
../../../beacon_chain/spec/[beaconstate, helpers],
../../../beacon_chain/spec/datatypes/[bellatrix, capella],
# Test utilities
../../testutil,
../fixtures_utils,
../../helpers/debug_state
const OpForkDir = SszTestsDir/const_preset/"capella"/"fork"/"fork"/"pyspec_tests"
proc runTest(identifier: string) =
let testDir = OpForkDir / identifier
proc `testImpl _ fork _ identifier`() =
test identifier:
let
preState = newClone(
parseTest(testDir/"pre.ssz_snappy", SSZ, bellatrix.BeaconState))
postState = newClone(
parseTest(testDir/"post.ssz_snappy", SSZ, capella.BeaconState))
let cfg = defaultRuntimeConfig
let upgradedState = upgrade_to_capella(cfg, preState[])
check: upgradedState[].hash_tree_root() == postState[].hash_tree_root()
reportDiff(upgradedState, postState)
`testImpl _ fork _ identifier`()
suite "EF - Capella - Fork " & preset():
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(path)

View File

@ -1,88 +0,0 @@
# beacon_chain
# Copyright (c) 2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
import
chronicles,
yaml,
# Status internal
faststreams, streams,
# Beacon chain internals
../../../beacon_chain/spec/[state_transition, forks, helpers],
../../../beacon_chain/spec/datatypes/[bellatrix, capella],
# Test utilities
../../testutil,
../fixtures_utils
from std/os import walkDir, walkPattern, `/`
from std/sequtils import toSeq
const
TransitionDir = SszTestsDir/const_preset/"capella"/"transition"/"core"/"pyspec_tests"
type
TransitionInfo = object
post_fork: string
fork_epoch: int
blocks_count: int
fork_block {.defaultVal: -1.}: int
bls_setting {.defaultVal: 1.}: int
proc runTest(testName, testDir, unitTestName: string) =
let testPath = testDir / unitTestName
var transitionInfo: TransitionInfo
let s = openFileStream(testPath/"meta.yaml")
defer: close(s)
yaml.load(s, transitionInfo)
proc `testImpl _ blck _ testName`() =
test testName & " - " & unitTestName & preset():
var
preState = newClone(parseTest(testPath/"pre.ssz_snappy", SSZ, bellatrix.BeaconState))
fhPreState = (ref ForkedHashedBeaconState)(bellatrixData: bellatrix.HashedBeaconState(
data: preState[], root: hash_tree_root(preState[])), kind: BeaconStateFork.Bellatrix)
cache = StateCache()
info = ForkedEpochInfo()
cfg = defaultRuntimeConfig
cfg.CAPELLA_FORK_EPOCH = transitionInfo.fork_epoch.Epoch
# In test cases with more than 10 blocks the first 10 aren't 0-prefixed,
# so purely lexicographic sorting wouldn't sort properly.
let numBlocks = toSeq(walkPattern(testPath/"blocks_*.ssz_snappy")).len
for i in 0 ..< numBlocks:
if i <= transitionInfo.fork_block:
let blck = parseTest(
testPath/"blocks_" & $i & ".ssz_snappy", SSZ,
bellatrix.SignedBeaconBlock)
let res = state_transition(
cfg, fhPreState[], blck, cache, info,
flags = {skipStateRootValidation}, noRollback)
res.expect("no failure when applying block " & $i)
else:
let blck = parseTest(
testPath/"blocks_" & $i & ".ssz_snappy", SSZ,
capella.SignedBeaconBlock)
let res = state_transition(
cfg, fhPreState[], blck, cache, info,
flags = {skipStateRootValidation}, noRollback)
res.expect("no failure when applying block " & $i)
let postState = newClone(parseTest(
testPath/"post.ssz_snappy", SSZ, capella.BeaconState))
when false:
reportDiff(fhPreState.data, postState)
doAssert getStateRoot(fhPreState[]) == postState[].hash_tree_root()
`testImpl _ blck _ testName`()
suite "EF - Capella - Transition " & preset():
for kind, path in walkDir(TransitionDir, relative = true, checkDir = true):
runTest("EF - Capella - Transition", TransitionDir, path)

View File

@ -5,8 +5,7 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import
../testutil
import ../testutil
# Tests that depend on `mainnet` vs `minimal` compile-time configuration
@ -16,11 +15,13 @@ import
./bellatrix/all_bellatrix_fixtures,
./capella/all_capella_fixtures,
./eip4844/all_eip4844_fixtures,
./test_fixture_fork,
./test_fixture_fork_choice,
./test_fixture_light_client_single_merkle_proof,
./test_fixture_light_client_sync,
./test_fixture_light_client_update_ranking,
./test_fixture_sanity_blocks,
./test_fixture_sanity_slots
./test_fixture_sanity_slots,
./test_fixture_transition
summarizeLongTests("ConsensusSpecPreset")

View File

@ -8,8 +8,6 @@
{.used.}
import
./test_fixture_fork,
./test_fixture_operations,
./test_fixture_ssz_consensus_objects,
./test_fixture_state_transition_epoch,
./test_fixture_transition
./test_fixture_state_transition_epoch

View File

@ -1,44 +0,0 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
import
# Standard library
os,
# Beacon chain internals
../../../beacon_chain/spec/[beaconstate, helpers],
../../../beacon_chain/spec/datatypes/[capella, eip4844],
# Test utilities
../../testutil,
../fixtures_utils,
../../helpers/debug_state
const OpForkDir = SszTestsDir/const_preset/"eip4844"/"fork"/"fork"/"pyspec_tests"
proc runTest(identifier: string) =
let testDir = OpForkDir / identifier
proc `testImpl _ fork _ identifier`() =
test identifier:
let
preState = newClone(
parseTest(testDir/"pre.ssz_snappy", SSZ, capella.BeaconState))
postState = newClone(
parseTest(testDir/"post.ssz_snappy", SSZ, eip4844.BeaconState))
let cfg = defaultRuntimeConfig
let upgradedState = upgrade_to_eip4844(cfg, preState[])
check: upgradedState[].hash_tree_root() == postState[].hash_tree_root()
reportDiff(upgradedState, postState)
`testImpl _ fork _ identifier`()
suite "EF - EIP4844 - Fork " & preset():
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(path)

View File

@ -1,87 +0,0 @@
# beacon_chain
# Copyright (c) 2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
import
chronicles,
yaml,
# Standard library
std/[os, sequtils, strutils],
# Status internal
faststreams, streams,
# Beacon chain internals
../../../beacon_chain/spec/[state_transition, forks, helpers],
../../../beacon_chain/spec/datatypes/[capella, eip4844],
# Test utilities
../../testutil,
../fixtures_utils
const
TransitionDir = SszTestsDir/const_preset/"eip4844"/"transition"/"core"/"pyspec_tests"
type
TransitionInfo = object
post_fork: string
fork_epoch: int
blocks_count: int
fork_block {.defaultVal: -1.}: int
bls_setting {.defaultVal: 1.}: int
proc runTest(testName, testDir, unitTestName: string) =
let testPath = testDir / unitTestName
var transitionInfo: TransitionInfo
let s = openFileStream(testPath/"meta.yaml")
defer: close(s)
yaml.load(s, transitionInfo)
proc `testImpl _ blck _ testName`() =
test testName & " - " & unitTestName & preset():
var
preState = newClone(parseTest(testPath/"pre.ssz_snappy", SSZ, capella.BeaconState))
fhPreState = (ref ForkedHashedBeaconState)(capellaData: capella.HashedBeaconState(
data: preState[], root: hash_tree_root(preState[])), kind: BeaconStateFork.Capella)
cache = StateCache()
info = ForkedEpochInfo()
cfg = defaultRuntimeConfig
cfg.EIP4844_FORK_EPOCH = transitionInfo.fork_epoch.Epoch
# In test cases with more than 10 blocks the first 10 aren't 0-prefixed,
# so purely lexicographic sorting wouldn't sort properly.
let numBlocks = toSeq(walkPattern(testPath/"blocks_*.ssz_snappy")).len
for i in 0 ..< numBlocks:
if i <= transitionInfo.fork_block:
let blck = parseTest(
testPath/"blocks_" & $i & ".ssz_snappy", SSZ,
capella.SignedBeaconBlock)
let res = state_transition(
cfg, fhPreState[], blck, cache, info,
flags = {skipStateRootValidation}, noRollback)
res.expect("no failure when applying block " & $i)
else:
let blck = parseTest(
testPath/"blocks_" & $i & ".ssz_snappy", SSZ,
eip4844.SignedBeaconBlock)
let res = state_transition(
cfg, fhPreState[], blck, cache, info,
flags = {skipStateRootValidation}, noRollback)
res.expect("no failure when applying block " & $i)
let postState = newClone(parseTest(
testPath/"post.ssz_snappy", SSZ, eip4844.BeaconState))
when false:
reportDiff(fhPreState.data, postState)
doAssert getStateRoot(fhPreState[]) == postState[].hash_tree_root()
`testImpl _ blck _ testName`()
suite "EF - EIP4844 - Transition " & preset():
for kind, path in walkDir(TransitionDir, relative = true, checkDir = true):
runTest("EF - EIP4844 - Transition", TransitionDir, path)

View File

@ -0,0 +1,78 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
import
# Beacon chain internals
../../beacon_chain/spec/beaconstate,
../../beacon_chain/spec/datatypes/phase0,
# Test utilities
../testutil,
./fixtures_utils,
../helpers/debug_state
from std/os import walkDir, `/`
proc runTest(
BeaconStateAnte, BeaconStatePost: type, forkNameName, forkDir: static[string],
upgrade_func: auto, unitTestName: string) =
let testDir = forkDir / unitTestName
proc `testImpl _ fork _ unitTestName`() =
test "EF - " & forkNameName & " - Fork - " & unitTestName & preset():
let
preState = newClone(
parseTest(testDir/"pre.ssz_snappy", SSZ, BeaconStateAnte))
postState = newClone(
parseTest(testDir/"post.ssz_snappy", SSZ, BeaconStatePost))
var cfg = defaultRuntimeConfig
when BeaconStateAnte is phase0.BeaconState:
cfg.ALTAIR_FORK_EPOCH = preState[].slot.epoch
let upgradedState = upgrade_func(cfg, preState[])
check: upgradedState[].hash_tree_root() == postState[].hash_tree_root()
reportDiff(upgradedState, postState)
`testImpl _ fork _ unitTestName`()
from ../../beacon_chain/spec/datatypes/altair import BeaconState
suite "Ethereum Foundation - Altair - Fork " & preset():
const OpForkDir =
SszTestsDir/const_preset/"altair"/"fork"/"fork"/"pyspec_tests"
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(phase0.BeaconState, altair.BeaconState, "Altair", OpForkDir,
upgrade_to_altair, path)
from ../../beacon_chain/spec/datatypes/bellatrix import BeaconState
suite "Ethereum Foundation - Bellatrix - Fork " & preset():
const OpForkDir =
SszTestsDir/const_preset/"bellatrix"/"fork"/"fork"/"pyspec_tests"
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(altair.BeaconState, bellatrix.BeaconState, "Bellatrix", OpForkDir,
upgrade_to_bellatrix, path)
from ../../beacon_chain/spec/datatypes/capella import BeaconState
suite "Ethereum Foundation - Capella - Fork " & preset():
const OpForkDir =
SszTestsDir/const_preset/"capella"/"fork"/"fork"/"pyspec_tests"
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(bellatrix.BeaconState, capella.BeaconState, "Capella", OpForkDir,
upgrade_to_capella, path)
from ../../beacon_chain/spec/datatypes/eip4844 import BeaconState
suite "Ethereum Foundation - EIP4844 - Fork " & preset():
const OpForkDir =
SszTestsDir/const_preset/"eip4844"/"fork"/"fork"/"pyspec_tests"
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(capella.BeaconState, eip4844.BeaconState, "EIP4844", OpForkDir,
upgrade_to_eip4844, path)

View File

@ -8,6 +8,7 @@
{.used.}
import
chronicles,
../../beacon_chain/spec/datatypes/phase0,
../../beacon_chain/spec/state_transition,
../testutil

View File

@ -0,0 +1,145 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
{.used.}
import
yaml,
../../beacon_chain/spec/[state_transition, forks]
from std/os import walkDir, walkPattern, `/`
from std/sequtils import toSeq
from streams import close, openFileStream
from ../testutil import preset, suite, test
from ./fixtures_utils import SszTestsDir, parseTest
type
TransitionInfo = object
post_fork: string
fork_epoch: int
blocks_count: int
fork_block {.defaultVal: -1.}: int
bls_setting {.defaultVal: 1.}: int
proc getTransitionInfo(testPath: string): TransitionInfo =
var transitionInfo: TransitionInfo
let s = openFileStream(testPath/"meta.yaml")
defer: close(s)
yaml.load(s, transitionInfo)
transitionInfo
proc runTest(
AnteBeaconState, PostBeaconState, AnteBeaconBlock, PostBeaconBlock: type,
cfg: RuntimeConfig, testName, testDir: static[string],
unitTestName: string, fork_block: int) =
let testPath = testDir / unitTestName
proc `testImpl _ blck _ testName`() =
test testName & " - " & unitTestName & preset():
let preState =
newClone(parseTest(testPath/"pre.ssz_snappy", SSZ, AnteBeaconState))
var
fhPreState = ForkedHashedBeaconState.new(preState[])
cache = StateCache()
info = ForkedEpochInfo()
# In test cases with more than 10 blocks the first 10 aren't 0-prefixed,
# so purely lexicographic sorting wouldn't sort properly.
let numBlocks = toSeq(walkPattern(testPath/"blocks_*.ssz_snappy")).len
for i in 0 ..< numBlocks:
if i <= fork_block:
let
blck = parseTest(
testPath/"blocks_" & $i & ".ssz_snappy", SSZ, AnteBeaconBlock)
res = state_transition(
cfg, fhPreState[], blck, cache, info,
flags = {skipStateRootValidation}, noRollback)
res.expect("no failure when applying block " & $i)
else:
let
blck = parseTest(
testPath/"blocks_" & $i & ".ssz_snappy", SSZ, PostBeaconBlock)
res = state_transition(
cfg, fhPreState[], blck, cache, info,
flags = {skipStateRootValidation}, noRollback)
res.expect("no failure when applying block " & $i)
let postState = newClone(
parseTest(testPath/"post.ssz_snappy", SSZ, PostBeaconState))
when false:
reportDiff(fhPreState.data, postState)
doAssert getStateRoot(fhPreState[]) == postState[].hash_tree_root()
`testImpl _ blck _ testName`()
from ../../beacon_chain/spec/datatypes/phase0 import
BeaconState, SignedBeaconBlock
from ../../beacon_chain/spec/datatypes/altair import
BeaconState, SignedBeaconBlock
suite "EF - Altair - Transition " & preset():
const TransitionDir =
SszTestsDir/const_preset/"altair"/"transition"/"core"/"pyspec_tests"
for kind, path in walkDir(TransitionDir, relative = true, checkDir = true):
let transitionInfo = getTransitionInfo(TransitionDir / path)
var cfg = defaultRuntimeConfig
cfg.ALTAIR_FORK_EPOCH = transitionInfo.fork_epoch.Epoch
runTest(
phase0.BeaconState, altair.BeaconState, phase0.SignedBeaconBlock,
altair.SignedBeaconBlock, cfg, "EF - Altair - Transition", TransitionDir,
path, transitionInfo.fork_block)
from ../../beacon_chain/spec/datatypes/bellatrix import
BeaconState, SignedBeaconBlock
suite "EF - Bellatrix - Transition " & preset():
const TransitionDir =
SszTestsDir/const_preset/"bellatrix"/"transition"/"core"/"pyspec_tests"
for kind, path in walkDir(TransitionDir, relative = true, checkDir = true):
let transitionInfo = getTransitionInfo(TransitionDir / path)
var cfg = defaultRuntimeConfig
cfg.BELLATRIX_FORK_EPOCH = transitionInfo.fork_epoch.Epoch
runTest(
altair.BeaconState, bellatrix.BeaconState, altair.SignedBeaconBlock,
bellatrix.SignedBeaconBlock, cfg, "EF - Bellatrix - Transition",
TransitionDir, path, transitionInfo.fork_block)
from ../../beacon_chain/spec/datatypes/capella import
BeaconState, SignedBeaconBlock
suite "EF - Capella - Transition " & preset():
const TransitionDir =
SszTestsDir/const_preset/"capella"/"transition"/"core"/"pyspec_tests"
for kind, path in walkDir(TransitionDir, relative = true, checkDir = true):
let transitionInfo = getTransitionInfo(TransitionDir / path)
var cfg = defaultRuntimeConfig
cfg.CAPELLA_FORK_EPOCH = transitionInfo.fork_epoch.Epoch
runTest(
bellatrix.BeaconState, capella.BeaconState, bellatrix.SignedBeaconBlock,
capella.SignedBeaconBlock, cfg, "EF - Capella - Transition",
TransitionDir, path, transitionInfo.fork_block)
from ../../beacon_chain/spec/datatypes/eip4844 import
BeaconState, SignedBeaconBlock
suite "EF - EIP4844 - Transition " & preset():
const TransitionDir =
SszTestsDir/const_preset/"eip4844"/"transition"/"core"/"pyspec_tests"
for kind, path in walkDir(TransitionDir, relative = true, checkDir = true):
let transitionInfo = getTransitionInfo(TransitionDir / path)
var cfg = defaultRuntimeConfig
cfg.EIP4844_FORK_EPOCH = transitionInfo.fork_epoch.Epoch
runTest(
capella.BeaconState, eip4844.BeaconState, capella.SignedBeaconBlock,
eip4844.SignedBeaconBlock, cfg, "EF - EIP4844 - Transition",
TransitionDir, path, transitionInfo.fork_block)