implement From<FullPayload> for Payload

This commit is contained in:
Daniel Knopik 2022-09-17 13:29:20 +02:00
parent fe6be28e6b
commit dcfae6c5cf
2 changed files with 9 additions and 1 deletions

View File

@ -99,6 +99,7 @@ use types::*;
pub use crate::canonical_head::{CanonicalHead, CanonicalHeadRwLock}; pub use crate::canonical_head::{CanonicalHead, CanonicalHeadRwLock};
pub use fork_choice::CountUnrealized; pub use fork_choice::CountUnrealized;
use types::kzg_commitment::KzgCommitment;
pub type ForkChoiceError = fork_choice::Error<crate::ForkChoiceStoreError>; pub type ForkChoiceError = fork_choice::Error<crate::ForkChoiceStoreError>;
@ -3627,7 +3628,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.ok_or(BlockProductionError::MissingSyncAggregate)?, .ok_or(BlockProductionError::MissingSyncAggregate)?,
execution_payload: execution_payload execution_payload: execution_payload
.ok_or(BlockProductionError::MissingExecutionPayload)?, .ok_or(BlockProductionError::MissingExecutionPayload)?,
blob_kzg_commitments: todo!(), // part of partial block or?? blob_kzg_commitments: blob_kzg_commitments.into(),
}, },
}), }),
}; };

View File

@ -32,6 +32,7 @@ pub trait ExecPayload<T: EthSpec>:
+ Hash + Hash
+ TryFrom<ExecutionPayloadHeader<T>> + TryFrom<ExecutionPayloadHeader<T>>
+ From<ExecutionPayload<T>> + From<ExecutionPayload<T>>
+ From<FullPayload<T>>
+ Send + Send
+ 'static + 'static
{ {
@ -172,6 +173,12 @@ impl<T: EthSpec> From<ExecutionPayload<T>> for BlindedPayload<T> {
} }
} }
impl<T: EthSpec> From<FullPayload<T>> for BlindedPayload<T> {
fn from(full_payload: FullPayload<T>) -> Self {
full_payload.execution_payload.into()
}
}
impl<T: EthSpec> TreeHash for BlindedPayload<T> { impl<T: EthSpec> TreeHash for BlindedPayload<T> {
fn tree_hash_type() -> tree_hash::TreeHashType { fn tree_hash_type() -> tree_hash::TreeHashType {
<ExecutionPayloadHeader<T>>::tree_hash_type() <ExecutionPayloadHeader<T>>::tree_hash_type()