Skip to content

Commit 8980832

Browse files
committed
Update Fulu spec tests. Revert back to testing Fulu as "feature", because all non-PeerDAS Fulu SSZ types are the same as Electra, and serde deserializes the vectors into Electra types.
1 parent 4d407fe commit 8980832

File tree

5 files changed

+119
-24
lines changed

5 files changed

+119
-24
lines changed

testing/ef_tests/check_all_files_accessed.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949
"bls12-381-tests/hash_to_G2",
5050
"tests/.*/eip6110",
5151
"tests/.*/whisk",
52-
# Fulu tests are not yet being run
53-
"tests/.*/fulu",
5452
# TODO(electra): SingleAttestation tests are waiting on Eitan's PR
55-
"tests/.*/electra/ssz_static/SingleAttestation"
53+
"tests/.*/electra/ssz_static/SingleAttestation",
54+
"tests/.*/fulu/ssz_static/SingleAttestation",
55+
"tests/.*/fulu/ssz_static/MatrixEntry",
5656
]
5757

5858

testing/ef_tests/src/cases.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,26 +91,29 @@ pub use transition::TransitionTest;
9191
/// to return `true` for the feature in order for the feature test vector to be tested.
9292
#[derive(Debug, PartialEq, Clone, Copy)]
9393
pub enum FeatureName {
94-
Placeholder,
94+
// TODO(fulu): to be removed once we start using Fulu types for test vectors.
95+
// Existing SSZ types for PeerDAS (Fulu) are the same as Electra, so the test vectors get
96+
// loaded as Electra types (default serde behaviour for untagged enums).
97+
Fulu,
9598
}
9699

97100
impl FeatureName {
98101
pub fn list_all() -> Vec<FeatureName> {
99-
vec![FeatureName::Placeholder]
102+
vec![FeatureName::Fulu]
100103
}
101104

102105
/// `ForkName` to use when running the feature tests.
103106
pub fn fork_name(&self) -> ForkName {
104107
match self {
105-
FeatureName::Placeholder => ForkName::Fulu,
108+
FeatureName::Fulu => ForkName::Electra,
106109
}
107110
}
108111
}
109112

110113
impl Display for FeatureName {
111114
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
112115
match self {
113-
FeatureName::Placeholder => f.write_str("placeholder"),
116+
FeatureName::Fulu => f.write_str("fulu"),
114117
}
115118
}
116119
}

testing/ef_tests/src/handler.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,25 @@ where
353353
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
354354
self.supported_forks.contains(&fork_name)
355355
}
356+
357+
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
358+
// TODO(fulu): to be removed once Fulu types start differing from Electra. We currently run Fulu tests as a
359+
// "feature" - this means we use Electra types for Fulu SSZ tests (except for PeerDAS types, e.g. `DataColumnSidecar`).
360+
//
361+
// This ensures we only run the tests **once** for `Fulu`, using the types matching the
362+
// correct fork, e.g. `Fulu` uses SSZ types from `Electra` as of spec test version
363+
// `v1.5.0-beta.0`, therefore the `Fulu` tests should get included when testing Deneb types.
364+
//
365+
// e.g. Fulu test vectors are executed in the 2nd line below, but excluded in the 1st
366+
// line when testing the type `AttestationElectra`:
367+
//
368+
// ```
369+
// SszStaticHandler::<AttestationBase<MainnetEthSpec>, MainnetEthSpec>::pre_electra().run();
370+
// SszStaticHandler::<AttestationElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only().run();
371+
// ```
372+
feature_name == FeatureName::Fulu
373+
&& self.supported_forks.contains(&feature_name.fork_name())
374+
}
356375
}
357376

358377
impl<E> Handler for SszStaticTHCHandler<BeaconState<E>, E>
@@ -372,6 +391,10 @@ where
372391
fn handler_name(&self) -> String {
373392
BeaconState::<E>::name().into()
374393
}
394+
395+
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
396+
feature_name == FeatureName::Fulu
397+
}
375398
}
376399

377400
impl<T, E> Handler for SszStaticWithSpecHandler<T, E>
@@ -393,6 +416,10 @@ where
393416
fn handler_name(&self) -> String {
394417
T::name().into()
395418
}
419+
420+
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
421+
feature_name == FeatureName::Fulu
422+
}
396423
}
397424

398425
#[derive(Derivative)]
@@ -866,6 +893,10 @@ impl<E: EthSpec + TypeName> Handler for GetCustodyGroupsHandler<E> {
866893
fn handler_name(&self) -> String {
867894
"get_custody_groups".into()
868895
}
896+
897+
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
898+
feature_name == FeatureName::Fulu
899+
}
869900
}
870901

871902
#[derive(Derivative)]
@@ -886,6 +917,10 @@ impl<E: EthSpec + TypeName> Handler for ComputeColumnsForCustodyGroupHandler<E>
886917
fn handler_name(&self) -> String {
887918
"compute_columns_for_custody_group".into()
888919
}
920+
921+
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
922+
feature_name == FeatureName::Fulu
923+
}
889924
}
890925

891926
#[derive(Derivative)]
@@ -906,6 +941,10 @@ impl<E: EthSpec> Handler for KZGComputeCellsAndKZGProofHandler<E> {
906941
fn handler_name(&self) -> String {
907942
"compute_cells_and_kzg_proofs".into()
908943
}
944+
945+
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
946+
feature_name == FeatureName::Fulu
947+
}
909948
}
910949

911950
#[derive(Derivative)]
@@ -926,6 +965,10 @@ impl<E: EthSpec> Handler for KZGVerifyCellKZGProofBatchHandler<E> {
926965
fn handler_name(&self) -> String {
927966
"verify_cell_kzg_proof_batch".into()
928967
}
968+
969+
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
970+
feature_name == FeatureName::Fulu
971+
}
929972
}
930973

931974
#[derive(Derivative)]
@@ -946,6 +989,10 @@ impl<E: EthSpec> Handler for KZGRecoverCellsAndKZGProofHandler<E> {
946989
fn handler_name(&self) -> String {
947990
"recover_cells_and_kzg_proofs".into()
948991
}
992+
993+
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
994+
feature_name == FeatureName::Fulu
995+
}
949996
}
950997

951998
#[derive(Derivative)]
@@ -994,6 +1041,10 @@ impl<E: EthSpec + TypeName> Handler for KzgInclusionMerkleProofValidityHandler<E
9941041
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
9951042
fork_name.deneb_enabled()
9961043
}
1044+
1045+
fn is_enabled_for_feature(&self, feature_name: FeatureName) -> bool {
1046+
feature_name == FeatureName::Fulu
1047+
}
9971048
}
9981049

9991050
#[derive(Derivative)]

testing/ef_tests/src/type_name.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type_name_generic!(BeaconBlockBodyBellatrix, "BeaconBlockBody");
5454
type_name_generic!(BeaconBlockBodyCapella, "BeaconBlockBody");
5555
type_name_generic!(BeaconBlockBodyDeneb, "BeaconBlockBody");
5656
type_name_generic!(BeaconBlockBodyElectra, "BeaconBlockBody");
57+
type_name_generic!(BeaconBlockBodyFulu, "BeaconBlockBody");
5758
type_name!(BeaconBlockHeader);
5859
type_name_generic!(BeaconState);
5960
type_name!(BlobIdentifier);
@@ -74,12 +75,14 @@ type_name_generic!(ExecutionPayloadBellatrix, "ExecutionPayload");
7475
type_name_generic!(ExecutionPayloadCapella, "ExecutionPayload");
7576
type_name_generic!(ExecutionPayloadDeneb, "ExecutionPayload");
7677
type_name_generic!(ExecutionPayloadElectra, "ExecutionPayload");
78+
type_name_generic!(ExecutionPayloadFulu, "ExecutionPayload");
7779
type_name_generic!(FullPayload, "ExecutionPayload");
7880
type_name_generic!(ExecutionPayloadHeader);
7981
type_name_generic!(ExecutionPayloadHeaderBellatrix, "ExecutionPayloadHeader");
8082
type_name_generic!(ExecutionPayloadHeaderCapella, "ExecutionPayloadHeader");
8183
type_name_generic!(ExecutionPayloadHeaderDeneb, "ExecutionPayloadHeader");
8284
type_name_generic!(ExecutionPayloadHeaderElectra, "ExecutionPayloadHeader");
85+
type_name_generic!(ExecutionPayloadHeaderFulu, "ExecutionPayloadHeader");
8386
type_name_generic!(ExecutionRequests);
8487
type_name_generic!(BlindedPayload, "ExecutionPayloadHeader");
8588
type_name!(Fork);
@@ -93,6 +96,7 @@ type_name_generic!(LightClientBootstrapAltair, "LightClientBootstrap");
9396
type_name_generic!(LightClientBootstrapCapella, "LightClientBootstrap");
9497
type_name_generic!(LightClientBootstrapDeneb, "LightClientBootstrap");
9598
type_name_generic!(LightClientBootstrapElectra, "LightClientBootstrap");
99+
type_name_generic!(LightClientBootstrapFulu, "LightClientBootstrap");
96100
type_name_generic!(LightClientFinalityUpdate);
97101
type_name_generic!(LightClientFinalityUpdateAltair, "LightClientFinalityUpdate");
98102
type_name_generic!(
@@ -104,11 +108,13 @@ type_name_generic!(
104108
LightClientFinalityUpdateElectra,
105109
"LightClientFinalityUpdate"
106110
);
111+
type_name_generic!(LightClientFinalityUpdateFulu, "LightClientFinalityUpdate");
107112
type_name_generic!(LightClientHeader);
108113
type_name_generic!(LightClientHeaderAltair, "LightClientHeader");
109114
type_name_generic!(LightClientHeaderCapella, "LightClientHeader");
110115
type_name_generic!(LightClientHeaderDeneb, "LightClientHeader");
111116
type_name_generic!(LightClientHeaderElectra, "LightClientHeader");
117+
type_name_generic!(LightClientHeaderFulu, "LightClientHeader");
112118
type_name_generic!(LightClientOptimisticUpdate);
113119
type_name_generic!(
114120
LightClientOptimisticUpdateAltair,
@@ -126,11 +132,16 @@ type_name_generic!(
126132
LightClientOptimisticUpdateElectra,
127133
"LightClientOptimisticUpdate"
128134
);
135+
type_name_generic!(
136+
LightClientOptimisticUpdateFulu,
137+
"LightClientOptimisticUpdate"
138+
);
129139
type_name_generic!(LightClientUpdate);
130140
type_name_generic!(LightClientUpdateAltair, "LightClientUpdate");
131141
type_name_generic!(LightClientUpdateCapella, "LightClientUpdate");
132142
type_name_generic!(LightClientUpdateDeneb, "LightClientUpdate");
133143
type_name_generic!(LightClientUpdateElectra, "LightClientUpdate");
144+
type_name_generic!(LightClientUpdateFulu, "LightClientUpdate");
134145
type_name_generic!(PendingAttestation);
135146
type_name!(PendingConsolidation);
136147
type_name!(PendingPartialWithdrawal);

0 commit comments

Comments
 (0)