From f8c9adcd60735395718c0d1399f9bc70bb41b2e8 Mon Sep 17 00:00:00 2001 From: realbigsean Date: Thu, 9 May 2024 13:34:47 -0400 Subject: [PATCH 1/2] attestation related ef test fixes --- testing/ef_tests/src/cases/ssz_static.rs | 33 ++++++++++++++++ testing/ef_tests/src/type_name.rs | 7 +--- testing/ef_tests/tests/tests.rs | 49 +++++++++++++++--------- 3 files changed, 66 insertions(+), 23 deletions(-) diff --git a/testing/ef_tests/src/cases/ssz_static.rs b/testing/ef_tests/src/cases/ssz_static.rs index 5f0ac3525c4..3076d2f4e46 100644 --- a/testing/ef_tests/src/cases/ssz_static.rs +++ b/testing/ef_tests/src/cases/ssz_static.rs @@ -146,3 +146,36 @@ impl Case for SszStaticWithSpec> { Ok(()) } } + +// impl Case for SszStaticWithSpec> { +// fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> { +// let spec = &testing_spec::(fork_name); +// check_serialization(&self.value, &self.serialized, |bytes| { +// SignedBeaconBlock::from_ssz_bytes(bytes, spec) +// })?; +// check_tree_hash(&self.roots.root, self.value.tree_hash_root().as_bytes())?; +// Ok(()) +// } +// } + +// impl Case for SszStaticWithSpec> { +// fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> { +// let spec = &testing_spec::(fork_name); +// check_serialization(&self.value, &self.serialized, |bytes| { +// SignedBeaconBlock::from_ssz_bytes(bytes, spec) +// })?; +// check_tree_hash(&self.roots.root, self.value.tree_hash_root().as_bytes())?; +// Ok(()) +// } +// } + +// impl Case for SszStaticWithSpec> { +// fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> { +// let spec = &testing_spec::(fork_name); +// check_serialization(&self.value, &self.serialized, |bytes| { +// SignedBeaconBlock::from_ssz_bytes(bytes, spec) +// })?; +// check_tree_hash(&self.roots.root, self.value.tree_hash_root().as_bytes())?; +// Ok(()) +// } +// } diff --git a/testing/ef_tests/src/type_name.rs b/testing/ef_tests/src/type_name.rs index 30db5c0e4a9..cbea78dabfc 100644 --- a/testing/ef_tests/src/type_name.rs +++ b/testing/ef_tests/src/type_name.rs @@ -111,11 +111,8 @@ type_name_generic!(LightClientUpdateDeneb, "LightClientUpdate"); type_name_generic!(PendingAttestation); type_name!(ProposerSlashing); type_name_generic!(SignedAggregateAndProof); -type_name_generic!(SignedAggregateAndProofBase, "SignedAggregateAndProofBase"); -type_name_generic!( - SignedAggregateAndProofElectra, - "SignedAggregateAndProofElectra" -); +type_name_generic!(SignedAggregateAndProofBase, "SignedAggregateAndProof"); +type_name_generic!(SignedAggregateAndProofElectra, "SignedAggregateAndProof"); type_name_generic!(SignedBeaconBlock); type_name!(SignedBeaconBlockHeader); type_name_generic!(SignedContributionAndProof); diff --git a/testing/ef_tests/tests/tests.rs b/testing/ef_tests/tests/tests.rs index 85d9362aaeb..fb8bdfcae71 100644 --- a/testing/ef_tests/tests/tests.rs +++ b/testing/ef_tests/tests/tests.rs @@ -219,7 +219,6 @@ mod ssz_static { use types::historical_summary::HistoricalSummary; use types::{AttesterSlashingBase, AttesterSlashingElectra, LightClientBootstrapAltair, *}; - ssz_static_test!(aggregate_and_proof, AggregateAndProof<_>); ssz_static_test!(attestation, Attestation<_>); ssz_static_test!(attestation_data, AttestationData); ssz_static_test!(beacon_block, SszStaticWithSpecHandler, BeaconBlock<_>); @@ -249,7 +248,7 @@ mod ssz_static { ssz_static_test!(voluntary_exit, VoluntaryExit); #[test] - fn signed_aggregate_and_proof() { + fn attester_slashing() { SszStaticHandler::, MinimalEthSpec>::pre_electra() .run(); SszStaticHandler::, MainnetEthSpec>::pre_electra() @@ -260,6 +259,36 @@ mod ssz_static { .run(); } + #[test] + fn signed_aggregate_and_proof() { + SszStaticHandler::, MinimalEthSpec>::pre_electra( + ) + .run(); + SszStaticHandler::, MainnetEthSpec>::pre_electra( + ) + .run(); + SszStaticHandler::, MinimalEthSpec>::electra_only( + ) + .run(); + SszStaticHandler::, MainnetEthSpec>::electra_only( + ) + .run(); + } + + #[test] + fn aggregate_and_proof() { + SszStaticHandler::, MinimalEthSpec>::pre_electra() + .run(); + SszStaticHandler::, MainnetEthSpec>::pre_electra() + .run(); + SszStaticHandler::, MinimalEthSpec>::electra_only( + ) + .run(); + SszStaticHandler::, MainnetEthSpec>::electra_only( + ) + .run(); + } + // BeaconBlockBody has no internal indicator of which fork it is for, so we test it separately. #[test] fn beacon_block_body() { @@ -283,22 +312,6 @@ mod ssz_static { .run(); } - #[test] - fn signed_aggregate_and_proof() { - SszStaticHandler::, MinimalEthSpec>::pre_electra( - ) - .run(); - SszStaticHandler::, MainnetEthSpec>::pre_electra( - ) - .run(); - SszStaticHandler::, MinimalEthSpec>::electra_only( - ) - .run(); - SszStaticHandler::, MainnetEthSpec>::electra_only( - ) - .run(); - } - // Altair and later #[test] fn contribution_and_proof() { From c56e3b2c6fc7fbdf7532740aea73bcbd0a3a0faf Mon Sep 17 00:00:00 2001 From: realbigsean Date: Thu, 9 May 2024 13:36:19 -0400 Subject: [PATCH 2/2] delete commented out stuff --- testing/ef_tests/src/cases/ssz_static.rs | 33 ------------------------ 1 file changed, 33 deletions(-) diff --git a/testing/ef_tests/src/cases/ssz_static.rs b/testing/ef_tests/src/cases/ssz_static.rs index 3076d2f4e46..5f0ac3525c4 100644 --- a/testing/ef_tests/src/cases/ssz_static.rs +++ b/testing/ef_tests/src/cases/ssz_static.rs @@ -146,36 +146,3 @@ impl Case for SszStaticWithSpec> { Ok(()) } } - -// impl Case for SszStaticWithSpec> { -// fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> { -// let spec = &testing_spec::(fork_name); -// check_serialization(&self.value, &self.serialized, |bytes| { -// SignedBeaconBlock::from_ssz_bytes(bytes, spec) -// })?; -// check_tree_hash(&self.roots.root, self.value.tree_hash_root().as_bytes())?; -// Ok(()) -// } -// } - -// impl Case for SszStaticWithSpec> { -// fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> { -// let spec = &testing_spec::(fork_name); -// check_serialization(&self.value, &self.serialized, |bytes| { -// SignedBeaconBlock::from_ssz_bytes(bytes, spec) -// })?; -// check_tree_hash(&self.roots.root, self.value.tree_hash_root().as_bytes())?; -// Ok(()) -// } -// } - -// impl Case for SszStaticWithSpec> { -// fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> { -// let spec = &testing_spec::(fork_name); -// check_serialization(&self.value, &self.serialized, |bytes| { -// SignedBeaconBlock::from_ssz_bytes(bytes, spec) -// })?; -// check_tree_hash(&self.roots.root, self.value.tree_hash_root().as_bytes())?; -// Ok(()) -// } -// }