mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 18:21:45 +00:00
Fix todos
This commit is contained in:
@@ -41,6 +41,8 @@ pub use new_payload_request::{
|
||||
NewPayloadRequestDeneb, NewPayloadRequestElectra,
|
||||
};
|
||||
|
||||
use self::json_structures::{JsonDepositRequest, JsonWithdrawalRequest};
|
||||
|
||||
pub const LATEST_TAG: &str = "latest";
|
||||
|
||||
pub type PayloadId = [u8; 8];
|
||||
@@ -64,6 +66,8 @@ pub enum Error {
|
||||
TransitionConfigurationMismatch,
|
||||
SszError(ssz_types::Error),
|
||||
DeserializeWithdrawals(ssz_types::Error),
|
||||
DeserializeDepositReceipts(ssz_types::Error),
|
||||
DeserializeWithdrawalRequests(ssz_types::Error),
|
||||
BuilderApi(builder_client::Error),
|
||||
IncorrectStateVariant,
|
||||
RequiredMethodUnsupported(&'static str),
|
||||
@@ -198,6 +202,10 @@ pub struct ExecutionBlockWithTransactions<E: EthSpec> {
|
||||
#[superstruct(only(Deneb, Electra))]
|
||||
#[serde(with = "serde_utils::u64_hex_be")]
|
||||
pub excess_blob_gas: u64,
|
||||
#[superstruct(only(Electra))]
|
||||
pub deposit_receipts: Vec<JsonDepositRequest>,
|
||||
#[superstruct(only(Electra))]
|
||||
pub withdrawal_requests: Vec<JsonWithdrawalRequest>,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> TryFrom<ExecutionPayload<E>> for ExecutionBlockWithTransactions<E> {
|
||||
@@ -305,6 +313,16 @@ impl<E: EthSpec> TryFrom<ExecutionPayload<E>> for ExecutionBlockWithTransactions
|
||||
.collect(),
|
||||
blob_gas_used: block.blob_gas_used,
|
||||
excess_blob_gas: block.excess_blob_gas,
|
||||
deposit_receipts: block
|
||||
.deposit_receipts
|
||||
.into_iter()
|
||||
.map(|deposit| deposit.into())
|
||||
.collect(),
|
||||
withdrawal_requests: block
|
||||
.withdrawal_requests
|
||||
.into_iter()
|
||||
.map(|withdrawal| withdrawal.into())
|
||||
.collect(),
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1985,6 +1985,22 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
.collect(),
|
||||
)
|
||||
.map_err(ApiError::DeserializeWithdrawals)?;
|
||||
let deposit_receipts = VariableList::new(
|
||||
electra_block
|
||||
.deposit_receipts
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect(),
|
||||
)
|
||||
.map_err(ApiError::DeserializeDepositReceipts)?;
|
||||
let withdrawal_requests = VariableList::new(
|
||||
electra_block
|
||||
.withdrawal_requests
|
||||
.into_iter()
|
||||
.map(Into::into)
|
||||
.collect(),
|
||||
)
|
||||
.map_err(ApiError::DeserializeWithdrawalRequests)?;
|
||||
ExecutionPayload::Electra(ExecutionPayloadElectra {
|
||||
parent_hash: electra_block.parent_hash,
|
||||
fee_recipient: electra_block.fee_recipient,
|
||||
@@ -2003,11 +2019,8 @@ impl<E: EthSpec> ExecutionLayer<E> {
|
||||
withdrawals,
|
||||
blob_gas_used: electra_block.blob_gas_used,
|
||||
excess_blob_gas: electra_block.excess_blob_gas,
|
||||
// TODO(electra)
|
||||
// deposit_receipts: electra_block.deposit_receipts,
|
||||
// withdrawal_requests: electra_block.withdrawal_requests,
|
||||
deposit_receipts: <_>::default(),
|
||||
withdrawal_requests: <_>::default(),
|
||||
deposit_receipts,
|
||||
withdrawal_requests,
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
@@ -117,7 +117,6 @@ impl<E: EthSpec> ExecutionPayloadHeader<E> {
|
||||
#[allow(clippy::arithmetic_side_effects)]
|
||||
pub fn ssz_max_var_len_for_fork(fork_name: ForkName) -> usize {
|
||||
// Matching here in case variable fields are added in future forks.
|
||||
// TODO(electra): review electra changes
|
||||
match fork_name {
|
||||
ForkName::Base
|
||||
| ForkName::Altair
|
||||
|
||||
Reference in New Issue
Block a user