mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 03:31:45 +00:00
* remove ensure_dir_exists (2 deps saved) * group UNHANDLED_ERRORs into a generic (2 deps saved) * Introduce separate `health_metrics` crate * separate health_metrics crate * remove metrics from warp_utils * move ProcessHealth::observe and SystemHealth::observe to health_metrics * fix errors * nitpick `Cargo.toml`s --------- Co-authored-by: Daniel Knopik <daniel@dknopik.de> # Conflicts: # Cargo.toml
46 lines
1.5 KiB
Rust
46 lines
1.5 KiB
Rust
use beacon_chain::{BeaconBlockResponse, BeaconBlockResponseWrapper, BlockProductionError};
|
|
use eth2::types::{BlockContents, FullBlockContents, ProduceBlockV3Response};
|
|
use types::{EthSpec, ForkName};
|
|
type Error = warp::reject::Rejection;
|
|
|
|
pub fn build_block_contents<E: EthSpec>(
|
|
fork_name: ForkName,
|
|
block_response: BeaconBlockResponseWrapper<E>,
|
|
) -> Result<ProduceBlockV3Response<E>, Error> {
|
|
match block_response {
|
|
BeaconBlockResponseWrapper::Blinded(block) => {
|
|
Ok(ProduceBlockV3Response::Blinded(block.block))
|
|
}
|
|
|
|
BeaconBlockResponseWrapper::Full(block) => {
|
|
if fork_name.deneb_enabled() {
|
|
let BeaconBlockResponse {
|
|
block,
|
|
state: _,
|
|
blob_items,
|
|
execution_payload_value: _,
|
|
consensus_block_value: _,
|
|
} = block;
|
|
|
|
let Some((kzg_proofs, blobs)) = blob_items else {
|
|
return Err(warp_utils::reject::unhandled_error(
|
|
BlockProductionError::MissingBlobs,
|
|
));
|
|
};
|
|
|
|
Ok(ProduceBlockV3Response::Full(
|
|
FullBlockContents::BlockContents(BlockContents {
|
|
block,
|
|
kzg_proofs,
|
|
blobs,
|
|
}),
|
|
))
|
|
} else {
|
|
Ok(ProduceBlockV3Response::Full(FullBlockContents::Block(
|
|
block.block,
|
|
)))
|
|
}
|
|
}
|
|
}
|
|
}
|