From a535ba8ad4dc1be47218c84f2dfe49076f833806 Mon Sep 17 00:00:00 2001 From: Naohiro Yoshida Date: Mon, 2 Dec 2024 08:29:59 +0900 Subject: [PATCH] calc seal hash with requests_hash Signed-off-by: Naohiro Yoshida --- light-client/src/header/eth_header.rs | 8 ++++++++ light-client/src/header/vote_attestation.rs | 1 + 2 files changed, 9 insertions(+) diff --git a/light-client/src/header/eth_header.rs b/light-client/src/header/eth_header.rs index 0cde856..ba3d7e1 100644 --- a/light-client/src/header/eth_header.rs +++ b/light-client/src/header/eth_header.rs @@ -58,6 +58,7 @@ pub struct ETHHeader { pub blob_gas_used: Option, pub excess_blob_gas: Option, pub parent_beacon_root: Option>, + pub requests_hash: Option>, // calculated by RawETHHeader pub hash: Hash, @@ -133,6 +134,11 @@ impl ETHHeader { stream.append_empty_data(); } stream.append(parent_beacon_root); + + // https://github.com/bnb-chain/bsc/blob/e2f2111a85fecabb4782099338aca21bf58bde09/core/types/block.go#L776 + if let Some(value) = &self.requests_hash { + stream.append(value); + } } } stream.finalize_unbounded_list(); @@ -378,6 +384,7 @@ impl TryFrom for ETHHeader { let blob_gas_used: Option = rlp.try_next_as_val().map(Some).unwrap_or(None); let excess_blob_gas: Option = rlp.try_next_as_val().map(Some).unwrap_or(None); let parent_beacon_root: Option> = rlp.try_next_as_val().map(Some).unwrap_or(None); + let requests_hash: Option> = rlp.try_next_as_val().map(Some).unwrap_or(None); // Check that the extra-data contains the vanity, validators and signature let extra_size = extra_data.len(); @@ -445,6 +452,7 @@ impl TryFrom for ETHHeader { withdrawals_hash, blob_gas_used, parent_beacon_root, + requests_hash, hash, epoch, }) diff --git a/light-client/src/header/vote_attestation.rs b/light-client/src/header/vote_attestation.rs index fb05570..e6aa6fc 100644 --- a/light-client/src/header/vote_attestation.rs +++ b/light-client/src/header/vote_attestation.rs @@ -242,6 +242,7 @@ mod test { blob_gas_used: None, excess_blob_gas: None, parent_beacon_root: None, + requests_hash: None, hash: [0u8; 32], epoch: None, };