chore: Expose payload_id (#16931)

Co-authored-by: Solar Mithril <solarmithril@pm.me>
This commit is contained in:
Solar Mithril
2025-06-19 16:13:52 +05:00
committed by GitHub
parent 53cd4b2397
commit 2ebb519287
4 changed files with 6 additions and 4 deletions

View File

@@ -12,7 +12,7 @@
extern crate alloc;
mod payload;
pub use payload::{BlobSidecars, EthBuiltPayload, EthPayloadBuilderAttributes};
pub use payload::{payload_id, BlobSidecars, EthBuiltPayload, EthPayloadBuilderAttributes};
mod error;
pub use error::*;

View File

@@ -404,7 +404,7 @@ impl PayloadBuilderAttributes for EthPayloadBuilderAttributes {
/// Generates the payload id for the configured payload from the [`PayloadAttributes`].
///
/// Returns an 8-byte identifier by hashing the payload components with sha256 hash.
pub(crate) fn payload_id(parent: &B256, attributes: &PayloadAttributes) -> PayloadId {
pub fn payload_id(parent: &B256, attributes: &PayloadAttributes) -> PayloadId {
use sha2::Digest;
let mut hasher = sha2::Sha256::new();
hasher.update(parent.as_slice());

View File

@@ -16,7 +16,9 @@ pub use builder::OpPayloadBuilder;
pub mod error;
pub mod payload;
use op_alloy_rpc_types_engine::OpExecutionData;
pub use payload::{OpBuiltPayload, OpPayloadAttributes, OpPayloadBuilderAttributes};
pub use payload::{
payload_id_optimism, OpBuiltPayload, OpPayloadAttributes, OpPayloadBuilderAttributes,
};
mod traits;
use reth_optimism_primitives::OpPrimitives;
use reth_payload_primitives::{BuiltPayload, PayloadTypes};

View File

@@ -327,7 +327,7 @@ where
/// Generates the payload id for the configured payload from the [`OpPayloadAttributes`].
///
/// Returns an 8-byte identifier by hashing the payload components with sha256 hash.
pub(crate) fn payload_id_optimism(
pub fn payload_id_optimism(
parent: &B256,
attributes: &OpPayloadAttributes,
payload_version: u8,