feat(no_std): Add no_std support for reth-engine-primitives (#13924)

This commit is contained in:
Emilia Hane
2025-01-22 21:11:34 +01:00
committed by GitHub
parent 66fb8c8cac
commit 97851754df
5 changed files with 28 additions and 10 deletions

View File

@ -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",
]

View File

@ -1,3 +1,4 @@
use alloc::boxed::Box;
use alloy_rpc_types_engine::ForkchoiceUpdateError;
/// Represents all error cases when handling a new payload.

View File

@ -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)]

View File

@ -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;

View File

@ -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<Engine: EngineTypes> {
}
impl<Engine: EngineTypes> Display for BeaconEngineMessage<Engine> {
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!(