mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +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:
@@ -11,11 +11,9 @@ pub fn build_block_contents<E: EthSpec>(
|
||||
BeaconBlockResponseWrapper::Blinded(block) => {
|
||||
Ok(ProduceBlockV3Response::Blinded(block.block))
|
||||
}
|
||||
BeaconBlockResponseWrapper::Full(block) => match fork_name {
|
||||
ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => Ok(
|
||||
ProduceBlockV3Response::Full(FullBlockContents::Block(block.block)),
|
||||
),
|
||||
ForkName::Deneb | ForkName::Electra => {
|
||||
|
||||
BeaconBlockResponseWrapper::Full(block) => {
|
||||
if fork_name.deneb_enabled() {
|
||||
let BeaconBlockResponse {
|
||||
block,
|
||||
state: _,
|
||||
@@ -37,7 +35,11 @@ pub fn build_block_contents<E: EthSpec>(
|
||||
blobs,
|
||||
}),
|
||||
))
|
||||
} else {
|
||||
Ok(ProduceBlockV3Response::Full(FullBlockContents::Block(
|
||||
block.block,
|
||||
)))
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ use safe_arith::SafeArith;
|
||||
use state_processing::per_block_processing::get_expected_withdrawals;
|
||||
use state_processing::state_advance::partial_state_advance;
|
||||
use std::sync::Arc;
|
||||
use types::{BeaconState, EthSpec, ForkName, Slot, Withdrawals};
|
||||
use types::{BeaconState, EthSpec, Slot, Withdrawals};
|
||||
|
||||
const MAX_EPOCH_LOOKAHEAD: u64 = 2;
|
||||
|
||||
@@ -53,7 +53,8 @@ fn get_next_withdrawals_sanity_checks<T: BeaconChainTypes>(
|
||||
}
|
||||
|
||||
let fork = chain.spec.fork_name_at_slot::<T::EthSpec>(proposal_slot);
|
||||
if let ForkName::Base | ForkName::Altair | ForkName::Bellatrix = fork {
|
||||
|
||||
if !fork.capella_enabled() {
|
||||
return Err(warp_utils::reject::custom_bad_request(
|
||||
"the specified state is a pre-capella state.".to_string(),
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user