prepare LC update ranking test runner for Capella (#4563)

* prepare LC update ranking test runner for Capella

Adds missing Capella/EIP4844 support to LC update ranking runner.

* fix uncommitted typo

* skip capella / eip4844 tests

* cleanup test skip
This commit is contained in:
Etan Kissling 2023-01-29 04:34:26 +01:00 committed by GitHub
parent 0fb726c420
commit 258f151594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 15 deletions

View File

@ -525,8 +525,8 @@ ConsensusSpecPreset-minimal
+ Light client - Sync - minimal/eip4844/light_client/sync/pyspec_tests/supply_sync_committee OK
+ Light client - Update ranking - minimal/altair/light_client/update_ranking/pyspec_tests/up OK
+ Light client - Update ranking - minimal/bellatrix/light_client/update_ranking/pyspec_tests OK
+ Light client - Update ranking - minimal/capella/light_client/update_ranking/pyspec_tests/u OK
+ Light client - Update ranking - minimal/eip4844/light_client/update_ranking/pyspec_tests/u OK
Light client - Update ranking - minimal/capella/light_client/update_ranking/pyspec_tests/u Skip
Light client - Update ranking - minimal/eip4844/light_client/update_ranking/pyspec_tests/u Skip
+ Sync - minimal/bellatrix/sync/optimistic/pyspec_tests/from_syncing_to_invalid OK
+ Sync - minimal/capella/sync/optimistic/pyspec_tests/from_syncing_to_invalid OK
+ Sync - minimal/eip4844/sync/optimistic/pyspec_tests/from_syncing_to_invalid OK
@ -918,7 +918,7 @@ ConsensusSpecPreset-minimal
+ [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
```
OK: 906/915 Fail: 0/915 Skip: 9/915
OK: 904/915 Fail: 0/915 Skip: 11/915
## Attestation
```diff
+ [Invalid] EF - Altair - Operations - Attestation - invalid_after_epoch_slots OK
@ -2763,4 +2763,4 @@ OK: 68/68 Fail: 0/68 Skip: 0/68
OK: 102/102 Fail: 0/102 Skip: 0/102
---TOTAL---
OK: 2444/2453 Fail: 0/2453 Skip: 9/2453
OK: 2442/2453 Fail: 0/2453 Skip: 11/2453

View File

@ -57,7 +57,9 @@ suite "EF - Light client - Single merkle proof" & preset():
if kind != pcDir or not dirExists(testsPath):
continue
let fork = forkForPathComponent(path).valueOr:
raiseAssert "Unknown test fork: " & testsPath
test "Light client - Single merkle proof - " & path:
skip()
continue
for kind, path in walkDir(testsPath, relative = true, checkDir = true):
let suitePath = testsPath/path
if kind != pcDir or not dirExists(suitePath):

View File

@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2022 Status Research & Development GmbH
# Copyright (c) 2022-2023 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).
@ -16,7 +16,6 @@ import
yaml,
# Beacon chain internals
../../../beacon_chain/spec/helpers,
../../../beacon_chain/spec/datatypes/altair,
# Test utilities
../testutil,
./fixtures_utils
@ -25,8 +24,12 @@ type
TestMeta = object
updates_count: uint64
proc runTest(path: string) =
proc runTest(path: string, lcDataFork: static LightClientDataFork) =
test "Light client - Update ranking - " & path.relativePath(SszTestsDir):
when lcDataFork >= LightClientDataFork.Capella:
skip()
return
let meta = block:
var s = openFileStream(path/"meta.yaml")
defer: close(s)
@ -34,13 +37,13 @@ proc runTest(path: string) =
yaml.load(s, res)
res
var updates = newSeqOfCap[altair.LightClientUpdate](meta.updates_count)
var updates = newSeqOfCap[lcDataFork.LightClientUpdate](meta.updates_count)
for i in 0 ..< meta.updates_count:
updates.add parseTest(
path/"updates_" & Base10.toString(i) & ".ssz_snappy",
SSZ, altair.LightClientUpdate)
SSZ, lcDataFork.LightClientUpdate)
proc cmp(a, b: altair.LightClientUpdate): int =
proc cmp(a, b: lcDataFork.LightClientUpdate): int =
if a.is_better_update(b):
check: not b.is_better_update(a)
-1
@ -53,9 +56,17 @@ proc runTest(path: string) =
suite "EF - Light client - Update ranking" & preset():
const presetPath = SszTestsDir/const_preset
for kind, path in walkDir(presetPath, relative = true, checkDir = true):
let basePath =
let testsPath =
presetPath/path/"light_client"/"update_ranking"/"pyspec_tests"
if kind != pcDir or not dirExists(basePath):
if kind != pcDir or not dirExists(testsPath):
continue
for kind, path in walkDir(basePath, relative = true, checkDir = true):
runTest(basePath/path)
let fork = forkForPathComponent(path).valueOr:
test "Light client - Update ranking - " & path:
skip()
continue
for kind, path in walkDir(testsPath, relative = true, checkDir = true):
withStateFork(fork):
const lcDataFork = lcDataForkAtStateFork(stateFork)
when lcDataFork > LightClientDataFork.None:
runTest(testsPath/path, lcDataFork)
else: raiseAssert "Unreachable"