Use ForkName Ord in fork-choice tests

This commit is contained in:
dapplion
2024-06-17 17:58:38 +02:00
parent 795eff9bf4
commit 960f8c5c48

View File

@@ -179,42 +179,34 @@ impl<E: EthSpec> LoadCase for ForkChoiceTest<E> {
valid, valid,
}) })
} }
Step::Attestation { attestation } => match fork_name { Step::Attestation { attestation } => {
ForkName::Base if fork_name >= ForkName::Electra {
| ForkName::Altair ssz_decode_file(&path.join(format!("{}.ssz_snappy", attestation))).map(
| ForkName::Bellatrix |attestation| Step::Attestation {
| 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), attestation: Attestation::Electra(attestation),
}),
}, },
Step::AttesterSlashing { attester_slashing } => match fork_name { )
ForkName::Base } else {
| ForkName::Altair ssz_decode_file(&path.join(format!("{}.ssz_snappy", attestation))).map(
| ForkName::Bellatrix |attestation| Step::Attestation {
| ForkName::Capella attestation: Attestation::Base(attestation),
| ForkName::Deneb => { },
)
}
}
Step::AttesterSlashing { attester_slashing } => {
if fork_name >= ForkName::Electra {
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))) ssz_decode_file(&path.join(format!("{}.ssz_snappy", attester_slashing)))
.map(|attester_slashing| Step::AttesterSlashing { .map(|attester_slashing| Step::AttesterSlashing {
attester_slashing: AttesterSlashing::Base(attester_slashing), 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 } => { Step::PowBlock { pow_block } => {
ssz_decode_file(&path.join(format!("{}.ssz_snappy", pow_block))) ssz_decode_file(&path.join(format!("{}.ssz_snappy", pow_block)))
.map(|pow_block| Step::PowBlock { pow_block }) .map(|pow_block| Step::PowBlock { pow_block })