feat(no_std): Add no_std support for reth-payload-primitives (#13922)

This commit is contained in:
Emilia Hane
2025-01-22 21:12:36 +01:00
committed by GitHub
parent 5238486882
commit 3e961806b6
6 changed files with 75 additions and 53 deletions

102
Cargo.lock generated
View File

@ -106,9 +106,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]]
name = "alloy-chains"
version = "0.1.56"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a725039ef382d1b6b4e2ebcb15b1efff6cde9af48c47a1bdce6fb67b9456c34b"
checksum = "4ab9d1367c6ffb90c93fb4a9a4989530aa85112438c6f73a734067255d348469"
dependencies = [
"alloy-primitives",
"alloy-rlp",
@ -366,7 +366,7 @@ dependencies = [
"foldhash",
"getrandom 0.2.15",
"hashbrown 0.15.2",
"indexmap 2.7.0",
"indexmap 2.7.1",
"itoa",
"k256",
"keccak-asm",
@ -712,7 +712,7 @@ dependencies = [
"alloy-sol-macro-input",
"const-hex",
"heck",
"indexmap 2.7.0",
"indexmap 2.7.1",
"proc-macro-error2",
"proc-macro2",
"quote",
@ -1437,7 +1437,7 @@ dependencies = [
"boa_interner",
"boa_macros",
"boa_string",
"indexmap 2.7.0",
"indexmap 2.7.1",
"num-bigint",
"rustc-hash 2.1.0",
]
@ -1463,7 +1463,7 @@ dependencies = [
"fast-float2",
"hashbrown 0.15.2",
"icu_normalizer",
"indexmap 2.7.0",
"indexmap 2.7.1",
"intrusive-collections",
"itertools 0.13.0",
"num-bigint",
@ -1509,7 +1509,7 @@ dependencies = [
"boa_gc",
"boa_macros",
"hashbrown 0.15.2",
"indexmap 2.7.0",
"indexmap 2.7.1",
"once_cell",
"phf",
"rustc-hash 2.1.0",
@ -1588,9 +1588,9 @@ dependencies = [
[[package]]
name = "brotli-decompressor"
version = "4.0.1"
version = "4.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362"
checksum = "74fa05ad7d803d413eb8380983b092cbbaf9a85f151b871360e7b00cd7060b37"
dependencies = [
"alloc-no-stdlib",
"alloc-stdlib",
@ -1705,7 +1705,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037"
dependencies = [
"camino",
"cargo-platform",
"semver 1.0.24",
"semver 1.0.25",
"serde",
"serde_json",
"thiserror 1.0.69",
@ -1835,9 +1835,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.26"
version = "4.5.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783"
checksum = "769b0145982b4b48713e01ec42d61614425f27b7058bda7180a3a41f30104796"
dependencies = [
"clap_builder",
"clap_derive",
@ -1845,9 +1845,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.26"
version = "4.5.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121"
checksum = "1b26884eb4b57140e4d2d93652abfa49498b938b3c9179f9fc487b0acc3edad7"
dependencies = [
"anstream",
"anstyle",
@ -2255,9 +2255,9 @@ dependencies = [
[[package]]
name = "crunchy"
version = "0.2.2"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929"
[[package]]
name = "crypto-bigint"
@ -3609,7 +3609,7 @@ dependencies = [
"futures-core",
"futures-sink",
"http",
"indexmap 2.7.0",
"indexmap 2.7.1",
"slab",
"tokio",
"tokio-util",
@ -4199,9 +4199,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.7.0"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652"
dependencies = [
"arbitrary",
"equivalent",
@ -4228,7 +4228,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "232929e1d75fe899576a3d5c7416ad0d88dbfbb3c3d6aa00873a7408a50ddb88"
dependencies = [
"ahash",
"indexmap 2.7.0",
"indexmap 2.7.1",
"is-terminal",
"itoa",
"log",
@ -4329,9 +4329,9 @@ dependencies = [
[[package]]
name = "ipnet"
version = "2.10.1"
version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708"
checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"
[[package]]
name = "iri-string"
@ -4345,13 +4345,13 @@ dependencies = [
[[package]]
name = "is-terminal"
version = "0.4.13"
version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
checksum = "e19b23d53f35ce9f56aebc7d1bb4e6ac1e9c0db7ac85c8d1760c04379edced37"
dependencies = [
"hermit-abi 0.4.0",
"libc",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@ -4927,7 +4927,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12779523996a67c13c84906a876ac6fe4d07a6e1adb54978378e13f199251a62"
dependencies = [
"base64 0.22.1",
"indexmap 2.7.0",
"indexmap 2.7.1",
"metrics",
"metrics-util",
"quanta",
@ -4959,7 +4959,7 @@ dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
"hashbrown 0.15.2",
"indexmap 2.7.0",
"indexmap 2.7.1",
"metrics",
"ordered-float",
"quanta",
@ -5434,8 +5434,10 @@ dependencies = [
"alloy-primitives",
"alloy-rpc-types-engine",
"alloy-serde",
"ethereum_ssz",
"op-alloy-consensus",
"serde",
"snap",
"thiserror 2.0.11",
]
@ -6300,9 +6302,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "regress"
version = "0.10.2"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f56e622c2378013c6c61e2bd776604c46dc1087b2dc5293275a0c20a44f0771"
checksum = "78ef7fa9ed0256d64a688a3747d0fef7a88851c18a5e1d57f115f38ec2e09366"
dependencies = [
"hashbrown 0.15.2",
"memchr",
@ -7686,7 +7688,7 @@ dependencies = [
"codspeed-criterion-compat",
"dashmap",
"derive_more",
"indexmap 2.7.0",
"indexmap 2.7.1",
"parking_lot",
"pprof",
"rand 0.8.5",
@ -9754,14 +9756,14 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
dependencies = [
"semver 1.0.24",
"semver 1.0.25",
]
[[package]]
name = "rustix"
version = "0.38.43"
version = "0.38.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6"
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
dependencies = [
"bitflags 2.8.0",
"errno",
@ -10035,9 +10037,9 @@ dependencies = [
[[package]]
name = "semver"
version = "1.0.24"
version = "1.0.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba"
checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03"
dependencies = [
"serde",
]
@ -10085,11 +10087,11 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.135"
version = "1.0.137"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b0d7ba2887406110130a978386c4e1befb98c674b4fba677954e4db976630d9"
checksum = "930cfb6e6abf99298aaad7d29abbef7a9999a9a8806a40088f55f0dcec03146b"
dependencies = [
"indexmap 2.7.0",
"indexmap 2.7.1",
"itoa",
"memchr",
"ryu",
@ -10138,7 +10140,7 @@ dependencies = [
"chrono",
"hex",
"indexmap 1.9.3",
"indexmap 2.7.0",
"indexmap 2.7.1",
"serde",
"serde_derive",
"serde_json",
@ -10312,9 +10314,9 @@ dependencies = [
[[package]]
name = "similar"
version = "2.6.0"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e"
checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
dependencies = [
"bstr",
"unicode-segmentation",
@ -10322,9 +10324,9 @@ dependencies = [
[[package]]
name = "similar-asserts"
version = "1.6.0"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfe85670573cd6f0fa97940f26e7e6601213c3b0555246c24234131f88c5709e"
checksum = "9f08357795f0d604ea7d7130f22c74b03838c959bdb14adde3142aab4d18a293"
dependencies = [
"console",
"serde",
@ -10514,9 +10516,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "symbolic-common"
version = "12.13.2"
version = "12.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8150eae9699e3c73a3e6431dc1f80d87748797c0457336af23e94c1de619ed24"
checksum = "13a4dfe4bbeef59c1f32fc7524ae7c95b9e1de5e79a43ce1604e181081d71b0c"
dependencies = [
"debugid",
"memmap2",
@ -10526,9 +10528,9 @@ dependencies = [
[[package]]
name = "symbolic-demangle"
version = "12.13.2"
version = "12.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95f4a9846f7a8933b6d198c022faa2c9bd89e1a970bed9d9a98d25708bf8de17"
checksum = "98cf6a95abff97de4d7ff3473f33cacd38f1ddccad5c1feab435d6760300e3b6"
dependencies = [
"cpp_demangle",
"rustc-demangle",
@ -10963,7 +10965,7 @@ version = "0.22.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
dependencies = [
"indexmap 2.7.0",
"indexmap 2.7.1",
"serde",
"serde_spanned",
"toml_datetime",
@ -11376,9 +11378,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
version = "1.12.0"
version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "744018581f9a3454a9e15beb8a33b017183f1e7c0cd170232a2d1453b23a51c4"
checksum = "b3758f5e68192bb96cc8f9b7e2c2cfdabb435499a28499a42f8f984092adad4b"
dependencies = [
"getrandom 0.2.15",
]

View File

@ -35,4 +35,16 @@ tokio = { workspace = true, default-features = false, features = ["sync"] }
assert_matches.workspace = true
[features]
default = ["std"]
std = [
"reth-chainspec/std",
"reth-primitives/std",
"revm-primitives/std",
"alloy-eips/std",
"alloy-primitives/std",
"alloy-rpc-types-engine/std",
"op-alloy-rpc-types-engine?/std",
"serde/std",
"thiserror/std",
]
op = ["dep:op-alloy-rpc-types-engine"]

View File

@ -1,5 +1,6 @@
//! Error types emitted by types or implementations of this crate.
use alloc::boxed::Box;
use alloy_primitives::B256;
use alloy_rpc_types_engine::ForkchoiceUpdateError;
use reth_errors::{ProviderError, RethError};

View File

@ -7,7 +7,11 @@
)]
#![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;
use crate::alloc::string::ToString;
use alloy_primitives::Bytes;
use reth_chainspec::EthereumHardforks;

View File

@ -1,4 +1,5 @@
use crate::{MessageValidationKind, PayloadAttributes};
use alloc::vec::Vec;
use alloy_eips::eip4895::Withdrawal;
use alloy_primitives::B256;
use alloy_rpc_types_engine::ExecutionPayload;

View File

@ -1,15 +1,17 @@
use alloc::vec::Vec;
use alloy_eips::{
eip4895::{Withdrawal, Withdrawals},
eip7685::Requests,
};
use alloy_primitives::{Address, B256, U256};
use alloy_rpc_types_engine::{PayloadAttributes as EthPayloadAttributes, PayloadId};
use core::fmt;
use reth_chain_state::ExecutedBlock;
use reth_primitives::{NodePrimitives, SealedBlock};
/// Represents a built payload type that contains a built `SealedBlock` and can be converted into
/// engine API execution payloads.
pub trait BuiltPayload: Send + Sync + std::fmt::Debug {
pub trait BuiltPayload: Send + Sync + fmt::Debug {
/// The node's primitive types
type Primitives: NodePrimitives;
@ -32,7 +34,7 @@ pub trait BuiltPayload: Send + Sync + std::fmt::Debug {
///
/// This is used as a conversion type, transforming a payload attributes type that the engine API
/// receives, into a type that the payload builder can use.
pub trait PayloadBuilderAttributes: Send + Sync + std::fmt::Debug {
pub trait PayloadBuilderAttributes: Send + Sync + fmt::Debug {
/// The payload attributes that can be used to construct this type. Used as the argument in
/// [`PayloadBuilderAttributes::try_new`].
type RpcPayloadAttributes;
@ -77,7 +79,7 @@ pub trait PayloadBuilderAttributes: Send + Sync + std::fmt::Debug {
///
/// This type is emitted as part of the forkchoiceUpdated call
pub trait PayloadAttributes:
serde::de::DeserializeOwned + serde::Serialize + std::fmt::Debug + Clone + Send + Sync + 'static
serde::de::DeserializeOwned + serde::Serialize + fmt::Debug + Clone + Send + Sync + 'static
{
/// Returns the timestamp to be used in the payload job.
fn timestamp(&self) -> u64;