diff --git a/.github/assets/check_wasm.sh b/.github/assets/check_wasm.sh index 0d9c9b34a036..0e704857edb3 100755 --- a/.github/assets/check_wasm.sh +++ b/.github/assets/check_wasm.sh @@ -15,7 +15,6 @@ exclude_crates=( reth-beacon-consensus reth-bench reth-blockchain-tree - reth-chain-state reth-cli reth-cli-commands reth-cli-runner @@ -26,13 +25,11 @@ exclude_crates=( reth-dns-discovery reth-downloaders reth-e2e-test-utils - reth-engine-primitives reth-engine-service reth-engine-tree reth-engine-util reth-eth-wire reth-ethereum-cli - reth-ethereum-engine-primitives reth-ethereum-payload-builder reth-etl reth-exex @@ -41,7 +38,6 @@ exclude_crates=( reth-net-nat reth-network reth-node-api - reth-node-types reth-node-builder reth-node-core reth-node-ethereum @@ -51,9 +47,6 @@ exclude_crates=( reth-optimism-node reth-optimism-payload-builder reth-optimism-rpc - reth-payload-builder - reth-payload-builder-primitives - reth-payload-primitives reth-rpc reth-rpc-api reth-rpc-api-testing-util diff --git a/Cargo.lock b/Cargo.lock index fefa6fb5c1d8..7ff1c650bda4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8479,15 +8479,10 @@ dependencies = [ name = "reth-payload-builder-primitives" version = "1.1.1" dependencies = [ - "alloy-primitives", "alloy-rpc-types-engine", "async-trait", "pin-project", - "reth-errors", "reth-payload-primitives", - "reth-transaction-pool", - "revm-primitives", - "thiserror 1.0.69", "tokio", "tokio-stream", "tracing", @@ -8503,9 +8498,12 @@ dependencies = [ "op-alloy-rpc-types-engine", "reth-chain-state", "reth-chainspec", + "reth-errors", "reth-primitives", + "revm-primitives", "serde", "thiserror 1.0.69", + "tokio", ] [[package]] diff --git a/crates/chain-state/Cargo.toml b/crates/chain-state/Cargo.toml index 0a2f53715ffb..ff62b76e5dfb 100644 --- a/crates/chain-state/Cargo.toml +++ b/crates/chain-state/Cargo.toml @@ -27,7 +27,7 @@ alloy-primitives.workspace = true alloy-consensus.workspace = true # async -tokio = { workspace = true, features = ["sync", "macros", "rt-multi-thread"] } +tokio = { workspace = true, default-features = false, features = ["sync", "macros"] } tokio-stream = { workspace = true, features = ["sync"] } # tracing diff --git a/crates/ethereum/payload/src/lib.rs b/crates/ethereum/payload/src/lib.rs index 2b55ea87dd0a..4ec1e212c8d5 100644 --- a/crates/ethereum/payload/src/lib.rs +++ b/crates/ethereum/payload/src/lib.rs @@ -397,9 +397,11 @@ where // only determine cancun fields when active if chain_spec.is_cancun_active_at_timestamp(attributes.timestamp) { // grab the blob sidecars from the executed txs - blob_sidecars = pool.get_all_blobs_exact( - executed_txs.iter().filter(|tx| tx.is_eip4844()).map(|tx| tx.hash).collect(), - )?; + blob_sidecars = pool + .get_all_blobs_exact( + executed_txs.iter().filter(|tx| tx.is_eip4844()).map(|tx| tx.hash).collect(), + ) + .map_err(PayloadBuilderError::other)?; excess_blob_gas = if chain_spec.is_cancun_active_at_timestamp(parent_header.timestamp) { let parent_excess_blob_gas = parent_header.excess_blob_gas.unwrap_or_default(); diff --git a/crates/payload/builder-primitives/Cargo.toml b/crates/payload/builder-primitives/Cargo.toml index c3665dbc58ec..6d89ea89d03a 100644 --- a/crates/payload/builder-primitives/Cargo.toml +++ b/crates/payload/builder-primitives/Cargo.toml @@ -13,13 +13,9 @@ workspace = true [dependencies] # reth -reth-errors.workspace = true reth-payload-primitives.workspace = true -reth-transaction-pool.workspace = true -revm-primitives.workspace = true # alloy -alloy-primitives.workspace = true alloy-rpc-types-engine = { workspace = true, features = ["serde"] } # async @@ -29,5 +25,4 @@ tokio = { workspace = true, features = ["sync"] } tokio-stream.workspace = true # misc -thiserror.workspace = true tracing.workspace = true diff --git a/crates/payload/builder-primitives/src/error.rs b/crates/payload/builder-primitives/src/error.rs deleted file mode 100644 index 0d988c829e48..000000000000 --- a/crates/payload/builder-primitives/src/error.rs +++ /dev/null @@ -1,58 +0,0 @@ -//! Error types emitted by types or implementations of this crate. - -use alloy_primitives::B256; -use reth_errors::{ProviderError, RethError}; -use reth_transaction_pool::BlobStoreError; -use revm_primitives::EVMError; -use tokio::sync::oneshot; - -/// Possible error variants during payload building. -#[derive(Debug, thiserror::Error)] -pub enum PayloadBuilderError { - /// Thrown when the parent header cannot be found - #[error("missing parent header: {0}")] - MissingParentHeader(B256), - /// Thrown when the parent block is missing. - #[error("missing parent block {0}")] - MissingParentBlock(B256), - /// An oneshot channels has been closed. - #[error("sender has been dropped")] - ChannelClosed, - /// If there's no payload to resolve. - #[error("missing payload")] - MissingPayload, - /// Error occurring in the blob store. - #[error(transparent)] - BlobStore(#[from] BlobStoreError), - /// Other internal error - #[error(transparent)] - Internal(#[from] RethError), - /// Unrecoverable error during evm execution. - #[error("evm execution error: {0}")] - EvmExecutionError(EVMError), - /// Any other payload building errors. - #[error(transparent)] - Other(Box), -} - -impl PayloadBuilderError { - /// Create a new error from a boxed error. - pub fn other(error: E) -> Self - where - E: core::error::Error + Send + Sync + 'static, - { - Self::Other(Box::new(error)) - } -} - -impl From for PayloadBuilderError { - fn from(error: ProviderError) -> Self { - Self::Internal(RethError::Provider(error)) - } -} - -impl From for PayloadBuilderError { - fn from(_: oneshot::error::RecvError) -> Self { - Self::ChannelClosed - } -} diff --git a/crates/payload/builder-primitives/src/lib.rs b/crates/payload/builder-primitives/src/lib.rs index 003a385c6c02..af7ad736d44e 100644 --- a/crates/payload/builder-primitives/src/lib.rs +++ b/crates/payload/builder-primitives/src/lib.rs @@ -8,12 +8,11 @@ #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -mod error; -pub use error::PayloadBuilderError; - mod events; pub use crate::events::{Events, PayloadEvents}; /// Contains the payload builder trait to abstract over payload attributes. mod traits; pub use traits::{PayloadBuilder, PayloadStoreExt}; + +pub use reth_payload_primitives::PayloadBuilderError; diff --git a/crates/payload/primitives/Cargo.toml b/crates/payload/primitives/Cargo.toml index 332964de96bf..d4070b4688e0 100644 --- a/crates/payload/primitives/Cargo.toml +++ b/crates/payload/primitives/Cargo.toml @@ -14,9 +14,12 @@ workspace = true [dependencies] # reth reth-chainspec.workspace = true +reth-errors.workspace = true reth-primitives.workspace = true reth-chain-state.workspace = true +revm-primitives.workspace = true + # alloy alloy-eips.workspace = true alloy-primitives.workspace = true @@ -26,6 +29,7 @@ op-alloy-rpc-types-engine = { workspace = true, optional = true } # misc serde.workspace = true thiserror.workspace = true +tokio = { workspace = true, default-features = false, features = ["sync"] } [features] op = ["dep:op-alloy-rpc-types-engine"] \ No newline at end of file diff --git a/crates/payload/primitives/src/error.rs b/crates/payload/primitives/src/error.rs index 67b6dbe4b931..d2e57da57911 100644 --- a/crates/payload/primitives/src/error.rs +++ b/crates/payload/primitives/src/error.rs @@ -1,5 +1,58 @@ //! Error types emitted by types or implementations of this crate. +use alloy_primitives::B256; +use reth_errors::{ProviderError, RethError}; +use revm_primitives::EVMError; +use tokio::sync::oneshot; + +/// Possible error variants during payload building. +#[derive(Debug, thiserror::Error)] +pub enum PayloadBuilderError { + /// Thrown when the parent header cannot be found + #[error("missing parent header: {0}")] + MissingParentHeader(B256), + /// Thrown when the parent block is missing. + #[error("missing parent block {0}")] + MissingParentBlock(B256), + /// An oneshot channels has been closed. + #[error("sender has been dropped")] + ChannelClosed, + /// If there's no payload to resolve. + #[error("missing payload")] + MissingPayload, + /// Other internal error + #[error(transparent)] + Internal(#[from] RethError), + /// Unrecoverable error during evm execution. + #[error("evm execution error: {0}")] + EvmExecutionError(EVMError), + /// Any other payload building errors. + #[error(transparent)] + Other(Box), +} + +impl PayloadBuilderError { + /// Create a new error from a boxed error. + pub fn other(error: E) -> Self + where + E: core::error::Error + Send + Sync + 'static, + { + Self::Other(Box::new(error)) + } +} + +impl From for PayloadBuilderError { + fn from(error: ProviderError) -> Self { + Self::Internal(RethError::Provider(error)) + } +} + +impl From for PayloadBuilderError { + fn from(_: oneshot::error::RecvError) -> Self { + Self::ChannelClosed + } +} + /// Thrown when the payload or attributes are known to be invalid before processing. /// /// This is used mainly for diff --git a/crates/payload/primitives/src/lib.rs b/crates/payload/primitives/src/lib.rs index a2bdb58bc516..0ff4810b8647 100644 --- a/crates/payload/primitives/src/lib.rs +++ b/crates/payload/primitives/src/lib.rs @@ -9,7 +9,7 @@ #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] mod error; -pub use error::{EngineObjectValidationError, VersionSpecificValidationError}; +pub use error::{EngineObjectValidationError, PayloadBuilderError, VersionSpecificValidationError}; /// Contains traits to abstract over payload attributes types and default implementations of the /// [`PayloadAttributes`] trait for ethereum mainnet and optimism types.