mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(no_std): Add no_std support for reth-ethereum-engine-primitives (#13931)
This commit is contained in:
@ -18,13 +18,13 @@ reth-engine-primitives.workspace = true
|
|||||||
reth-payload-primitives.workspace = true
|
reth-payload-primitives.workspace = true
|
||||||
reth-payload-validator.workspace = true
|
reth-payload-validator.workspace = true
|
||||||
reth-rpc-types-compat.workspace = true
|
reth-rpc-types-compat.workspace = true
|
||||||
alloy-rlp.workspace = true
|
|
||||||
reth-chain-state.workspace = true
|
reth-chain-state.workspace = true
|
||||||
|
|
||||||
# alloy
|
# alloy
|
||||||
alloy-primitives.workspace = true
|
alloy-primitives.workspace = true
|
||||||
alloy-eips.workspace = true
|
alloy-eips.workspace = true
|
||||||
alloy-rpc-types-engine.workspace = true
|
alloy-rpc-types-engine.workspace = true
|
||||||
|
alloy-rlp.workspace = true
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
@ -32,3 +32,17 @@ sha2.workspace = true
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["std"]
|
||||||
|
std = [
|
||||||
|
"reth-chainspec/std",
|
||||||
|
"reth-primitives/std",
|
||||||
|
"alloy-primitives/std",
|
||||||
|
"alloy-eips/std",
|
||||||
|
"alloy-rpc-types-engine/std",
|
||||||
|
"alloy-rlp/std",
|
||||||
|
"serde/std",
|
||||||
|
"sha2/std",
|
||||||
|
"serde_json/std",
|
||||||
|
]
|
||||||
|
|||||||
@ -7,8 +7,12 @@
|
|||||||
)]
|
)]
|
||||||
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
|
||||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
|
extern crate alloc;
|
||||||
|
|
||||||
mod payload;
|
mod payload;
|
||||||
|
use alloc::sync::Arc;
|
||||||
use alloy_rpc_types_engine::{ExecutionPayload, ExecutionPayloadSidecar, PayloadError};
|
use alloy_rpc_types_engine::{ExecutionPayload, ExecutionPayloadSidecar, PayloadError};
|
||||||
pub use alloy_rpc_types_engine::{
|
pub use alloy_rpc_types_engine::{
|
||||||
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,
|
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,
|
||||||
@ -24,13 +28,12 @@ use reth_payload_primitives::{
|
|||||||
use reth_payload_validator::ExecutionPayloadValidator;
|
use reth_payload_validator::ExecutionPayloadValidator;
|
||||||
use reth_primitives::{Block, NodePrimitives, SealedBlock};
|
use reth_primitives::{Block, NodePrimitives, SealedBlock};
|
||||||
use reth_rpc_types_compat::engine::payload::block_to_payload;
|
use reth_rpc_types_compat::engine::payload::block_to_payload;
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
/// The types used in the default mainnet ethereum beacon consensus engine.
|
/// The types used in the default mainnet ethereum beacon consensus engine.
|
||||||
#[derive(Debug, Default, Clone, serde::Deserialize, serde::Serialize)]
|
#[derive(Debug, Default, Clone, serde::Deserialize, serde::Serialize)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct EthEngineTypes<T: PayloadTypes = EthPayloadTypes> {
|
pub struct EthEngineTypes<T: PayloadTypes = EthPayloadTypes> {
|
||||||
_marker: std::marker::PhantomData<T>,
|
_marker: core::marker::PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: PayloadTypes> PayloadTypes for EthEngineTypes<T> {
|
impl<T: PayloadTypes> PayloadTypes for EthEngineTypes<T> {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
//! Contains types required for building a payload.
|
//! Contains types required for building a payload.
|
||||||
|
|
||||||
|
use alloc::{sync::Arc, vec::Vec};
|
||||||
use alloy_eips::{eip4844::BlobTransactionSidecar, eip4895::Withdrawals, eip7685::Requests};
|
use alloy_eips::{eip4844::BlobTransactionSidecar, eip4895::Withdrawals, eip7685::Requests};
|
||||||
use alloy_primitives::{Address, B256, U256};
|
use alloy_primitives::{Address, B256, U256};
|
||||||
use alloy_rlp::Encodable;
|
use alloy_rlp::Encodable;
|
||||||
@ -7,13 +8,13 @@ use alloy_rpc_types_engine::{
|
|||||||
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,
|
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,
|
||||||
ExecutionPayloadV1, PayloadAttributes, PayloadId,
|
ExecutionPayloadV1, PayloadAttributes, PayloadId,
|
||||||
};
|
};
|
||||||
|
use core::convert::Infallible;
|
||||||
use reth_chain_state::ExecutedBlock;
|
use reth_chain_state::ExecutedBlock;
|
||||||
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes};
|
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes};
|
||||||
use reth_primitives::{EthPrimitives, SealedBlock};
|
use reth_primitives::{EthPrimitives, SealedBlock};
|
||||||
use reth_rpc_types_compat::engine::payload::{
|
use reth_rpc_types_compat::engine::payload::{
|
||||||
block_to_payload_v1, block_to_payload_v3, convert_block_to_payload_field_v2,
|
block_to_payload_v1, block_to_payload_v3, convert_block_to_payload_field_v2,
|
||||||
};
|
};
|
||||||
use std::{convert::Infallible, sync::Arc};
|
|
||||||
|
|
||||||
/// Contains the built payload.
|
/// Contains the built payload.
|
||||||
///
|
///
|
||||||
@ -297,7 +298,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use alloy_eips::eip4895::Withdrawal;
|
use alloy_eips::eip4895::Withdrawal;
|
||||||
use alloy_primitives::B64;
|
use alloy_primitives::B64;
|
||||||
use std::str::FromStr;
|
use core::str::FromStr;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn attributes_serde() {
|
fn attributes_serde() {
|
||||||
|
|||||||
Reference in New Issue
Block a user