From 258f15159448b4892007753d5e5c9d6d739430d0 Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Sun, 29 Jan 2023 04:34:26 +0100 Subject: [PATCH] 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 --- ConsensusSpecPreset-minimal.md | 8 ++--- ...xture_light_client_single_merkle_proof.nim | 4 ++- ...st_fixture_light_client_update_ranking.nim | 31 +++++++++++++------ 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/ConsensusSpecPreset-minimal.md b/ConsensusSpecPreset-minimal.md index 9799831c8..2d2ad8792 100644 --- a/ConsensusSpecPreset-minimal.md +++ b/ConsensusSpecPreset-minimal.md @@ -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 diff --git a/tests/consensus_spec/test_fixture_light_client_single_merkle_proof.nim b/tests/consensus_spec/test_fixture_light_client_single_merkle_proof.nim index 896b59734..e42b6925b 100644 --- a/tests/consensus_spec/test_fixture_light_client_single_merkle_proof.nim +++ b/tests/consensus_spec/test_fixture_light_client_single_merkle_proof.nim @@ -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): diff --git a/tests/consensus_spec/test_fixture_light_client_update_ranking.nim b/tests/consensus_spec/test_fixture_light_client_update_ranking.nim index 83b4db7bd..3a94fd145 100644 --- a/tests/consensus_spec/test_fixture_light_client_update_ranking.nim +++ b/tests/consensus_spec/test_fixture_light_client_update_ranking.nim @@ -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"