mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
add electra fork enabled fn to ForkName impl (#36)
* add electra fork enabled fn to ForkName impl * remove inadvertent file
This commit is contained in:
committed by
dapplion
parent
9e84779522
commit
7af3f2eb35
@@ -1,5 +1,4 @@
|
||||
use crate::slot_data::SlotData;
|
||||
use crate::ForkName;
|
||||
use crate::{test_utils::TestRandom, Hash256, Slot};
|
||||
use derivative::Derivative;
|
||||
use safe_arith::ArithError;
|
||||
@@ -95,7 +94,7 @@ impl<E: EthSpec> Attestation<E> {
|
||||
data: AttestationData,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<Self, Error> {
|
||||
if spec.fork_name_at_slot::<E>(data.slot) >= ForkName::Electra {
|
||||
if spec.fork_name_at_slot::<E>(data.slot).electra_enabled() {
|
||||
let mut committee_bits: BitVector<E::MaxCommitteesPerSlot> = BitVector::default();
|
||||
committee_bits
|
||||
.set(committee_index, true)
|
||||
|
||||
@@ -376,7 +376,7 @@ impl ChainSpec {
|
||||
state: &BeaconState<E>,
|
||||
) -> u64 {
|
||||
let fork_name = state.fork_name_unchecked();
|
||||
if fork_name >= ForkName::Electra {
|
||||
if fork_name.electra_enabled() {
|
||||
self.min_slashing_penalty_quotient_electra
|
||||
} else if fork_name >= ForkName::Bellatrix {
|
||||
self.min_slashing_penalty_quotient_bellatrix
|
||||
|
||||
@@ -119,6 +119,10 @@ impl ForkName {
|
||||
ForkName::Electra => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn electra_enabled(self) -> bool {
|
||||
self >= ForkName::Electra
|
||||
}
|
||||
}
|
||||
|
||||
/// Map a fork name into a fork-versioned superstruct type like `BeaconBlock`.
|
||||
|
||||
@@ -63,7 +63,7 @@ impl Validator {
|
||||
spec: &ChainSpec,
|
||||
current_fork: ForkName,
|
||||
) -> bool {
|
||||
if current_fork >= ForkName::Electra {
|
||||
if current_fork.electra_enabled() {
|
||||
self.is_eligible_for_activation_queue_electra(spec)
|
||||
} else {
|
||||
self.is_eligible_for_activation_queue_base(spec)
|
||||
@@ -162,7 +162,7 @@ impl Validator {
|
||||
spec: &ChainSpec,
|
||||
current_fork: ForkName,
|
||||
) -> bool {
|
||||
if current_fork >= ForkName::Electra {
|
||||
if current_fork.electra_enabled() {
|
||||
self.is_fully_withdrawable_at_electra(balance, epoch, spec)
|
||||
} else {
|
||||
self.is_fully_withdrawable_at_capella(balance, epoch, spec)
|
||||
@@ -202,7 +202,7 @@ impl Validator {
|
||||
spec: &ChainSpec,
|
||||
current_fork: ForkName,
|
||||
) -> bool {
|
||||
if current_fork >= ForkName::Electra {
|
||||
if current_fork.electra_enabled() {
|
||||
self.is_partially_withdrawable_validator_electra(balance, spec)
|
||||
} else {
|
||||
self.is_partially_withdrawable_validator_capella(balance, spec)
|
||||
|
||||
Reference in New Issue
Block a user