Skip to content

Commit

Permalink
chore: make reth-ethereum-evm compile with no-std (#8935)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jun 18, 2024
1 parent 0f88965 commit 63248bc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/ethereum/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ reth-revm = { workspace = true, features = ["test-utils"] }
secp256k1.workspace = true
serde_json.workspace = true

[features]
default = ["std"]
std = []
3 changes: 3 additions & 0 deletions crates/ethereum/evm/src/eip6110.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use reth_evm::execute::BlockValidationError;
use reth_primitives::{Receipt, Request};
use revm_primitives::Log;

#[cfg(not(feature = "std"))]
use alloc::{string::ToString, vec::Vec};

sol! {
#[allow(missing_docs)]
event DepositEvent(
Expand Down
5 changes: 5 additions & 0 deletions crates/ethereum/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ use revm_primitives::{
db::{Database, DatabaseCommit},
BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState,
};

#[cfg(not(feature = "std"))]
use alloc::{sync::Arc, vec, vec::Vec};

#[cfg(feature = "std")]
use std::sync::Arc;

/// Provides executors to execute regular ethereum blocks
Expand Down
4 changes: 4 additions & 0 deletions crates/ethereum/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(not(feature = "std"))]
extern crate alloc;

use reth_chainspec::ChainSpec;
use reth_evm::{ConfigureEvm, ConfigureEvmEnv};
Expand Down

0 comments on commit 63248bc

Please sign in to comment.