Skip to content

Commit

Permalink
chore: reth payload without reth rpc types (#11097)
Browse files Browse the repository at this point in the history
  • Loading branch information
greged93 authored Sep 21, 2024
1 parent 4c92075 commit b4ad28d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 18 deletions.
7 changes: 4 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/payload/builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ workspace = true
[dependencies]
# reth
reth-primitives.workspace = true
reth-rpc-types.workspace = true
reth-provider.workspace = true
reth-payload-primitives.workspace = true
reth-ethereum-engine-primitives.workspace = true
reth-chain-state = { workspace = true, optional = true }

# alloy
alloy-rpc-types = { workspace = true, features = ["engine"] }
alloy-primitives.workspace = true

# async
Expand Down
4 changes: 2 additions & 2 deletions crates/payload/builder/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This crate defines abstractions to create and update payloads (blocks):
//! - [`PayloadJobGenerator`]: a type that knows how to create new jobs for creating payloads based
//! on [`PayloadAttributes`](reth_rpc_types::engine::PayloadAttributes).
//! on [`PayloadAttributes`](alloy_rpc_types::engine::PayloadAttributes).
//! - [`PayloadJob`]: a type that yields (better) payloads over time.
//!
//! This crate comes with the generic [`PayloadBuilderService`] responsible for managing payload
Expand Down Expand Up @@ -110,8 +110,8 @@ pub mod noop;
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;

pub use alloy_rpc_types::engine::PayloadId;
pub use reth_payload_primitives::PayloadBuilderError;
pub use reth_rpc_types::engine::PayloadId;
pub use service::{
PayloadBuilderHandle, PayloadBuilderService, PayloadServiceCommand, PayloadStore,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/payload/builder/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use crate::{
metrics::PayloadBuilderServiceMetrics, traits::PayloadJobGenerator, KeepPayloadJobAlive,
PayloadJob,
};
use alloy_rpc_types::engine::PayloadId;
use futures_util::{future::FutureExt, Stream, StreamExt};
use reth_payload_primitives::{
BuiltPayload, Events, PayloadBuilder, PayloadBuilderAttributes, PayloadBuilderError,
PayloadEvents, PayloadTypes,
};
use reth_provider::CanonStateNotification;
use reth_rpc_types::engine::PayloadId;
use std::{
fmt,
future::Future,
Expand Down
3 changes: 2 additions & 1 deletion crates/payload/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ reth-chainspec.workspace = true
reth-errors.workspace = true
reth-primitives.workspace = true
reth-transaction-pool.workspace = true
reth-rpc-types.workspace = true
reth-chain-state.workspace = true

# alloy
alloy-primitives.workspace = true
alloy-rpc-types = { workspace = true, features = ["engine"] }
op-alloy-rpc-types-engine.workspace = true

# async
async-trait.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions crates/payload/primitives/src/payload.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{MessageValidationKind, PayloadAttributes};
use alloy_primitives::B256;
use reth_rpc_types::engine::ExecutionPayload;
use alloy_rpc_types::engine::ExecutionPayload;

/// Either an [`ExecutionPayload`] or a types that implements the [`PayloadAttributes`] trait.
#[derive(Debug)]
Expand Down Expand Up @@ -30,7 +30,7 @@ where
}

/// Return the withdrawals for the payload or attributes.
pub fn withdrawals(&self) -> Option<&Vec<reth_rpc_types::Withdrawal>> {
pub fn withdrawals(&self) -> Option<&Vec<alloy_rpc_types::Withdrawal>> {
match self {
Self::ExecutionPayload { payload, .. } => payload.withdrawals(),
Self::PayloadAttributes(attributes) => attributes.withdrawals(),
Expand Down
10 changes: 5 additions & 5 deletions crates/payload/primitives/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ use crate::{
PayloadBuilderError, PayloadEvents, PayloadTypes,
};
use alloy_primitives::{Address, B256, U256};
use reth_chain_state::ExecutedBlock;
use reth_chainspec::ChainSpec;
use reth_primitives::{SealedBlock, Withdrawals};
use reth_rpc_types::{
use alloy_rpc_types::{
engine::{PayloadAttributes as EthPayloadAttributes, PayloadId},
optimism::OptimismPayloadAttributes,
Withdrawal,
};
use op_alloy_rpc_types_engine::OptimismPayloadAttributes;
use reth_chain_state::ExecutedBlock;
use reth_chainspec::ChainSpec;
use reth_primitives::{SealedBlock, Withdrawals};
use std::{future::Future, pin::Pin};
use tokio::sync::oneshot;

Expand Down
4 changes: 3 additions & 1 deletion crates/payload/validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ workspace = true
# reth
reth-chainspec.workspace = true
reth-primitives.workspace = true
reth-rpc-types.workspace = true
reth-rpc-types-compat.workspace = true

# alloy
alloy-rpc-types = { workspace = true, features = ["engine"] }
4 changes: 2 additions & 2 deletions crates/payload/validator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use alloy_rpc_types::engine::{ExecutionPayload, MaybeCancunPayloadFields, PayloadError};
use reth_chainspec::EthereumHardforks;
use reth_primitives::SealedBlock;
use reth_rpc_types::{engine::MaybeCancunPayloadFields, ExecutionPayload, PayloadError};
use reth_rpc_types_compat::engine::payload::try_into_block;
use std::sync::Arc;

Expand Down Expand Up @@ -102,7 +102,7 @@ impl<ChainSpec: EthereumHardforks> ExecutionPayloadValidator<ChainSpec> {
///
/// If the cancun fields are provided this also validates that the versioned hashes in the block
/// match the versioned hashes passed in the
/// [`CancunPayloadFields`](reth_rpc_types::engine::CancunPayloadFields), if the cancun payload
/// [`CancunPayloadFields`](alloy_rpc_types::engine::CancunPayloadFields), if the cancun payload
/// fields are provided. If the payload fields are not provided, but versioned hashes exist
/// in the block, this is considered an error: [`PayloadError::InvalidVersionedHashes`].
///
Expand Down

0 comments on commit b4ad28d

Please sign in to comment.