Skip to content

Commit

Permalink
implement the eth payload builder
Browse files Browse the repository at this point in the history
  • Loading branch information
greged93 committed Sep 30, 2024
1 parent 3f56798 commit 2ee31bc
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions crates/engine/local/src/payload.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
//! The implementation of the [`PayloadAttributesBuilder`] for the [`LocalEngineService`].
use alloy_primitives::{Address, B256};
use reth_ethereum_engine_primitives::EthPayloadAttributes;
use reth_payload_primitives::{PayloadAttributesBuilder, PayloadTypes};
use std::convert::Infallible;
use reth_payload_primitives::PayloadAttributesBuilder;
use std::{convert::Infallible, time::UNIX_EPOCH};

/// The attributes builder for Ethereum payload.
/// The attributes builder for local Ethereum payload.
#[derive(Debug)]
pub struct EthPayloadAttributesBuilder;
pub struct EthLocalPayloadAttributesBuilder;

impl PayloadAttributesBuilder for EthPayloadAttributesBuilder {
impl PayloadAttributesBuilder for EthLocalPayloadAttributesBuilder {
type PayloadAttributes = EthPayloadAttributes;
type Error = Infallible;

fn build(&self) -> Result<Self::PayloadAttributes, Self::Error> {
let ts = std::time::SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("cannot be earlier than UNIX_EPOCH");

Ok(EthPayloadAttributes {
timestamp: ,
prev_randao: Default::default(),
suggested_fee_recipient: Default::default(),
timestamp: ts.as_secs(),
prev_randao: B256::random(),
suggested_fee_recipient: Address::random(),
withdrawals: None,
parent_beacon_block_root: None,
})
Expand Down

0 comments on commit 2ee31bc

Please sign in to comment.