mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 05:18:30 +00:00
Rename to has_feature
This commit is contained in:
@@ -18,7 +18,7 @@ use tree_hash_derive::TreeHash;
|
||||
feature_type(
|
||||
name = "FeatureName",
|
||||
list = "list_all_features",
|
||||
check = "is_feature_enabled"
|
||||
check = "has_feature"
|
||||
),
|
||||
variant_attributes(
|
||||
derive(
|
||||
|
||||
@@ -35,7 +35,7 @@ pub const BLOB_KZG_COMMITMENTS_INDEX: usize = 11;
|
||||
feature_type(
|
||||
name = "FeatureName",
|
||||
list = "list_all_features",
|
||||
check = "is_feature_enabled"
|
||||
check = "has_feature"
|
||||
),
|
||||
variant_attributes(
|
||||
derive(
|
||||
|
||||
@@ -212,7 +212,7 @@ impl From<BeaconStateHash> for Hash256 {
|
||||
feature_type(
|
||||
name = "FeatureName",
|
||||
list = "list_all_features",
|
||||
check = "is_feature_enabled"
|
||||
check = "has_feature"
|
||||
),
|
||||
variant_attributes(
|
||||
derive(
|
||||
|
||||
@@ -19,7 +19,7 @@ use tree_hash_derive::TreeHash;
|
||||
feature_type(
|
||||
name = "FeatureName",
|
||||
list = "list_all_features",
|
||||
check = "is_feature_enabled"
|
||||
check = "has_feature"
|
||||
),
|
||||
variant_attributes(
|
||||
derive(PartialEq, Debug, Serialize, Deserialize, TreeHash, Clone),
|
||||
|
||||
@@ -338,9 +338,9 @@ impl ChainSpec {
|
||||
|
||||
pub fn inactivity_penalty_quotient_for_fork(&self, fork_name: ForkName) -> u64 {
|
||||
// TODO(superstruct_features) Is this a better pattern?
|
||||
if fork_name.is_feature_enabled(FeatureName::Bellatrix) {
|
||||
if fork_name.has_feature(FeatureName::Bellatrix) {
|
||||
self.inactivity_penalty_quotient_bellatrix
|
||||
} else if fork_name.is_feature_enabled(FeatureName::Altair) {
|
||||
} else if fork_name.has_feature(FeatureName::Altair) {
|
||||
self.inactivity_penalty_quotient_altair
|
||||
} else {
|
||||
self.inactivity_penalty_quotient
|
||||
@@ -353,9 +353,9 @@ impl ChainSpec {
|
||||
state: &BeaconState<E>,
|
||||
) -> u64 {
|
||||
let fork_name = state.fork_name_unchecked();
|
||||
if fork_name >= ForkName::Bellatrix {
|
||||
if fork_name.has_feature(FeatureName::Bellatrix) {
|
||||
self.proportional_slashing_multiplier_bellatrix
|
||||
} else if fork_name >= ForkName::Altair {
|
||||
} else if fork_name.has_feature(FeatureName::Altair) {
|
||||
self.proportional_slashing_multiplier_altair
|
||||
} else {
|
||||
self.proportional_slashing_multiplier
|
||||
@@ -368,11 +368,11 @@ impl ChainSpec {
|
||||
state: &BeaconState<E>,
|
||||
) -> u64 {
|
||||
let fork_name = state.fork_name_unchecked();
|
||||
if fork_name >= ForkName::Electra {
|
||||
if fork_name.has_feature(FeatureName::Electra) {
|
||||
self.min_slashing_penalty_quotient_electra
|
||||
} else if fork_name >= ForkName::Bellatrix {
|
||||
} else if fork_name.has_feature(FeatureName::Bellatrix) {
|
||||
self.min_slashing_penalty_quotient_bellatrix
|
||||
} else if fork_name >= ForkName::Altair {
|
||||
} else if fork_name.has_feature(FeatureName::Altair) {
|
||||
self.min_slashing_penalty_quotient_altair
|
||||
} else {
|
||||
self.min_slashing_penalty_quotient
|
||||
@@ -538,7 +538,7 @@ impl ChainSpec {
|
||||
}
|
||||
|
||||
pub fn max_blocks_by_root_request(&self, fork_name: ForkName) -> usize {
|
||||
if fork_name >= ForkName::Deneb {
|
||||
if fork_name.has_feature(FeatureName::Deneb) {
|
||||
self.max_blocks_by_root_request_deneb
|
||||
} else {
|
||||
self.max_blocks_by_root_request
|
||||
@@ -546,7 +546,7 @@ impl ChainSpec {
|
||||
}
|
||||
|
||||
pub fn max_request_blocks(&self, fork_name: ForkName) -> usize {
|
||||
if fork_name >= ForkName::Deneb {
|
||||
if fork_name.has_feature(FeatureName::Deneb) {
|
||||
self.max_request_blocks_deneb as usize
|
||||
} else {
|
||||
self.max_request_blocks as usize
|
||||
|
||||
@@ -19,7 +19,7 @@ use superstruct::superstruct;
|
||||
feature_type(
|
||||
name = "FeatureName",
|
||||
list = "list_all_features",
|
||||
check = "is_feature_enabled"
|
||||
check = "has_feature"
|
||||
),
|
||||
variant_attributes(derive(Serialize, Deserialize, Debug, PartialEq, Clone))
|
||||
)]
|
||||
|
||||
@@ -22,7 +22,7 @@ pub type Withdrawals<E> = VariableList<Withdrawal, <E as EthSpec>::MaxWithdrawal
|
||||
feature_type(
|
||||
name = "FeatureName",
|
||||
list = "list_all_features",
|
||||
check = "is_feature_enabled"
|
||||
check = "has_feature"
|
||||
),
|
||||
variant_attributes(
|
||||
derive(
|
||||
|
||||
@@ -15,7 +15,7 @@ use tree_hash_derive::TreeHash;
|
||||
feature_type(
|
||||
name = "FeatureName",
|
||||
list = "list_all_features",
|
||||
check = "is_feature_enabled"
|
||||
check = "has_feature"
|
||||
),
|
||||
variant_attributes(
|
||||
derive(
|
||||
|
||||
@@ -59,7 +59,7 @@ impl ForkName {
|
||||
res
|
||||
}
|
||||
|
||||
pub fn is_feature_enabled(self, feature: FeatureName) -> bool {
|
||||
pub fn has_feature(self, feature: FeatureName) -> bool {
|
||||
self.list_all_enabled_features().contains(&feature)
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ use tree_hash_derive::TreeHash;
|
||||
feature_type(
|
||||
name = "FeatureName",
|
||||
list = "list_all_features",
|
||||
check = "is_feature_enabled"
|
||||
check = "has_feature"
|
||||
),
|
||||
variant_attributes(
|
||||
derive(
|
||||
|
||||
@@ -117,7 +117,7 @@ pub trait AbstractExecPayload<E: EthSpec>:
|
||||
feature_type(
|
||||
name = "FeatureName",
|
||||
list = "list_all_features",
|
||||
check = "is_feature_enabled"
|
||||
check = "has_feature"
|
||||
),
|
||||
variant_attributes(
|
||||
derive(
|
||||
@@ -462,7 +462,7 @@ impl<E: EthSpec> TryFrom<ExecutionPayloadHeader<E>> for FullPayload<E> {
|
||||
feature_type(
|
||||
name = "FeatureName",
|
||||
list = "list_all_features",
|
||||
check = "is_feature_enabled"
|
||||
check = "has_feature"
|
||||
),
|
||||
variant_attributes(
|
||||
derive(
|
||||
|
||||
@@ -42,7 +42,7 @@ impl VoluntaryExit {
|
||||
) -> SignedVoluntaryExit {
|
||||
let fork_name = spec.fork_name_at_epoch(self.epoch);
|
||||
// EIP-7044
|
||||
let fork_version = if fork_name.is_feature_enabled(FeatureName::Deneb) {
|
||||
let fork_version = if fork_name.has_feature(FeatureName::Deneb) {
|
||||
spec.fork_version_for_name(ForkName::Capella)
|
||||
} else {
|
||||
spec.fork_version_for_name(fork_name)
|
||||
|
||||
Reference in New Issue
Block a user