Convert a FullPayload to a BlindedPayload correctly (#5005)

This commit is contained in:
Pawan Dhananjay 2023-12-14 05:44:14 -08:00 committed by GitHub
parent 189430a45c
commit ae4a296089
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 9 deletions

View File

@ -5167,8 +5167,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.try_into()
.map_err(|_| BlockProductionError::InvalidPayloadFork)?,
bls_to_execution_changes: bls_to_execution_changes.into(),
blob_kzg_commitments: kzg_commitments
.ok_or(BlockProductionError::InvalidPayloadFork)?,
blob_kzg_commitments: kzg_commitments.ok_or(
BlockProductionError::MissingKzgCommitment(
"Kzg commitments missing from block contents".to_string(),
),
)?,
},
}),
maybe_blobs_and_proofs,

View File

@ -176,15 +176,26 @@ impl<T: EthSpec> From<BlockProposalContents<T, FullPayload<T>>>
for BlockProposalContents<T, BlindedPayload<T>>
{
fn from(item: BlockProposalContents<T, FullPayload<T>>) -> Self {
let block_value = item.block_value().to_owned();
let blinded_payload: BlockProposalContents<T, BlindedPayload<T>> =
match item {
BlockProposalContents::Payload {
payload: item.to_payload().execution_payload().into(),
payload,
block_value,
};
blinded_payload
} => BlockProposalContents::Payload {
payload: payload.execution_payload().into(),
block_value,
},
BlockProposalContents::PayloadAndBlobs {
payload,
block_value,
kzg_commitments,
blobs_and_proofs: _,
} => BlockProposalContents::PayloadAndBlobs {
payload: payload.execution_payload().into(),
block_value,
kzg_commitments,
blobs_and_proofs: None,
},
}
}
}