mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 14:54:12 +00:00
add Bellatrix fork and transition tests; "Ethereum Foundation" -> EF (#3242)
This commit is contained in:
parent
54d0d588b1
commit
cd77377375
@ -134,20 +134,7 @@ OK: 4/4 Fail: 0/4 Skip: 0/4
|
||||
+ Tail block only in common OK
|
||||
```
|
||||
OK: 2/2 Fail: 0/2 Skip: 0/2
|
||||
## Eth1 monitor
|
||||
```diff
|
||||
+ Rewrite HTTPS Infura URLs OK
|
||||
+ Roundtrip engine RPC and consensus ExecutionPayload representations OK
|
||||
```
|
||||
OK: 2/2 Fail: 0/2 Skip: 0/2
|
||||
## Eth2 specific discovery tests
|
||||
```diff
|
||||
+ Invalid attnets field OK
|
||||
+ Subnet query OK
|
||||
+ Subnet query after ENR update OK
|
||||
```
|
||||
OK: 3/3 Fail: 0/3 Skip: 0/3
|
||||
## Ethereum Foundation - SSZ generic types
|
||||
## EF - SSZ generic types
|
||||
```diff
|
||||
Testing basic_vector inputs - invalid Skip
|
||||
+ Testing basic_vector inputs - valid OK
|
||||
@ -163,6 +150,19 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
|
||||
+ Testing uints inputs - valid OK
|
||||
```
|
||||
OK: 10/12 Fail: 0/12 Skip: 2/12
|
||||
## Eth1 monitor
|
||||
```diff
|
||||
+ Rewrite HTTPS Infura URLs OK
|
||||
+ Roundtrip engine RPC and consensus ExecutionPayload representations OK
|
||||
```
|
||||
OK: 2/2 Fail: 0/2 Skip: 0/2
|
||||
## Eth2 specific discovery tests
|
||||
```diff
|
||||
+ Invalid attnets field OK
|
||||
+ Subnet query OK
|
||||
+ Subnet query after ENR update OK
|
||||
```
|
||||
OK: 3/3 Fail: 0/3 Skip: 0/3
|
||||
## Exit pool testing suite
|
||||
```diff
|
||||
+ addExitMessage/getAttesterSlashingMessage OK
|
||||
@ -442,4 +442,4 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
OK: 1/1 Fail: 0/1 Skip: 0/1
|
||||
|
||||
---TOTAL---
|
||||
OK: 238/240 Fail: 0/239 Skip: 2/239
|
||||
OK: 238/240 Fail: 0/240 Skip: 2/240
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2021 Status Research & Development GmbH
|
||||
# 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).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2021 Status Research & Development GmbH
|
||||
# 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).
|
||||
@ -58,6 +58,6 @@ proc runTest(identifier: string) =
|
||||
|
||||
`testImpl _ merkle_single_proof _ identifier`()
|
||||
|
||||
suite "Ethereum Foundation - Altair - Merkle - Single proof" & preset():
|
||||
suite "EF - Altair - Merkle - Single proof" & preset():
|
||||
for kind, path in walkDir(TestsDir, relative = true, checkDir = true):
|
||||
runTest(path)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -32,7 +32,7 @@ const
|
||||
OpSyncAggregateDir = OpDir/"sync_aggregate"
|
||||
OpVoluntaryExitDir = OpDir/"voluntary_exit"
|
||||
|
||||
baseDescription = "Ethereum Foundation - Altair - Operations - "
|
||||
baseDescription = "EF - Altair - Operations - "
|
||||
|
||||
doAssert toHashSet(mapIt(toSeq(walkDir(OpDir, relative = false)), it.path)) ==
|
||||
toHashSet([OpAttestationsDir, OpAttSlashingDir, OpBlockHeaderDir,
|
||||
|
@ -35,7 +35,7 @@ proc runTest(rewardsDir, identifier: string) =
|
||||
let testDir = rewardsDir / identifier
|
||||
|
||||
proc `testImpl _ rewards _ identifier`() =
|
||||
test "Ethereum Foundation - Altair - Rewards - " & identifier & preset():
|
||||
test "EF - Altair - Rewards - " & identifier & preset():
|
||||
var info: altair.EpochInfo
|
||||
|
||||
let
|
||||
@ -79,7 +79,7 @@ proc runTest(rewardsDir, identifier: string) =
|
||||
|
||||
`testImpl _ rewards _ identifier`()
|
||||
|
||||
suite "Ethereum Foundation - Altair - Rewards " & preset():
|
||||
suite "EF - Altair - Rewards " & preset():
|
||||
for rewardsDir in [RewardsDirBasic, RewardsDirLeak, RewardsDirRandom]:
|
||||
for kind, path in walkDir(rewardsDir, relative = true, checkDir = true):
|
||||
runTest(rewardsDir, path)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -64,14 +64,14 @@ proc runTest(testName, testDir, unitTestName: string) =
|
||||
|
||||
`testImpl _ blck _ testName`()
|
||||
|
||||
suite "Ethereum Foundation - Altair - Sanity - Blocks " & preset():
|
||||
suite "EF - Altair - Sanity - Blocks " & preset():
|
||||
for kind, path in walkDir(SanityBlocksDir, relative = true, checkDir = true):
|
||||
runTest("Ethereum Foundation - Altair - Sanity - Blocks", SanityBlocksDir, path)
|
||||
runTest("EF - Altair - Sanity - Blocks", SanityBlocksDir, path)
|
||||
|
||||
suite "Ethereum Foundation - Altair - Finality " & preset():
|
||||
suite "EF - Altair - Finality " & preset():
|
||||
for kind, path in walkDir(FinalityDir, relative = true, checkDir = true):
|
||||
runTest("Ethereum Foundation - Altair - Finality", FinalityDir, path)
|
||||
runTest("EF - Altair - Finality", FinalityDir, path)
|
||||
|
||||
suite "Ethereum Foundation - Altair - Random" & preset():
|
||||
suite "EF - Altair - Random" & preset():
|
||||
for kind, path in walkDir(RandomDir, relative = true, checkDir = true):
|
||||
runTest("Ethereum Foundation - Altair - Random", RandomDir, path)
|
||||
runTest("EF - Altair - Random", RandomDir, path)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -49,6 +49,6 @@ proc runTest(identifier: string) =
|
||||
|
||||
`testImpl _ slots _ identifier`()
|
||||
|
||||
suite "Ethereum Foundation - Altair - Sanity - Slots " & preset():
|
||||
suite "EF - Altair - Sanity - Slots " & preset():
|
||||
for kind, path in walkDir(SanitySlotsDir, relative = true, checkDir = true):
|
||||
runTest(path)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -78,7 +78,7 @@ proc loadExpectedHashTreeRoot(dir: string): SSZHashTreeRoot =
|
||||
# Test runner
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
suite "Ethereum Foundation - Altair - SSZ consensus objects " & preset():
|
||||
suite "EF - Altair - SSZ consensus objects " & preset():
|
||||
doAssert existsDir(SSZDir), "You need to run the \"download_test_vectors.sh\" script to retrieve the consensus spec test vectors."
|
||||
for pathKind, sszType in walkDir(SSZDir, relative = true, checkDir = true):
|
||||
doAssert pathKind == pcDir
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -24,7 +24,7 @@ const RootDir = SszTestsDir/const_preset/"altair"/"epoch_processing"
|
||||
|
||||
template runSuite(
|
||||
suiteDir, testName: string, transitionProc: untyped): untyped =
|
||||
suite "Ethereum Foundation - Altair - Epoch Processing - " & testName & preset():
|
||||
suite "EF - Altair - Epoch Processing - " & testName & preset():
|
||||
for testDir in walkDirRec(suiteDir, yieldFilter = {pcDir}, checkDir = true):
|
||||
|
||||
let unitTestName = testDir.rsplit(DirSep, 1)[1]
|
||||
|
@ -84,7 +84,7 @@ func initialize_light_client_store(state: auto): LightClientStore =
|
||||
current_max_active_participants: 0,
|
||||
)
|
||||
|
||||
suite "Ethereum Foundation - Altair - Unittests - Sync protocol" & preset():
|
||||
suite "EF - Altair - Unittests - Sync protocol" & preset():
|
||||
let
|
||||
cfg = block:
|
||||
var res = defaultRuntimeConfig
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2021 Status Research & Development GmbH
|
||||
# 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).
|
||||
@ -77,6 +77,6 @@ proc runTest(testName, testDir, unitTestName: string) =
|
||||
|
||||
`testImpl _ blck _ testName`()
|
||||
|
||||
suite "Ethereum Foundation - Altair - Transition " & preset():
|
||||
suite "EF - Altair - Transition " & preset():
|
||||
for kind, path in walkDir(TransitionDir, relative = true, checkDir = true):
|
||||
runTest("Ethereum Foundation - Altair - Transition", TransitionDir, path)
|
||||
runTest("EF - Altair - Transition", TransitionDir, path)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2021 Status Research & Development GmbH
|
||||
# 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).
|
||||
@ -8,8 +8,10 @@
|
||||
{.used.}
|
||||
|
||||
import
|
||||
./test_fixture_fork,
|
||||
./test_fixture_operations,
|
||||
./test_fixture_sanity_blocks,
|
||||
./test_fixture_sanity_slots,
|
||||
./test_fixture_ssz_consensus_objects,
|
||||
./test_fixture_state_transition_epoch
|
||||
./test_fixture_state_transition_epoch,
|
||||
./test_fixture_transition
|
||||
|
44
tests/consensus_spec/bellatrix/test_fixture_fork.nim
Normal file
44
tests/consensus_spec/bellatrix/test_fixture_fork.nim
Normal file
@ -0,0 +1,44 @@
|
||||
# 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/[altair, merge],
|
||||
# Test utilities
|
||||
../../testutil,
|
||||
../fixtures_utils,
|
||||
../../helpers/debug_state
|
||||
|
||||
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, merge.BeaconState))
|
||||
|
||||
var cfg = defaultRuntimeConfig
|
||||
|
||||
let upgradedState = upgrade_to_merge(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)
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -33,7 +33,7 @@ const
|
||||
OpSyncAggregateDir = OpDir/"sync_aggregate"
|
||||
OpVoluntaryExitDir = OpDir/"voluntary_exit"
|
||||
|
||||
baseDescription = "Ethereum Foundation - Bellatrix - Operations - "
|
||||
baseDescription = "EF - Bellatrix - Operations - "
|
||||
|
||||
# DS_Store issue: https://github.com/ethereum/consensus-spec-tests/issues/27
|
||||
doAssert toHashSet(filterIt(mapIt(toSeq(walkDir(OpDir, relative = false)), it.path), not it.contains("DS_Store"))) ==
|
||||
|
@ -35,7 +35,7 @@ proc runTest(rewardsDir, identifier: string) =
|
||||
let testDir = rewardsDir / identifier
|
||||
|
||||
proc `testImpl _ rewards _ identifier`() =
|
||||
test "Ethereum Foundation - Bellatrix - Rewards - " & identifier & preset():
|
||||
test "EF - Bellatrix - Rewards - " & identifier & preset():
|
||||
var info: altair.EpochInfo
|
||||
|
||||
let
|
||||
@ -79,7 +79,7 @@ proc runTest(rewardsDir, identifier: string) =
|
||||
|
||||
`testImpl _ rewards _ identifier`()
|
||||
|
||||
suite "Ethereum Foundation - Bellatrix - Rewards " & preset():
|
||||
suite "EF - Bellatrix - Rewards " & preset():
|
||||
for rewardsDir in [RewardsDirBasic, RewardsDirLeak, RewardsDirRandom]:
|
||||
for kind, path in walkDir(rewardsDir, relative = true, checkDir = true):
|
||||
runTest(rewardsDir, path)
|
||||
|
@ -69,13 +69,13 @@ proc runTest(testName, testDir, unitTestName: string) =
|
||||
|
||||
`testImpl _ blck _ testName`()
|
||||
|
||||
suite "Ethereum Foundation - Bellatrix - Sanity - Blocks " & preset():
|
||||
suite "EF - Bellatrix - Sanity - Blocks " & preset():
|
||||
for kind, path in walkDir(SanityBlocksDir, relative = true, checkDir = true):
|
||||
if path.contains("DS_Store"):
|
||||
# https://github.com/ethereum/consensus-spec-tests/issues/27
|
||||
continue
|
||||
runTest("Ethereum Foundation - Bellatrix - Sanity - Blocks", SanityBlocksDir, path)
|
||||
runTest("EF - Bellatrix - Sanity - Blocks", SanityBlocksDir, path)
|
||||
|
||||
suite "Ethereum Foundation - Bellatrix - Finality " & preset():
|
||||
suite "EF - Bellatrix - Finality " & preset():
|
||||
for kind, path in walkDir(FinalityDir, relative = true, checkDir = true):
|
||||
runTest("Ethereum Foundation - Bellatrix - Finality", FinalityDir, path)
|
||||
runTest("EF - Bellatrix - Finality", FinalityDir, path)
|
||||
|
@ -48,6 +48,6 @@ proc runTest(identifier: string) =
|
||||
|
||||
`testImpl _ slots _ identifier`()
|
||||
|
||||
suite "Ethereum Foundation - Bellatrix - Sanity - Slots " & preset():
|
||||
suite "EF - Bellatrix - Sanity - Slots " & preset():
|
||||
for kind, path in walkDir(SanitySlotsDir, relative = true, checkDir = true):
|
||||
runTest(path)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -78,7 +78,7 @@ proc loadExpectedHashTreeRoot(dir: string): SSZHashTreeRoot =
|
||||
# Test runner
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
suite "Ethereum Foundation - Bellatrix - SSZ consensus objects " & preset():
|
||||
suite "EF - Bellatrix - SSZ consensus objects " & preset():
|
||||
doAssert existsDir(SSZDir), "You need to run the \"download_test_vectors.sh\" script to retrieve the consensus spec test vectors."
|
||||
for pathKind, sszType in walkDir(SSZDir, relative = true, checkDir = true):
|
||||
doAssert pathKind == pcDir
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -23,7 +23,7 @@ const RootDir = SszTestsDir/const_preset/"bellatrix"/"epoch_processing"
|
||||
|
||||
template runSuite(
|
||||
suiteDir, testName: string, transitionProc: untyped): untyped =
|
||||
suite "Ethereum Foundation - Bellatrix - Epoch Processing - " & testName & preset():
|
||||
suite "EF - Bellatrix - Epoch Processing - " & testName & preset():
|
||||
for testDir in walkDirRec(suiteDir, yieldFilter = {pcDir}, checkDir = true):
|
||||
|
||||
let unitTestName = testDir.rsplit(DirSep, 1)[1]
|
||||
|
85
tests/consensus_spec/bellatrix/test_fixture_transition.nim
Normal file
85
tests/consensus_spec/bellatrix/test_fixture_transition.nim
Normal file
@ -0,0 +1,85 @@
|
||||
# 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,
|
||||
# Standard library
|
||||
std/[os, sequtils, strutils],
|
||||
# Status internal
|
||||
chronicles,
|
||||
faststreams, streams,
|
||||
# Beacon chain internals
|
||||
../../../beacon_chain/spec/[state_transition, forks, helpers],
|
||||
../../../beacon_chain/spec/datatypes/[altair, merge],
|
||||
# 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
|
||||
var 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.MERGE_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 success = state_transition(
|
||||
cfg, fhPreState[], blck, cache, info,
|
||||
flags = {skipStateRootValidation}, noRollback)
|
||||
doAssert success, "Failure when applying block " & $i
|
||||
else:
|
||||
let blck = parseTest(testPath/"blocks_" & $i & ".ssz_snappy", SSZ, merge.SignedBeaconBlock)
|
||||
|
||||
let success = state_transition(
|
||||
cfg, fhPreState[], blck, cache, info,
|
||||
flags = {skipStateRootValidation}, noRollback)
|
||||
doAssert success, "Failure when applying block " & $i
|
||||
|
||||
let postState = newClone(parseTest(testPath/"post.ssz_snappy", SSZ, merge.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):
|
||||
# TODO https://github.com/ethereum/consensus-spec-tests/issues/27
|
||||
if path.contains("DS_Store"):
|
||||
continue
|
||||
runTest("EF - Bellatrix - Transition", TransitionDir, path)
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2021 Status Research & Development GmbH
|
||||
# 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).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2021 Status Research & Development GmbH
|
||||
# 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).
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -31,7 +31,7 @@ const
|
||||
OpProposerSlashingDir = OpDir/"proposer_slashing"
|
||||
OpVoluntaryExitDir = OpDir/"voluntary_exit"
|
||||
|
||||
baseDescription = "Ethereum Foundation - Phase 0 - Operations - "
|
||||
baseDescription = "EF - Phase 0 - Operations - "
|
||||
|
||||
doAssert toHashSet(mapIt(toSeq(walkDir(OpDir, relative = false)), it.path)) ==
|
||||
toHashSet([OpAttestationsDir, OpAttSlashingDir, OpBlockHeaderDir,
|
||||
|
@ -39,7 +39,7 @@ proc runTest(rewardsDir, identifier: string) =
|
||||
let testDir = rewardsDir / identifier
|
||||
|
||||
proc `testImpl _ rewards _ identifier`() =
|
||||
test "Ethereum Foundation - Phase 0 - Rewards - " & identifier & preset():
|
||||
test "EF - Phase 0 - Rewards - " & identifier & preset():
|
||||
let
|
||||
state = newClone(
|
||||
parseTest(testDir/"pre.ssz_snappy", SSZ, phase0.BeaconState))
|
||||
@ -107,7 +107,7 @@ proc runTest(rewardsDir, identifier: string) =
|
||||
|
||||
`testImpl _ rewards _ identifier`()
|
||||
|
||||
suite "Ethereum Foundation - Phase 0 - Rewards " & preset():
|
||||
suite "EF - Phase 0 - Rewards " & preset():
|
||||
for rewardsDir in [RewardsDirBasic, RewardsDirLeak, RewardsDirRandom]:
|
||||
for kind, path in walkDir(rewardsDir, relative = true, checkDir = true):
|
||||
runTest(rewardsDir, path)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -64,14 +64,14 @@ proc runTest(testName, testDir, unitTestName: string) =
|
||||
|
||||
`testImpl _ blck _ testName`()
|
||||
|
||||
suite "Ethereum Foundation - Phase 0 - Sanity - Blocks " & preset():
|
||||
suite "EF - Phase 0 - Sanity - Blocks " & preset():
|
||||
for kind, path in walkDir(SanityBlocksDir, relative = true, checkDir = true):
|
||||
runTest("Ethereum Foundation - Phase 0 - Sanity - Blocks", SanityBlocksDir, path)
|
||||
runTest("EF - Phase 0 - Sanity - Blocks", SanityBlocksDir, path)
|
||||
|
||||
suite "Ethereum Foundation - Phase 0 - Finality " & preset():
|
||||
suite "EF - Phase 0 - Finality " & preset():
|
||||
for kind, path in walkDir(FinalityDir, relative = true, checkDir = true):
|
||||
runTest("Ethereum Foundation - Phase 0 - Finality", FinalityDir, path)
|
||||
runTest("EF - Phase 0 - Finality", FinalityDir, path)
|
||||
|
||||
suite "Ethereum Foundation - Phase 0 - Random " & preset():
|
||||
suite "EF - Phase 0 - Random " & preset():
|
||||
for kind, path in walkDir(RandomDir, relative = true, checkDir = true):
|
||||
runTest("Ethereum Foundation - Phase 0 - Random", RandomDir, path)
|
||||
runTest("EF - Phase 0 - Random", RandomDir, path)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -47,6 +47,6 @@ proc runTest(identifier: string) =
|
||||
|
||||
`testImpl _ slots _ identifier`()
|
||||
|
||||
suite "Ethereum Foundation - Phase 0 - Sanity - Slots " & preset():
|
||||
suite "EF - Phase 0 - Sanity - Slots " & preset():
|
||||
for kind, path in walkDir(SanitySlotsDir, relative = true, checkDir = true):
|
||||
runTest(path)
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -78,7 +78,7 @@ proc loadExpectedHashTreeRoot(dir: string): SSZHashTreeRoot =
|
||||
# Test runner
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
suite "Ethereum Foundation - Phase 0 - SSZ consensus objects " & preset():
|
||||
suite "EF - Phase 0 - SSZ consensus objects " & preset():
|
||||
doAssert existsDir(SSZDir), "You need to run the \"download_test_vectors.sh\" script to retrieve the consensus spec test vectors."
|
||||
for pathKind, sszType in walkDir(SSZDir, relative = true, checkDir = true):
|
||||
doAssert pathKind == pcDir
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -23,7 +23,7 @@ import
|
||||
const RootDir = SszTestsDir/const_preset/"phase0"/"epoch_processing"
|
||||
|
||||
template runSuite(suiteDir, testName: string, transitionProc: untyped): untyped =
|
||||
suite "Ethereum Foundation - Phase 0 - Epoch Processing - " & testName & preset():
|
||||
suite "EF - Phase 0 - Epoch Processing - " & testName & preset():
|
||||
for testDir in walkDirRec(suiteDir, yieldFilter = {pcDir}, checkDir = true):
|
||||
|
||||
let unitTestName = testDir.rsplit(DirSep, 1)[1]
|
||||
|
@ -321,7 +321,7 @@ proc runTest(path: string, fork: BeaconBlockFork) =
|
||||
else:
|
||||
doAssert false, "Unsupported"
|
||||
|
||||
suite "Ethereum Foundation - ForkChoice" & preset():
|
||||
suite "EF - ForkChoice" & preset():
|
||||
const SKIP = [
|
||||
# protoArray can handle blocks in the future gracefully
|
||||
# spec: https://github.com/ethereum/consensus-specs/blame/v1.1.3/specs/phase0/fork-choice.md#L349
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-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).
|
||||
@ -245,7 +245,7 @@ proc sszCheck(baseDir, sszType, sszSubType: string) =
|
||||
# Test runner
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
suite "Ethereum Foundation - SSZ generic types":
|
||||
suite "EF - SSZ generic types":
|
||||
doAssert existsDir(SSZDir), "You need to run the \"download_test_vectors.sh\" script to retrieve the consensus spec test vectors."
|
||||
for pathKind, sszType in walkDir(SSZDir, relative = true, checkDir = true):
|
||||
doAssert pathKind == pcDir
|
||||
|
@ -79,7 +79,7 @@ proc sqlite3db_delete(basepath, dbname: string) =
|
||||
removeFile(basepath / dbname&".sqlite3-wal")
|
||||
removeFile(basepath / dbname&".sqlite3")
|
||||
|
||||
const InterchangeTestsDir = FixturesDir / "tests-slashing-v5.0.0" / "generated"
|
||||
const InterchangeTestsDir = FixturesDir / "tests-slashing-v5.0.0" / "tests" / "generated"
|
||||
const TestDir = ""
|
||||
const TestDbPrefix = "test_slashprot_"
|
||||
|
||||
|
2
vendor/nim-eth2-scenarios
vendored
2
vendor/nim-eth2-scenarios
vendored
@ -1 +1 @@
|
||||
Subproject commit 9785f84f2d9f872074434c26b13fb66259c82395
|
||||
Subproject commit 1074fab55d882b6a2179c878f3f5daa24e1add94
|
Loading…
x
Reference in New Issue
Block a user