mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: pass parent beacon block root to payload builder (#4425)
This commit is contained in:
@ -828,7 +828,7 @@ where
|
|||||||
difficulty: U256::ZERO,
|
difficulty: U256::ZERO,
|
||||||
gas_used: cumulative_gas_used,
|
gas_used: cumulative_gas_used,
|
||||||
extra_data: extra_data.into(),
|
extra_data: extra_data.into(),
|
||||||
parent_beacon_block_root: None,
|
parent_beacon_block_root: attributes.parent_beacon_block_root,
|
||||||
blob_gas_used,
|
blob_gas_used,
|
||||||
excess_blob_gas,
|
excess_blob_gas,
|
||||||
};
|
};
|
||||||
@ -906,7 +906,7 @@ where
|
|||||||
blob_gas_used: None,
|
blob_gas_used: None,
|
||||||
excess_blob_gas: None,
|
excess_blob_gas: None,
|
||||||
extra_data: extra_data.into(),
|
extra_data: extra_data.into(),
|
||||||
parent_beacon_block_root: None,
|
parent_beacon_block_root: attributes.parent_beacon_block_root,
|
||||||
};
|
};
|
||||||
|
|
||||||
let block = Block { header, body: vec![], ommers: vec![], withdrawals };
|
let block = Block { header, body: vec![], ommers: vec![], withdrawals };
|
||||||
|
|||||||
@ -129,6 +129,8 @@ pub struct PayloadBuilderAttributes {
|
|||||||
pub prev_randao: H256,
|
pub prev_randao: H256,
|
||||||
/// Withdrawals for the generated payload
|
/// Withdrawals for the generated payload
|
||||||
pub withdrawals: Vec<Withdrawal>,
|
pub withdrawals: Vec<Withdrawal>,
|
||||||
|
/// Root of the parent beacon block
|
||||||
|
pub parent_beacon_block_root: Option<H256>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// === impl PayloadBuilderAttributes ===
|
// === impl PayloadBuilderAttributes ===
|
||||||
@ -146,6 +148,7 @@ impl PayloadBuilderAttributes {
|
|||||||
suggested_fee_recipient: attributes.suggested_fee_recipient,
|
suggested_fee_recipient: attributes.suggested_fee_recipient,
|
||||||
prev_randao: attributes.prev_randao,
|
prev_randao: attributes.prev_randao,
|
||||||
withdrawals: attributes.withdrawals.unwrap_or_default(),
|
withdrawals: attributes.withdrawals.unwrap_or_default(),
|
||||||
|
parent_beacon_block_root: attributes.parent_beacon_block_root,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,6 +207,9 @@ pub(crate) fn payload_id(parent: &H256, attributes: &PayloadAttributes) -> Paylo
|
|||||||
withdrawals.encode(&mut buf);
|
withdrawals.encode(&mut buf);
|
||||||
hasher.update(buf);
|
hasher.update(buf);
|
||||||
}
|
}
|
||||||
|
if let Some(parent_beacon_block) = attributes.parent_beacon_block_root {
|
||||||
|
hasher.update(parent_beacon_block);
|
||||||
|
}
|
||||||
let out = hasher.finalize();
|
let out = hasher.finalize();
|
||||||
PayloadId::new(out.as_slice()[..8].try_into().expect("sufficient length"))
|
PayloadId::new(out.as_slice()[..8].try_into().expect("sufficient length"))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user