Skip to content

Commit

Permalink
Use ForkName Ord in fork-choice tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Jun 17, 2024
1 parent a375a62 commit 31057eb
Showing 1 changed file with 21 additions and 29 deletions.
50 changes: 21 additions & 29 deletions testing/ef_tests/src/cases/fork_choice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,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 >= ForkName::Electra {
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 >= ForkName::Electra {
ssz_decode_file(&path.join(format!("{}.ssz_snappy", attester_slashing)))
.map(|attester_slashing| Step::AttesterSlashing {
attester_slashing: AttesterSlashing::Base(attester_slashing),
attester_slashing: AttesterSlashing::Electra(attester_slashing),
})
}
ForkName::Electra => {
} else {
ssz_decode_file(&path.join(format!("{}.ssz_snappy", attester_slashing)))
.map(|attester_slashing| Step::AttesterSlashing {
attester_slashing: AttesterSlashing::Electra(attester_slashing),
attester_slashing: AttesterSlashing::Base(attester_slashing),
})
}
},
}
Step::PowBlock { pow_block } => {
ssz_decode_file(&path.join(format!("{}.ssz_snappy", pow_block)))
.map(|pow_block| Step::PowBlock { pow_block })
Expand Down

0 comments on commit 31057eb

Please sign in to comment.