Skip to content

Commit

Permalink
Addressed #4560
Browse files Browse the repository at this point in the history
  • Loading branch information
ethDreamer committed Aug 1, 2023
1 parent 0a0fc52 commit 4ebd3db
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 48 deletions.
30 changes: 15 additions & 15 deletions beacon_node/execution_layer/src/block_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ impl<T: EthSpec> ExecutionLayer<T> {
None
};

let rlp_data_gas_used = payload.data_gas_used().ok();
let rlp_excess_data_gas = payload.excess_data_gas().ok();
let rlp_blob_gas_used = payload.blob_gas_used().ok();
let rlp_excess_blob_gas = payload.excess_blob_gas().ok();

// Calculate parent beacon block root (post-Deneb).
let rlp_parent_beacon_block_root = rlp_excess_data_gas
let rlp_parent_beacon_block_root = rlp_excess_blob_gas
.as_ref()
.map(|_| parent_beacon_block_root);

Expand All @@ -52,8 +52,8 @@ impl<T: EthSpec> ExecutionLayer<T> {
KECCAK_EMPTY_LIST_RLP.as_fixed_bytes().into(),
rlp_transactions_root,
rlp_withdrawals_root,
rlp_data_gas_used,
rlp_excess_data_gas,
rlp_blob_gas_used,
rlp_excess_blob_gas,
rlp_parent_beacon_block_root,
);

Expand Down Expand Up @@ -110,11 +110,11 @@ pub fn rlp_encode_block_header(header: &ExecutionBlockHeader) -> Vec<u8> {
if let Some(withdrawals_root) = &header.withdrawals_root {
rlp_header_stream.append(withdrawals_root);
}
if let Some(data_gas_used) = &header.data_gas_used {
rlp_header_stream.append(data_gas_used);
if let Some(blob_gas_used) = &header.blob_gas_used {
rlp_header_stream.append(blob_gas_used);
}
if let Some(excess_data_gas) = &header.excess_data_gas {
rlp_header_stream.append(excess_data_gas);
if let Some(excess_blob_gas) = &header.excess_blob_gas {
rlp_header_stream.append(excess_blob_gas);
}
if let Some(parent_beacon_block_root) = &header.parent_beacon_block_root {
rlp_header_stream.append(parent_beacon_block_root);
Expand Down Expand Up @@ -165,8 +165,8 @@ mod test {
nonce: Hash64::zero(),
base_fee_per_gas: 0x036b_u64.into(),
withdrawals_root: None,
data_gas_used: None,
excess_data_gas: None,
blob_gas_used: None,
excess_blob_gas: None,
parent_beacon_block_root: None,
};
let expected_rlp = "f90200a0e0a94a7a3c9617401586b1a27025d2d9671332d22d540e0af72b069170380f2aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794ba5e000000000000000000000000000000000000a0ec3c94b18b8a1cff7d60f8d258ec723312932928626b4c9355eb4ab3568ec7f7a050f738580ed699f0469702c7ccc63ed2e51bc034be9479b7bff4e68dee84accfa029b0562f7140574dd0d50dee8a271b22e1a0a7b78fca58f7c60370d8317ba2a9b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200000188016345785d8a00008301553482079e42a0000000000000000000000000000000000000000000000000000000000000000088000000000000000082036b";
Expand Down Expand Up @@ -196,8 +196,8 @@ mod test {
nonce: Hash64::zero(),
base_fee_per_gas: 0x036b_u64.into(),
withdrawals_root: None,
data_gas_used: None,
excess_data_gas: None,
blob_gas_used: None,
excess_blob_gas: None,
parent_beacon_block_root: None,
};
let expected_rlp = "f901fda0927ca537f06c783a3a2635b8805eef1c8c2124f7444ad4a3389898dd832f2dbea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794ba5e000000000000000000000000000000000000a0e97859b065bd8dbbb4519c7cb935024de2484c2b7f881181b4360492f0b06b82a050f738580ed699f0469702c7ccc63ed2e51bc034be9479b7bff4e68dee84accfa029b0562f7140574dd0d50dee8a271b22e1a0a7b78fca58f7c60370d8317ba2a9b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800188016345785d8a00008301553482079e42a0000000000000000000000000000000000000000000000000000000000002000088000000000000000082036b";
Expand Down Expand Up @@ -228,8 +228,8 @@ mod test {
nonce: Hash64::zero(),
base_fee_per_gas: 0x34187b238_u64.into(),
withdrawals_root: None,
data_gas_used: None,
excess_data_gas: None,
blob_gas_used: None,
excess_blob_gas: None,
parent_beacon_block_root: None,
};
let expected_hash =
Expand Down
12 changes: 6 additions & 6 deletions beacon_node/execution_layer/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ pub struct ExecutionBlockWithTransactions<T: EthSpec> {
pub withdrawals: Vec<JsonWithdrawal>,
#[superstruct(only(Deneb))]
#[serde(with = "serde_utils::u64_hex_be")]
pub data_gas_used: u64,
pub blob_gas_used: u64,
#[superstruct(only(Deneb))]
#[serde(with = "serde_utils::u64_hex_be")]
pub excess_data_gas: u64,
pub excess_blob_gas: u64,
}

impl<T: EthSpec> TryFrom<ExecutionPayload<T>> for ExecutionBlockWithTransactions<T> {
Expand Down Expand Up @@ -278,8 +278,8 @@ impl<T: EthSpec> TryFrom<ExecutionPayload<T>> for ExecutionBlockWithTransactions
.into_iter()
.map(|withdrawal| withdrawal.into())
.collect(),
data_gas_used: block.data_gas_used,
excess_data_gas: block.excess_data_gas,
blob_gas_used: block.blob_gas_used,
excess_blob_gas: block.excess_blob_gas,
}),
};
Ok(json_payload)
Expand Down Expand Up @@ -562,8 +562,8 @@ impl<E: EthSpec> ExecutionPayloadBodyV1<E> {
block_hash: header.block_hash,
transactions: self.transactions,
withdrawals,
data_gas_used: header.data_gas_used,
excess_data_gas: header.excess_data_gas,
blob_gas_used: header.blob_gas_used,
excess_blob_gas: header.excess_blob_gas,
}))
} else {
Err(format!(
Expand Down
12 changes: 6 additions & 6 deletions beacon_node/execution_layer/src/engine_api/json_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ pub struct JsonExecutionPayload<T: EthSpec> {
pub withdrawals: VariableList<JsonWithdrawal, T::MaxWithdrawalsPerPayload>,
#[superstruct(only(V3))]
#[serde(with = "serde_utils::u64_hex_be")]
pub data_gas_used: u64,
pub blob_gas_used: u64,
#[superstruct(only(V3))]
#[serde(with = "serde_utils::u64_hex_be")]
pub excess_data_gas: u64,
pub excess_blob_gas: u64,
}

impl<T: EthSpec> From<ExecutionPayloadMerge<T>> for JsonExecutionPayloadV1<T> {
Expand Down Expand Up @@ -175,8 +175,8 @@ impl<T: EthSpec> From<ExecutionPayloadDeneb<T>> for JsonExecutionPayloadV3<T> {
.map(Into::into)
.collect::<Vec<_>>()
.into(),
data_gas_used: payload.data_gas_used,
excess_data_gas: payload.excess_data_gas,
blob_gas_used: payload.blob_gas_used,
excess_blob_gas: payload.excess_blob_gas,
}
}
}
Expand Down Expand Up @@ -260,8 +260,8 @@ impl<T: EthSpec> From<JsonExecutionPayloadV3<T>> for ExecutionPayloadDeneb<T> {
.map(Into::into)
.collect::<Vec<_>>()
.into(),
data_gas_used: payload.data_gas_used,
excess_data_gas: payload.excess_data_gas,
blob_gas_used: payload.blob_gas_used,
excess_blob_gas: payload.excess_blob_gas,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions beacon_node/execution_layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1913,8 +1913,8 @@ impl<T: EthSpec> ExecutionLayer<T> {
block_hash: deneb_block.block_hash,
transactions: convert_transactions(deneb_block.transactions)?,
withdrawals,
data_gas_used: deneb_block.data_gas_used,
excess_data_gas: deneb_block.excess_data_gas,
blob_gas_used: deneb_block.blob_gas_used,
excess_blob_gas: deneb_block.excess_blob_gas,
})
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
block_hash: ExecutionBlockHash::zero(),
transactions: vec![].into(),
withdrawals: pa.withdrawals.clone().into(),
data_gas_used: 0,
excess_data_gas: 0,
blob_gas_used: 0,
excess_blob_gas: 0,
}),
};

Expand Down
16 changes: 8 additions & 8 deletions consensus/types/src/execution_block_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ 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,
blob_gas_used,
excess_blob_gas,
parent_beacon_block_root
)),))]
pub struct ExecutionBlockHeader {
Expand All @@ -48,8 +48,8 @@ pub struct ExecutionBlockHeader {
pub nonce: Hash64,
pub base_fee_per_gas: Uint256,
pub withdrawals_root: Option<Hash256>,
pub data_gas_used: Option<u64>,
pub excess_data_gas: Option<u64>,
pub blob_gas_used: Option<u64>,
pub excess_blob_gas: Option<u64>,
pub parent_beacon_block_root: Option<Hash256>,
}

Expand All @@ -59,8 +59,8 @@ impl ExecutionBlockHeader {
rlp_empty_list_root: Hash256,
rlp_transactions_root: Hash256,
rlp_withdrawals_root: Option<Hash256>,
rlp_data_gas_used: Option<u64>,
rlp_excess_data_gas: Option<u64>,
rlp_blob_gas_used: Option<u64>,
rlp_excess_blob_gas: Option<u64>,
rlp_parent_beacon_block_root: Option<Hash256>,
) -> Self {
// Most of these field mappings are defined in EIP-3675 except for `mixHash`, which is
Expand All @@ -83,8 +83,8 @@ 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,
blob_gas_used: rlp_blob_gas_used,
excess_blob_gas: rlp_excess_blob_gas,
parent_beacon_block_root: rlp_parent_beacon_block_root,
}
}
Expand Down
4 changes: 2 additions & 2 deletions consensus/types/src/execution_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ pub struct ExecutionPayload<T: EthSpec> {
pub withdrawals: Withdrawals<T>,
#[superstruct(only(Deneb), partial_getter(copy))]
#[serde(with = "serde_utils::quoted_u64")]
pub data_gas_used: u64,
pub blob_gas_used: u64,
#[superstruct(only(Deneb), partial_getter(copy))]
#[serde(with = "serde_utils::quoted_u64")]
pub excess_data_gas: u64,
pub excess_blob_gas: u64,
}

impl<'a, T: EthSpec> ExecutionPayloadRef<'a, T> {
Expand Down
12 changes: 6 additions & 6 deletions consensus/types/src/execution_payload_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ pub struct ExecutionPayloadHeader<T: EthSpec> {
#[superstruct(only(Deneb))]
#[serde(with = "serde_utils::quoted_u64")]
#[superstruct(getter(copy))]
pub data_gas_used: u64,
pub blob_gas_used: u64,
#[superstruct(only(Deneb))]
#[serde(with = "serde_utils::quoted_u64")]
#[superstruct(getter(copy))]
pub excess_data_gas: u64,
pub excess_blob_gas: u64,
}

impl<T: EthSpec> ExecutionPayloadHeader<T> {
Expand Down Expand Up @@ -155,8 +155,8 @@ impl<T: EthSpec> ExecutionPayloadHeaderCapella<T> {
block_hash: self.block_hash,
transactions_root: self.transactions_root,
withdrawals_root: self.withdrawals_root,
data_gas_used: 0,
excess_data_gas: 0,
blob_gas_used: 0,
excess_blob_gas: 0,
}
}
}
Expand Down Expand Up @@ -221,8 +221,8 @@ 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,
blob_gas_used: payload.blob_gas_used,
excess_blob_gas: payload.excess_blob_gas,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion testing/ef_tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TESTS_TAG := v1.4.0-beta.0
TESTS_TAG := v1.4.0-beta.1
TESTS = general minimal mainnet
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))

Expand Down

0 comments on commit 4ebd3db

Please sign in to comment.