mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 12:58:31 +00:00
add data gas used and update excess data gas to u64
This commit is contained in:
@@ -26,6 +26,7 @@ use metastruct::metastruct;
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
#[metastruct(mappings(map_execution_block_header_fields_except_withdrawals(exclude(
|
||||
withdrawals_root,
|
||||
data_gas_used,
|
||||
excess_data_gas
|
||||
)),))]
|
||||
pub struct ExecutionBlockHeader {
|
||||
@@ -46,7 +47,8 @@ pub struct ExecutionBlockHeader {
|
||||
pub nonce: Hash64,
|
||||
pub base_fee_per_gas: Uint256,
|
||||
pub withdrawals_root: Option<Hash256>,
|
||||
pub excess_data_gas: Option<Uint256>,
|
||||
pub data_gas_used: Option<u64>,
|
||||
pub excess_data_gas: Option<u64>,
|
||||
}
|
||||
|
||||
impl ExecutionBlockHeader {
|
||||
@@ -55,7 +57,8 @@ impl ExecutionBlockHeader {
|
||||
rlp_empty_list_root: Hash256,
|
||||
rlp_transactions_root: Hash256,
|
||||
rlp_withdrawals_root: Option<Hash256>,
|
||||
rlp_excess_data_gas: Option<Uint256>,
|
||||
rlp_data_gas_used: Option<u64>,
|
||||
rlp_excess_data_gas: Option<u64>,
|
||||
) -> Self {
|
||||
// Most of these field mappings are defined in EIP-3675 except for `mixHash`, which is
|
||||
// defined in EIP-4399.
|
||||
@@ -77,6 +80,7 @@ impl ExecutionBlockHeader {
|
||||
nonce: Hash64::zero(),
|
||||
base_fee_per_gas: payload.base_fee_per_gas(),
|
||||
withdrawals_root: rlp_withdrawals_root,
|
||||
data_gas_used: rlp_data_gas_used,
|
||||
excess_data_gas: rlp_excess_data_gas,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,9 +84,13 @@ pub struct ExecutionPayload<T: EthSpec> {
|
||||
#[superstruct(only(Capella, Deneb))]
|
||||
pub withdrawals: Withdrawals<T>,
|
||||
#[superstruct(only(Deneb))]
|
||||
#[serde(with = "serde_utils::quoted_u256")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub excess_data_gas: Uint256,
|
||||
pub data_gas_used: u64,
|
||||
#[superstruct(only(Deneb))]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub excess_data_gas: u64,
|
||||
}
|
||||
|
||||
impl<'a, T: EthSpec> ExecutionPayloadRef<'a, T> {
|
||||
|
||||
@@ -78,9 +78,13 @@ pub struct ExecutionPayloadHeader<T: EthSpec> {
|
||||
#[superstruct(getter(copy))]
|
||||
pub withdrawals_root: Hash256,
|
||||
#[superstruct(only(Deneb))]
|
||||
#[serde(with = "serde_utils::quoted_u256")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub excess_data_gas: Uint256,
|
||||
pub data_gas_used: u64,
|
||||
#[superstruct(only(Deneb))]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
#[superstruct(getter(copy))]
|
||||
pub excess_data_gas: u64,
|
||||
}
|
||||
|
||||
impl<T: EthSpec> ExecutionPayloadHeader<T> {
|
||||
@@ -151,8 +155,8 @@ impl<T: EthSpec> ExecutionPayloadHeaderCapella<T> {
|
||||
block_hash: self.block_hash,
|
||||
transactions_root: self.transactions_root,
|
||||
withdrawals_root: self.withdrawals_root,
|
||||
// TODO: verify if this is correct
|
||||
excess_data_gas: Uint256::zero(),
|
||||
data_gas_used: 0,
|
||||
excess_data_gas: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -217,6 +221,7 @@ impl<'a, T: EthSpec> From<&'a ExecutionPayloadDeneb<T>> for ExecutionPayloadHead
|
||||
block_hash: payload.block_hash,
|
||||
transactions_root: payload.transactions.tree_hash_root(),
|
||||
withdrawals_root: payload.withdrawals.tree_hash_root(),
|
||||
data_gas_used: payload.data_gas_used,
|
||||
excess_data_gas: payload.excess_data_gas,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user