add new fields to execution payload and header

This commit is contained in:
realbigsean
2024-04-25 13:17:07 -04:00
parent 4a48d7b546
commit a80b94c88b
6 changed files with 26 additions and 0 deletions

View File

@@ -627,6 +627,9 @@ impl<E: EthSpec> ExecutionPayloadBodyV1<E> {
withdrawals,
blob_gas_used: header.blob_gas_used,
excess_blob_gas: header.excess_blob_gas,
// TODO(electra)
deposit_receipts: <_>::default(),
withdrawal_requests: <_>::default(),
}))
} else {
Err(format!(

View File

@@ -319,6 +319,9 @@ impl<E: EthSpec> From<JsonExecutionPayloadV4<E>> for ExecutionPayloadElectra<E>
.into(),
blob_gas_used: payload.blob_gas_used,
excess_blob_gas: payload.excess_blob_gas,
// TODO(electra)
deposit_receipts: Default::default(),
withdrawal_requests: Default::default(),
}
}
}

View File

@@ -2003,6 +2003,11 @@ impl<E: EthSpec> ExecutionLayer<E> {
withdrawals,
blob_gas_used: electra_block.blob_gas_used,
excess_blob_gas: electra_block.excess_blob_gas,
// TODO(elecrta)
// deposit_receipts: electra_block.deposit_receipts,
// withdrawal_requests: electra_block.withdrawal_requests,
deposit_receipts: <_>::default(),
withdrawal_requests: <_>::default(),
})
}
};

View File

@@ -659,6 +659,8 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
withdrawals: pa.withdrawals.clone().into(),
blob_gas_used: 0,
excess_blob_gas: 0,
deposit_receipts: vec![].into(),
withdrawal_requests: vec![].into(),
}),
_ => unreachable!(),
},

View File

@@ -89,6 +89,11 @@ pub struct ExecutionPayload<E: EthSpec> {
#[superstruct(only(Deneb, Electra), partial_getter(copy))]
#[serde(with = "serde_utils::quoted_u64")]
pub excess_blob_gas: u64,
#[superstruct(only(Electra))]
pub deposit_receipts: VariableList<DepositReceipt, E::MaxDepositReceiptsPerPayload>,
#[superstruct(only(Electra))]
pub withdrawal_requests:
VariableList<ExecutionLayerWithdrawalRequest, E::MaxWithdrawalRequestsPerPayload>,
}
impl<'a, E: EthSpec> ExecutionPayloadRef<'a, E> {

View File

@@ -88,6 +88,10 @@ pub struct ExecutionPayloadHeader<E: EthSpec> {
#[serde(with = "serde_utils::quoted_u64")]
#[superstruct(getter(copy))]
pub excess_blob_gas: u64,
#[superstruct(only(Electra), partial_getter(copy))]
pub deposit_receipts_root: Hash256,
#[superstruct(only(Electra), partial_getter(copy))]
pub withdrawal_requests_root: Hash256,
}
impl<E: EthSpec> ExecutionPayloadHeader<E> {
@@ -204,6 +208,8 @@ impl<E: EthSpec> ExecutionPayloadHeaderDeneb<E> {
withdrawals_root: self.withdrawals_root,
blob_gas_used: self.blob_gas_used,
excess_blob_gas: self.excess_blob_gas,
deposit_receipts_root: Hash256::zero(),
withdrawal_requests_root: Hash256::zero(),
}
}
}
@@ -295,6 +301,8 @@ impl<'a, E: EthSpec> From<&'a ExecutionPayloadElectra<E>> for ExecutionPayloadHe
withdrawals_root: payload.withdrawals.tree_hash_root(),
blob_gas_used: payload.blob_gas_used,
excess_blob_gas: payload.excess_blob_gas,
deposit_receipts_root: payload.deposit_receipts.tree_hash_root(),
withdrawal_requests_root: payload.withdrawal_requests.tree_hash_root(),
}
}
}