Skip to content

Commit

Permalink
Implement ExecutionPayload for OpExecutionData (#14682)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohkaz authored Feb 24, 2025
1 parent 38808e1 commit a18b0fc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions crates/payload/primitives/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,30 @@ where
Self::PayloadAttributes(attributes)
}
}

#[cfg(feature = "op")]
impl ExecutionPayload for op_alloy_rpc_types_engine::OpExecutionData {
fn parent_hash(&self) -> B256 {
self.parent_hash()
}

fn block_hash(&self) -> B256 {
self.block_hash()
}

fn block_number(&self) -> u64 {
self.block_number()
}

fn withdrawals(&self) -> Option<&Vec<Withdrawal>> {
Some(&self.payload.as_v2().withdrawals)
}

fn parent_beacon_block_root(&self) -> Option<B256> {
self.sidecar.parent_beacon_block_root()
}

fn timestamp(&self) -> u64 {
self.payload.as_v2().timestamp()
}
}

0 comments on commit a18b0fc

Please sign in to comment.