From 093022c89eefafcdedbf1152b8ac25de0750fdc5 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Mon, 11 Dec 2023 16:44:59 -0400 Subject: [PATCH] feat: make mix hash optional --- crates/rpc-types/src/eth/block.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/crates/rpc-types/src/eth/block.rs b/crates/rpc-types/src/eth/block.rs index 8135a693e63..12cd1a7a209 100644 --- a/crates/rpc-types/src/eth/block.rs +++ b/crates/rpc-types/src/eth/block.rs @@ -172,7 +172,17 @@ pub struct Header { /// Extra data pub extra_data: Bytes, /// Mix Hash - pub mix_hash: B256, + /// + /// Before the merge this proves, combined with the nonce, that a sufficient amount of + /// computation has been carried out on this block: the Proof-of-Work (PoF). + /// + /// After the merge this is `prevRandao`: Randomness value for the generated payload. + /// + /// This is an Option because it is not always set by non-ethereum networks. + /// + /// See also + /// And + pub mix_hash: Option, /// Nonce pub nonce: Option, /// Base fee per unit of gas (if past London) @@ -843,7 +853,7 @@ mod tests { logs_bloom: Bloom::default(), timestamp: U256::from(12), difficulty: U256::from(13), - mix_hash: B256::with_last_byte(14), + mix_hash: Some(B256::with_last_byte(14)), nonce: Some(B64::with_last_byte(15)), base_fee_per_gas: Some(U256::from(20)), blob_gas_used: None, @@ -884,7 +894,7 @@ mod tests { logs_bloom: Bloom::default(), timestamp: U256::from(12), difficulty: U256::from(13), - mix_hash: B256::with_last_byte(14), + mix_hash: Some(B256::with_last_byte(14)), nonce: Some(B64::with_last_byte(15)), base_fee_per_gas: Some(U256::from(20)), blob_gas_used: None,