mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 22:34:45 +00:00
Add {fork_name}_enabled functions (#5951)
* add fork_name_enabled fn to Forkname impl * refactor codebase to use new fork_enabled fn * fmt * Merge branch 'unstable' of https://github.com/sigp/lighthouse into fork-ord-impl * small code cleanup * resolve merge conflicts * fix beacon chain test * merge conflicts * fix ef test issue * resolve merge conflicts
This commit is contained in:
@@ -359,22 +359,24 @@ impl GossipTester {
|
||||
}
|
||||
|
||||
pub fn earliest_valid_attestation_slot(&self) -> Slot {
|
||||
let offset = match self.harness.spec.fork_name_at_epoch(self.epoch()) {
|
||||
ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => {
|
||||
// Subtract an additional slot since the harness will be exactly on the start of the
|
||||
// slot and the propagation tolerance will allow an extra slot.
|
||||
E::slots_per_epoch() + 1
|
||||
}
|
||||
let offset = if self
|
||||
.harness
|
||||
.spec
|
||||
.fork_name_at_epoch(self.epoch())
|
||||
.deneb_enabled()
|
||||
{
|
||||
// EIP-7045
|
||||
ForkName::Deneb | ForkName::Electra => {
|
||||
let epoch_slot_offset = (self.slot() % E::slots_per_epoch()).as_u64();
|
||||
if epoch_slot_offset != 0 {
|
||||
E::slots_per_epoch() + epoch_slot_offset
|
||||
} else {
|
||||
// Here the propagation tolerance will cause the cutoff to be an entire epoch earlier
|
||||
2 * E::slots_per_epoch()
|
||||
}
|
||||
let epoch_slot_offset = (self.slot() % E::slots_per_epoch()).as_u64();
|
||||
if epoch_slot_offset != 0 {
|
||||
E::slots_per_epoch() + epoch_slot_offset
|
||||
} else {
|
||||
// Here the propagation tolerance will cause the cutoff to be an entire epoch earlier
|
||||
2 * E::slots_per_epoch()
|
||||
}
|
||||
} else {
|
||||
// Subtract an additional slot since the harness will be exactly on the start of the
|
||||
// slot and the propagation tolerance will allow an extra slot.
|
||||
E::slots_per_epoch() + 1
|
||||
};
|
||||
|
||||
self.slot()
|
||||
|
||||
Reference in New Issue
Block a user