mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
EIP7549 get_attestation_indices (#5657)
* get attesting indices electra impl * fmt * get tests to pass * fmt * fix some beacon chain tests * fmt * fix slasher test * fmt got me again * fix more tests * fix tests
This commit is contained in:
@@ -229,6 +229,10 @@ impl<T, E> SszStaticHandler<T, E> {
|
||||
Self::for_forks(vec![ForkName::Deneb])
|
||||
}
|
||||
|
||||
pub fn electra_only() -> Self {
|
||||
Self::for_forks(vec![ForkName::Electra])
|
||||
}
|
||||
|
||||
pub fn altair_and_later() -> Self {
|
||||
Self::for_forks(ForkName::list_all()[1..].to_vec())
|
||||
}
|
||||
@@ -240,6 +244,10 @@ impl<T, E> SszStaticHandler<T, E> {
|
||||
pub fn capella_and_later() -> Self {
|
||||
Self::for_forks(ForkName::list_all()[3..].to_vec())
|
||||
}
|
||||
|
||||
pub fn pre_electra() -> Self {
|
||||
Self::for_forks(ForkName::list_all()[0..5].to_vec())
|
||||
}
|
||||
}
|
||||
|
||||
/// Handler for SSZ types that implement `CachedTreeHash`.
|
||||
|
||||
@@ -37,11 +37,14 @@ macro_rules! type_name_generic {
|
||||
|
||||
type_name!(MinimalEthSpec, "minimal");
|
||||
type_name!(MainnetEthSpec, "mainnet");
|
||||
|
||||
type_name_generic!(AggregateAndProof);
|
||||
type_name_generic!(AggregateAndProofBase, "AggregateAndProof");
|
||||
type_name_generic!(AggregateAndProofElectra, "AggregateAndProof");
|
||||
type_name_generic!(Attestation);
|
||||
type_name!(AttestationData);
|
||||
type_name_generic!(AttesterSlashing);
|
||||
type_name_generic!(AttesterSlashingBase, "AttesterSlashing");
|
||||
type_name_generic!(AttesterSlashingElectra, "AttesterSlashing");
|
||||
type_name_generic!(BeaconBlock);
|
||||
type_name_generic!(BeaconBlockBody);
|
||||
type_name_generic!(BeaconBlockBodyBase, "BeaconBlockBody");
|
||||
@@ -108,6 +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!(SignedBeaconBlock);
|
||||
type_name!(SignedBeaconBlockHeader);
|
||||
type_name_generic!(SignedContributionAndProof);
|
||||
|
||||
@@ -217,12 +217,11 @@ mod ssz_static {
|
||||
use ef_tests::{Handler, SszStaticHandler, SszStaticTHCHandler, SszStaticWithSpecHandler};
|
||||
use types::blob_sidecar::BlobIdentifier;
|
||||
use types::historical_summary::HistoricalSummary;
|
||||
use types::{LightClientBootstrapAltair, *};
|
||||
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!(attester_slashing, AttesterSlashing<_>);
|
||||
ssz_static_test!(beacon_block, SszStaticWithSpecHandler, BeaconBlock<_>);
|
||||
ssz_static_test!(beacon_block_header, BeaconBlockHeader);
|
||||
ssz_static_test!(beacon_state, SszStaticTHCHandler, BeaconState<_>);
|
||||
@@ -238,7 +237,6 @@ mod ssz_static {
|
||||
ssz_static_test!(indexed_attestation, IndexedAttestation<_>);
|
||||
ssz_static_test!(pending_attestation, PendingAttestation<_>);
|
||||
ssz_static_test!(proposer_slashing, ProposerSlashing);
|
||||
ssz_static_test!(signed_aggregate_and_proof, SignedAggregateAndProof<_>);
|
||||
ssz_static_test!(
|
||||
signed_beacon_block,
|
||||
SszStaticWithSpecHandler,
|
||||
@@ -249,6 +247,24 @@ mod ssz_static {
|
||||
ssz_static_test!(signing_data, SigningData);
|
||||
ssz_static_test!(validator, Validator);
|
||||
ssz_static_test!(voluntary_exit, VoluntaryExit);
|
||||
|
||||
|
||||
#[test]
|
||||
fn signed_aggregate_and_proof() {
|
||||
SszStaticHandler::<AttesterSlashingBase<MinimalEthSpec>, MinimalEthSpec>::pre_electra(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<AttesterSlashingBase<MainnetEthSpec>, MainnetEthSpec>::pre_electra(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<AttesterSlashingElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<AttesterSlashingElectra<MainnetEthSpec>, 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() {
|
||||
@@ -272,6 +288,22 @@ mod ssz_static {
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn signed_aggregate_and_proof() {
|
||||
SszStaticHandler::<SignedAggregateAndProofBase<MinimalEthSpec>, MinimalEthSpec>::pre_electra(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<SignedAggregateAndProofBase<MainnetEthSpec>, MainnetEthSpec>::pre_electra(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<SignedAggregateAndProofElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<SignedAggregateAndProofElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
// Altair and later
|
||||
#[test]
|
||||
fn contribution_and_proof() {
|
||||
|
||||
Reference in New Issue
Block a user