mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Merge branch 'beacon-api-electra' of https://github.com/sigp/lighthouse into ef-tests-electra
This commit is contained in:
@@ -131,7 +131,6 @@ pub struct ForkChoiceTest<E: EthSpec> {
|
||||
pub anchor_state: BeaconState<E>,
|
||||
pub anchor_block: BeaconBlock<E>,
|
||||
#[allow(clippy::type_complexity)]
|
||||
// TODO(electra): these tests will need to be updated to use new types
|
||||
pub steps: Vec<
|
||||
Step<SignedBeaconBlock<E>, BlobsList<E>, Attestation<E>, AttesterSlashing<E>, PowBlock>,
|
||||
>,
|
||||
@@ -180,42 +179,34 @@ impl<E: EthSpec> LoadCase for ForkChoiceTest<E> {
|
||||
valid,
|
||||
})
|
||||
}
|
||||
Step::Attestation { attestation } => match fork_name {
|
||||
ForkName::Base
|
||||
| ForkName::Altair
|
||||
| ForkName::Bellatrix
|
||||
| ForkName::Capella
|
||||
| ForkName::Deneb => ssz_decode_file(
|
||||
&path.join(format!("{}.ssz_snappy", attestation)),
|
||||
)
|
||||
.map(|attestation| Step::Attestation {
|
||||
attestation: Attestation::Base(attestation),
|
||||
}),
|
||||
ForkName::Electra => ssz_decode_file(
|
||||
&path.join(format!("{}.ssz_snappy", attestation)),
|
||||
)
|
||||
.map(|attestation| Step::Attestation {
|
||||
attestation: Attestation::Electra(attestation),
|
||||
}),
|
||||
},
|
||||
Step::AttesterSlashing { attester_slashing } => match fork_name {
|
||||
ForkName::Base
|
||||
| ForkName::Altair
|
||||
| ForkName::Bellatrix
|
||||
| ForkName::Capella
|
||||
| ForkName::Deneb => {
|
||||
Step::Attestation { attestation } => {
|
||||
if fork_name.electra_enabled() {
|
||||
ssz_decode_file(&path.join(format!("{}.ssz_snappy", attestation))).map(
|
||||
|attestation| Step::Attestation {
|
||||
attestation: Attestation::Electra(attestation),
|
||||
},
|
||||
)
|
||||
} else {
|
||||
ssz_decode_file(&path.join(format!("{}.ssz_snappy", attestation))).map(
|
||||
|attestation| Step::Attestation {
|
||||
attestation: Attestation::Base(attestation),
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
Step::AttesterSlashing { attester_slashing } => {
|
||||
if fork_name.electra_enabled() {
|
||||
ssz_decode_file(&path.join(format!("{}.ssz_snappy", attester_slashing)))
|
||||
.map(|attester_slashing| Step::AttesterSlashing {
|
||||
attester_slashing: AttesterSlashing::Electra(attester_slashing),
|
||||
})
|
||||
} else {
|
||||
ssz_decode_file(&path.join(format!("{}.ssz_snappy", attester_slashing)))
|
||||
.map(|attester_slashing| Step::AttesterSlashing {
|
||||
attester_slashing: AttesterSlashing::Base(attester_slashing),
|
||||
})
|
||||
}
|
||||
ForkName::Electra => {
|
||||
ssz_decode_file(&path.join(format!("{}.ssz_snappy", attester_slashing)))
|
||||
.map(|attester_slashing| Step::AttesterSlashing {
|
||||
attester_slashing: AttesterSlashing::Electra(attester_slashing),
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
Step::PowBlock { pow_block } => {
|
||||
ssz_decode_file(&path.join(format!("{}.ssz_snappy", pow_block)))
|
||||
.map(|pow_block| Step::PowBlock { pow_block })
|
||||
|
||||
@@ -247,7 +247,6 @@ mod ssz_static {
|
||||
PendingPartialWithdrawal, *,
|
||||
};
|
||||
|
||||
ssz_static_test!(attestation, Attestation<_>);
|
||||
ssz_static_test!(attestation_data, AttestationData);
|
||||
ssz_static_test!(beacon_block, SszStaticWithSpecHandler, BeaconBlock<_>);
|
||||
ssz_static_test!(beacon_block_header, BeaconBlockHeader);
|
||||
@@ -274,6 +273,16 @@ mod ssz_static {
|
||||
ssz_static_test!(validator, Validator);
|
||||
ssz_static_test!(voluntary_exit, VoluntaryExit);
|
||||
|
||||
#[test]
|
||||
fn attestation() {
|
||||
SszStaticHandler::<AttestationBase<MinimalEthSpec>, MinimalEthSpec>::pre_electra().run();
|
||||
SszStaticHandler::<AttestationBase<MainnetEthSpec>, MainnetEthSpec>::pre_electra().run();
|
||||
SszStaticHandler::<AttestationElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only()
|
||||
.run();
|
||||
SszStaticHandler::<AttestationElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only()
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn attester_slashing() {
|
||||
SszStaticHandler::<AttesterSlashingBase<MinimalEthSpec>, MinimalEthSpec>::pre_electra()
|
||||
|
||||
Reference in New Issue
Block a user