diff --git a/crates/engine/primitives/Cargo.toml b/crates/engine/primitives/Cargo.toml index 2da1be9c9..66ed2c991 100644 --- a/crates/engine/primitives/Cargo.toml +++ b/crates/engine/primitives/Cargo.toml @@ -32,3 +32,17 @@ futures.workspace = true # misc serde.workspace = true thiserror.workspace = true + +[features] +default = ["std"] +std = [ + "reth-execution-types/std", + "reth-primitives/std", + "reth-primitives-traits/std", + "alloy-primitives/std", + "alloy-consensus/std", + "alloy-rpc-types-engine/std", + "futures/std", + "serde/std", + "thiserror/std", +] diff --git a/crates/engine/primitives/src/error.rs b/crates/engine/primitives/src/error.rs index 18e72fe83..7d4010cbc 100644 --- a/crates/engine/primitives/src/error.rs +++ b/crates/engine/primitives/src/error.rs @@ -1,3 +1,4 @@ +use alloc::boxed::Box; use alloy_rpc_types_engine::ForkchoiceUpdateError; /// Represents all error cases when handling a new payload. diff --git a/crates/engine/primitives/src/event.rs b/crates/engine/primitives/src/event.rs index 20b41d414..1afed370d 100644 --- a/crates/engine/primitives/src/event.rs +++ b/crates/engine/primitives/src/event.rs @@ -1,16 +1,16 @@ //! Events emitted by the beacon consensus engine. use crate::ForkchoiceStatus; +use alloc::{boxed::Box, sync::Arc}; use alloy_consensus::BlockHeader; use alloy_primitives::B256; use alloy_rpc_types_engine::ForkchoiceState; -use reth_primitives::{EthPrimitives, SealedBlock}; -use reth_primitives_traits::{NodePrimitives, SealedHeader}; -use std::{ +use core::{ fmt::{Display, Formatter, Result}, - sync::Arc, time::Duration, }; +use reth_primitives::{EthPrimitives, SealedBlock}; +use reth_primitives_traits::{NodePrimitives, SealedHeader}; /// Events emitted by the consensus engine. #[derive(Clone, Debug)] diff --git a/crates/engine/primitives/src/lib.rs b/crates/engine/primitives/src/lib.rs index 1def1a67e..714b410af 100644 --- a/crates/engine/primitives/src/lib.rs +++ b/crates/engine/primitives/src/lib.rs @@ -7,6 +7,9 @@ )] #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate alloc; mod error; diff --git a/crates/engine/primitives/src/message.rs b/crates/engine/primitives/src/message.rs index 6e4f46292..d055d4e42 100644 --- a/crates/engine/primitives/src/message.rs +++ b/crates/engine/primitives/src/message.rs @@ -6,15 +6,15 @@ use alloy_rpc_types_engine::{ ExecutionPayload, ExecutionPayloadSidecar, ForkChoiceUpdateResult, ForkchoiceState, ForkchoiceUpdateError, ForkchoiceUpdated, PayloadId, PayloadStatus, PayloadStatusEnum, }; -use futures::{future::Either, FutureExt, TryFutureExt}; -use reth_errors::RethResult; -use reth_payload_builder_primitives::PayloadBuilderError; -use std::{ - fmt::Display, +use core::{ + fmt::{self, Display}, future::Future, pin::Pin, task::{ready, Context, Poll}, }; +use futures::{future::Either, FutureExt, TryFutureExt}; +use reth_errors::RethResult; +use reth_payload_builder_primitives::PayloadBuilderError; use tokio::sync::{mpsc::UnboundedSender, oneshot}; /// Represents the outcome of forkchoice update. @@ -168,7 +168,7 @@ pub enum BeaconEngineMessage { } impl Display for BeaconEngineMessage { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::NewPayload { payload, .. } => { write!(