From 963e0bb92bcecf189d0171907567709bef60ab6e Mon Sep 17 00:00:00 2001 From: tersec Date: Wed, 8 May 2024 02:43:05 +0000 Subject: [PATCH] use EF consensus spec v1.5.0-alpha.2 test vectors (#6272) --- ConsensusSpecPreset-mainnet.md | 15 +----- beacon_chain/spec/datatypes/base.nim | 2 +- .../electra/test_fixture_operations.nim | 51 ++++++++++--------- vendor/nim-eth2-scenarios | 2 +- 4 files changed, 31 insertions(+), 39 deletions(-) diff --git a/ConsensusSpecPreset-mainnet.md b/ConsensusSpecPreset-mainnet.md index 3001a9fd5..542a6f090 100644 --- a/ConsensusSpecPreset-mainnet.md +++ b/ConsensusSpecPreset-mainnet.md @@ -2673,19 +2673,6 @@ OK: 14/14 Fail: 0/14 Skip: 0/14 + [Valid] EF - Electra - Operations - Block Header - basic_block_header OK ``` OK: 6/6 Fail: 0/6 Skip: 0/6 -## EF - Electra - Operations - Consolidation [Preset: mainnet] -```diff -+ [Invalid] EF - Electra - Operations - Consolidation - invalid_before_specified_epoch OK -+ [Invalid] EF - Electra - Operations - Consolidation - invalid_different_credentials OK -+ [Invalid] EF - Electra - Operations - Consolidation - invalid_exited_source OK -+ [Invalid] EF - Electra - Operations - Consolidation - invalid_exited_target OK -+ [Invalid] EF - Electra - Operations - Consolidation - invalid_inactive_source OK -+ [Invalid] EF - Electra - Operations - Consolidation - invalid_inactive_target OK -+ [Invalid] EF - Electra - Operations - Consolidation - invalid_no_execution_withdrawal_cred OK -+ [Invalid] EF - Electra - Operations - Consolidation - invalid_not_enough_consolidation_chu OK -+ [Invalid] EF - Electra - Operations - Consolidation - invalid_source_equals_target OK -``` -OK: 9/9 Fail: 0/9 Skip: 0/9 ## EF - Electra - Operations - Deposit [Preset: mainnet] ```diff + [Invalid] EF - Electra - Operations - Deposit - invalid_bad_merkle_proof OK @@ -3688,4 +3675,4 @@ OK: 69/88 Fail: 0/88 Skip: 19/88 OK: 3/3 Fail: 0/3 Skip: 0/3 ---TOTAL--- -OK: 2970/2990 Fail: 0/2990 Skip: 20/2990 +OK: 2961/2981 Fail: 0/2981 Skip: 20/2981 diff --git a/beacon_chain/spec/datatypes/base.nim b/beacon_chain/spec/datatypes/base.nim index 16d2fa561..cec2a8b24 100644 --- a/beacon_chain/spec/datatypes/base.nim +++ b/beacon_chain/spec/datatypes/base.nim @@ -74,7 +74,7 @@ export tables, results, endians2, json_serialization, sszTypes, beacon_time, crypto, digest, presets -const SPEC_VERSION* = "1.5.0-alpha.1" +const SPEC_VERSION* = "1.5.0-alpha.2" ## Spec version we're aiming to be compatible with, right now const diff --git a/tests/consensus_spec/electra/test_fixture_operations.nim b/tests/consensus_spec/electra/test_fixture_operations.nim index 8a241a908..bb56d349a 100644 --- a/tests/consensus_spec/electra/test_fixture_operations.nim +++ b/tests/consensus_spec/electra/test_fixture_operations.nim @@ -45,13 +45,17 @@ const baseDescription = "EF - Electra - Operations - " -doAssert toHashSet(mapIt(toSeq(walkDir(OpDir, relative = false)), it.path)) == - toHashSet([ - OpAttestationsDir, OpAttSlashingDir, OpBlockHeaderDir, - OpBlsToExecutionChangeDir, OpConsolidationDir, OpDepositReceiptDir, - OpDepositsDir, OpExecutionLayerWithdrawalRequestDir, - OpExecutionPayloadDir, OpProposerSlashingDir, OpSyncAggregateDir, - OpVoluntaryExitDir, OpWithdrawalsDir]) + +var testDirs = toHashSet([ + OpAttestationsDir, OpAttSlashingDir, OpBlockHeaderDir, + OpBlsToExecutionChangeDir, OpDepositReceiptDir, OpDepositsDir, + OpExecutionLayerWithdrawalRequestDir, OpExecutionPayloadDir, + OpProposerSlashingDir, OpSyncAggregateDir, OpVoluntaryExitDir, + OpWithdrawalsDir]) +when const_preset == "minimal": + testDirs.incl OpConsolidationDir +doAssert toHashSet( + mapIt(toSeq(walkDir(OpDir, relative = false)), it.path)) == testDirs proc runTest[T, U]( testSuiteDir, suiteName, opName, applyFile: string, @@ -146,23 +150,24 @@ suite baseDescription & "BLS to execution change " & preset(): OpBlsToExecutionChangeDir, suiteName, "BLS to execution change", "address_change", applyBlsToExecutionChange, path) -suite baseDescription & "Consolidation " & preset(): - proc applyConsolidation( - preState: var electra.BeaconState, - signed_consolidation: SignedConsolidation): - Result[void, cstring] = - var cache: StateCache - process_consolidation( - defaultRuntimeConfig, preState, signed_consolidation, cache) +when const_preset == "minimal": + suite baseDescription & "Consolidation " & preset(): + proc applyConsolidation( + preState: var electra.BeaconState, + signed_consolidation: SignedConsolidation): + Result[void, cstring] = + var cache: StateCache + process_consolidation( + defaultRuntimeConfig, preState, signed_consolidation, cache) - for path in walkTests(OpConsolidationDir): - if path in [ - "invalid_exceed_pending_consolidations_limit", # apparently invalid prestate SSZ - ]: - continue - runTest[SignedConsolidation, typeof applyConsolidation]( - OpConsolidationDir, suiteName, "Consolidation", "consolidation", - applyConsolidation, path) + for path in walkTests(OpConsolidationDir): + if path in [ + "invalid_exceed_pending_consolidations_limit", # apparently invalid prestate SSZ + ]: + continue + runTest[SignedConsolidation, typeof applyConsolidation]( + OpConsolidationDir, suiteName, "Consolidation", "consolidation", + applyConsolidation, path) from ".."/".."/".."/beacon_chain/bloomfilter import constructBloomFilter diff --git a/vendor/nim-eth2-scenarios b/vendor/nim-eth2-scenarios index 67f8fa850..54675b5f1 160000 --- a/vendor/nim-eth2-scenarios +++ b/vendor/nim-eth2-scenarios @@ -1 +1 @@ -Subproject commit 67f8fa8506e3b97b5e68a9c60e38157507aeec61 +Subproject commit 54675b5f1fd8156a508e75991693df57a281642e