This commit is contained in:
Mac L
2024-05-02 16:06:28 +10:00
parent 689cdaef61
commit d9a0c3d6c2
10 changed files with 139 additions and 157 deletions

View File

@@ -743,6 +743,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
if let Ok(current_fork) = self.current_fork() {
current_fork.has_feature(feature)
} else {
// TODO(superstruct_features): Is this safe?
false
}
}
@@ -5574,13 +5575,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
None
};
//let parent_beacon_block_root = match prepare_slot_fork {
// ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => None,
// ForkName::Deneb | ForkName::Electra => {
// Some(pre_payload_attributes.parent_beacon_block_root)
// }
//};
let payload_attributes = PayloadAttributes::new(
self.slot_clock
.start_of(prepare_slot)
@@ -6616,17 +6610,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.fork_name(&self.spec)
.map_err(Error::InconsistentFork)?;
match fork_name {
ForkName::Altair
| ForkName::Bellatrix
| ForkName::Capella
| ForkName::Deneb
| ForkName::Electra => {
LightClientBootstrap::from_beacon_state(&mut state, &block, &self.spec)
.map(|bootstrap| Some((bootstrap, fork_name)))
.map_err(Error::LightClientError)
}
ForkName::Base => Err(Error::UnsupportedFork),
if fork_name.has_feature(FeatureName::Altair) {
LightClientBootstrap::from_beacon_state(&mut state, &block, &self.spec)
.map(|bootstrap| Some((bootstrap, fork_name)))
.map_err(Error::LightClientError)
} else {
Err(Error::UnsupportedFork)
}
}
}

View File

@@ -877,15 +877,12 @@ where
&self.spec,
));
let block_contents: SignedBlockContentsTuple<E> = match *signed_block {
SignedBeaconBlock::Base(_)
| SignedBeaconBlock::Altair(_)
| SignedBeaconBlock::Bellatrix(_)
| SignedBeaconBlock::Capella(_) => (signed_block, None),
SignedBeaconBlock::Deneb(_) | SignedBeaconBlock::Electra(_) => {
let block_contents: SignedBlockContentsTuple<E> =
if signed_block.has_feature(FeatureName::Deneb) {
(signed_block, block_response.blob_items)
}
};
} else {
(signed_block, None)
};
(block_contents, block_response.state)
}
@@ -941,15 +938,13 @@ where
&self.spec,
));
let block_contents: SignedBlockContentsTuple<E> = match *signed_block {
SignedBeaconBlock::Base(_)
| SignedBeaconBlock::Altair(_)
| SignedBeaconBlock::Bellatrix(_)
| SignedBeaconBlock::Capella(_) => (signed_block, None),
SignedBeaconBlock::Deneb(_) | SignedBeaconBlock::Electra(_) => {
let block_contents: SignedBlockContentsTuple<E> =
if signed_block.has_feature(FeatureName::Deneb) {
(signed_block, block_response.blob_items)
}
};
} else {
(signed_block, None)
};
(block_contents, pre_state)
}