diff --git a/crates/rpc/rpc-types-compat/src/block.rs b/crates/rpc/rpc-types-compat/src/block.rs index 578a47b36929c..c0cf0bae43917 100644 --- a/crates/rpc/rpc-types-compat/src/block.rs +++ b/crates/rpc/rpc-types-compat/src/block.rs @@ -135,7 +135,7 @@ pub fn from_primitive_with_hash(primitive_header: reth_primitives::SealedHeader) logs_bloom, timestamp: U256::from(timestamp), difficulty, - mix_hash, + mix_hash: Some(mix_hash), nonce: Some(nonce.to_be_bytes().into()), base_fee_per_gas: base_fee_per_gas.map(U256::from), blob_gas_used: blob_gas_used.map(U64::from), diff --git a/crates/rpc/rpc-types/src/eth/block.rs b/crates/rpc/rpc-types/src/eth/block.rs index 17ecf8ce755d0..e36521f100ca0 100644 --- a/crates/rpc/rpc-types/src/eth/block.rs +++ b/crates/rpc/rpc-types/src/eth/block.rs @@ -163,23 +163,33 @@ 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 + #[serde(skip_serializing_if = "Option::is_none")] + pub mix_hash: Option, /// Nonce pub nonce: Option, /// Base fee per unit of gas (if past London) - #[serde(rename = "baseFeePerGas", skip_serializing_if = "Option::is_none")] + #[serde(skip_serializing_if = "Option::is_none")] pub base_fee_per_gas: Option, /// Withdrawals root hash added by EIP-4895 and is ignored in legacy headers. #[serde(skip_serializing_if = "Option::is_none")] pub withdrawals_root: Option, /// Blob gas used - #[serde(rename = "blobGasUsed", skip_serializing_if = "Option::is_none")] + #[serde(skip_serializing_if = "Option::is_none")] pub blob_gas_used: Option, /// Excess blob gas - #[serde(rename = "excessBlobGas", skip_serializing_if = "Option::is_none")] + #[serde(skip_serializing_if = "Option::is_none")] pub excess_blob_gas: Option, /// Parent beacon block root - #[serde(rename = "parentBeaconBlockRoot", skip_serializing_if = "Option::is_none")] + #[serde(skip_serializing_if = "Option::is_none")] pub parent_beacon_block_root: Option, } @@ -837,7 +847,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, @@ -878,7 +888,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,