Skip to content

Commit

Permalink
calc seal hash with requests_hash
Browse files Browse the repository at this point in the history
Signed-off-by: Naohiro Yoshida <[email protected]>
  • Loading branch information
Naohiro Yoshida committed Dec 1, 2024
1 parent cd3ca85 commit a535ba8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions light-client/src/header/eth_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub struct ETHHeader {
pub blob_gas_used: Option<u64>,
pub excess_blob_gas: Option<u64>,
pub parent_beacon_root: Option<Vec<u8>>,
pub requests_hash: Option<Vec<u8>>,

// calculated by RawETHHeader
pub hash: Hash,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -378,6 +384,7 @@ impl TryFrom<RawETHHeader> for ETHHeader {
let blob_gas_used: Option<u64> = rlp.try_next_as_val().map(Some).unwrap_or(None);
let excess_blob_gas: Option<u64> = rlp.try_next_as_val().map(Some).unwrap_or(None);
let parent_beacon_root: Option<Vec<u8>> = rlp.try_next_as_val().map(Some).unwrap_or(None);
let requests_hash: Option<Vec<u8>> = 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();
Expand Down Expand Up @@ -445,6 +452,7 @@ impl TryFrom<RawETHHeader> for ETHHeader {
withdrawals_hash,
blob_gas_used,
parent_beacon_root,
requests_hash,
hash,
epoch,
})
Expand Down
1 change: 1 addition & 0 deletions light-client/src/header/vote_attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down

0 comments on commit a535ba8

Please sign in to comment.