mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: make op-evm compile with no-std (#11834)
This commit is contained in:
@ -37,7 +37,7 @@ revm.workspace = true
|
||||
revm-primitives.workspace = true
|
||||
|
||||
# misc
|
||||
thiserror.workspace = true
|
||||
derive_more.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
@ -51,6 +51,8 @@ alloy-genesis.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = []
|
||||
optimism = [
|
||||
"reth-primitives/optimism",
|
||||
"reth-execution-types/optimism",
|
||||
|
||||
@ -1,27 +1,30 @@
|
||||
//! Error types for the Optimism EVM module.
|
||||
|
||||
use alloc::string::String;
|
||||
use reth_evm::execute::BlockExecutionError;
|
||||
|
||||
/// Optimism Block Executor Errors
|
||||
#[derive(thiserror::Error, Debug, Clone, PartialEq, Eq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, derive_more::Display)]
|
||||
pub enum OptimismBlockExecutionError {
|
||||
/// Error when trying to parse L1 block info
|
||||
#[error("could not get L1 block info from L2 block: {message:?}")]
|
||||
#[display("could not get L1 block info from L2 block: {message}")]
|
||||
L1BlockInfoError {
|
||||
/// The inner error message
|
||||
message: String,
|
||||
},
|
||||
/// Thrown when force deploy of create2deployer code fails.
|
||||
#[error("failed to force create2deployer account code")]
|
||||
#[display("failed to force create2deployer account code")]
|
||||
ForceCreate2DeployerFail,
|
||||
/// Thrown when a blob transaction is included in a sequencer's block.
|
||||
#[error("blob transaction included in sequencer block")]
|
||||
#[display("blob transaction included in sequencer block")]
|
||||
BlobTransactionRejected,
|
||||
/// Thrown when a database account could not be loaded.
|
||||
#[error("failed to load account {0}")]
|
||||
#[display("failed to load account {_0}")]
|
||||
AccountLoadFailed(alloy_primitives::Address),
|
||||
}
|
||||
|
||||
impl core::error::Error for OptimismBlockExecutionError {}
|
||||
|
||||
impl From<OptimismBlockExecutionError> for BlockExecutionError {
|
||||
fn from(err: OptimismBlockExecutionError) -> Self {
|
||||
Self::other(err)
|
||||
|
||||
@ -3,8 +3,10 @@
|
||||
use crate::{
|
||||
l1::ensure_create2_deployer, OpChainSpec, OptimismBlockExecutionError, OptimismEvmConfig,
|
||||
};
|
||||
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||
use alloy_consensus::Transaction as _;
|
||||
use alloy_primitives::{BlockNumber, U256};
|
||||
use core::fmt::Display;
|
||||
use reth_chainspec::{ChainSpec, EthereumHardforks};
|
||||
use reth_evm::{
|
||||
execute::{
|
||||
@ -27,7 +29,6 @@ use revm_primitives::{
|
||||
db::{Database, DatabaseCommit},
|
||||
BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState,
|
||||
};
|
||||
use std::{fmt::Display, sync::Arc};
|
||||
use tracing::trace;
|
||||
|
||||
/// Provides executors to execute regular optimism blocks
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
//! Optimism-specific implementation and utilities for the executor
|
||||
|
||||
use crate::OptimismBlockExecutionError;
|
||||
use alloc::{string::ToString, sync::Arc};
|
||||
use alloy_primitives::{address, b256, hex, Address, Bytes, B256, U256};
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_execution_errors::BlockExecutionError;
|
||||
@ -11,7 +12,6 @@ use revm::{
|
||||
primitives::{Bytecode, HashMap, SpecId},
|
||||
DatabaseCommit, L1BlockInfo,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use tracing::trace;
|
||||
|
||||
/// The address of the create2 deployer
|
||||
|
||||
@ -6,9 +6,14 @@
|
||||
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
|
||||
)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
// The `optimism` feature must be enabled to use this crate.
|
||||
#![cfg(feature = "optimism")]
|
||||
|
||||
#[macro_use]
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::{sync::Arc, vec::Vec};
|
||||
use alloy_primitives::{Address, U256};
|
||||
use reth_evm::{ConfigureEvm, ConfigureEvmEnv, NextBlockEnvAttributes};
|
||||
use reth_optimism_chainspec::OpChainSpec;
|
||||
@ -18,7 +23,6 @@ use reth_primitives::{
|
||||
Head, Header, TransactionSigned,
|
||||
};
|
||||
use reth_revm::{inspector_handle_register, Database, Evm, EvmBuilder, GetInspector};
|
||||
use std::sync::Arc;
|
||||
|
||||
mod config;
|
||||
pub use config::{revm_spec, revm_spec_by_timestamp_after_bedrock};
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
//! Optimism block execution strategy,
|
||||
|
||||
use crate::{l1::ensure_create2_deployer, OptimismBlockExecutionError, OptimismEvmConfig};
|
||||
use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||
use alloy_consensus::Transaction as _;
|
||||
use core::fmt::Display;
|
||||
use reth_chainspec::EthereumHardforks;
|
||||
use reth_consensus::ConsensusError;
|
||||
use reth_evm::{
|
||||
@ -24,7 +26,6 @@ use reth_revm::{
|
||||
use revm_primitives::{
|
||||
db::DatabaseCommit, BlockEnv, CfgEnvWithHandlerCfg, EnvWithHandlerCfg, ResultAndState, U256,
|
||||
};
|
||||
use std::{fmt::Display, sync::Arc};
|
||||
use tracing::trace;
|
||||
|
||||
/// Factory for [`OpExecutionStrategy`].
|
||||
|
||||
Reference in New Issue
Block a user