Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ members = [
"examples/uniswap_v2_usdc_swap",
"examples/erc20_gas",
"examples/my_evm",
#"examples/custom_opcodes",
"examples/custom_opcodes",
]
resolver = "2"
default-members = ["crates/revm"]
Expand Down
18 changes: 14 additions & 4 deletions crates/context/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@ pub struct EvmData<CTX, INSP> {
pub inspector: INSP,
}

impl<CTX> Evm<CTX, (), (), ()> {
pub fn new(ctx: CTX) -> Self {
impl<CTX, I, P> Evm<CTX, (), I, P> {
pub fn new(ctx: CTX, instruction: I, precompiles: P) -> Evm<CTX, (), I, P> {
Evm {
data: EvmData { ctx, inspector: () },
instruction: (),
precompiles: (),
instruction,
precompiles,
}
}
}

impl<CTX, I, INSP, P> Evm<CTX, INSP, I, P> {
pub fn new_with_inspector(ctx: CTX, inspector: INSP, instruction: I, precompiles: P) -> Self {
Evm {
data: EvmData { ctx, inspector },
instruction,
precompiles,
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions crates/handler/src/evm.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::{
instructions::{EthInstructions, InstructionProvider},
EthFrame, Handler, MainnetHandler, PrecompileProvider,
instructions::InstructionProvider, EthFrame, Handler, MainnetHandler, PrecompileProvider,
};
use auto_impl::auto_impl;
use context::{
Expand Down Expand Up @@ -136,10 +135,10 @@ where
}
}

impl<CTX, INSP, PRECOMPILES> ExecuteEvm
for Evm<CTX, INSP, EthInstructions<EthInterpreter, CTX>, PRECOMPILES>
impl<CTX, INSP, INST, PRECOMPILES> ExecuteEvm for Evm<CTX, INSP, INST, PRECOMPILES>
where
CTX: ContextTr<Journal: JournalTr<FinalOutput = JournalOutput>> + ContextSetters,
INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,
{
type Output = Result<
Expand All @@ -165,11 +164,11 @@ where
}
}

impl<CTX, INSP, PRECOMPILES> ExecuteCommitEvm
for Evm<CTX, INSP, EthInstructions<EthInterpreter, CTX>, PRECOMPILES>
impl<CTX, INSP, INST, PRECOMPILES> ExecuteCommitEvm for Evm<CTX, INSP, INST, PRECOMPILES>
where
CTX: ContextTr<Journal: JournalTr<FinalOutput = JournalOutput>, Db: DatabaseCommit>
+ ContextSetters,
INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,
{
type CommitOutput = Result<
Expand Down
5 changes: 5 additions & 0 deletions crates/inspector/src/eip3155.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ impl TracerEip3155 {
Self::new(Box::new(std::io::BufWriter::new(output)))
}

/// Creates a new EIP-3155 tracer with a stdout output.
pub fn new_stdout() -> Self {
Self::buffered(std::io::stdout())
}

/// Creates a new EIP-3155 tracer with the given output writer.
pub fn new(output: Box<dyn Write>) -> Self {
Self {
Expand Down
10 changes: 5 additions & 5 deletions crates/inspector/src/mainnet_inspect.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use context::{ContextSetters, ContextTr, Evm, JournalOutput, JournalTr};
use database_interface::DatabaseCommit;
use handler::{
instructions::EthInstructions, EthFrame, EvmTr, EvmTrError, Frame, FrameResult, Handler,
instructions::InstructionProvider, EthFrame, EvmTr, EvmTrError, Frame, FrameResult, Handler,
MainnetHandler, PrecompileProvider,
};
use interpreter::{interpreter::EthInterpreter, FrameInput, InterpreterResult};
Expand All @@ -24,11 +24,11 @@ where
type IT = EthInterpreter;
}

impl<CTX, INSP, PRECOMPILES> InspectEvm
for Evm<CTX, INSP, EthInstructions<EthInterpreter, CTX>, PRECOMPILES>
impl<CTX, INSP, INST, PRECOMPILES> InspectEvm for Evm<CTX, INSP, INST, PRECOMPILES>
where
CTX: ContextSetters + ContextTr<Journal: JournalTr<FinalOutput = JournalOutput> + JournalExt>,
INSP: Inspector<CTX, EthInterpreter>,
INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,
{
type Inspector = INSP;
Expand All @@ -46,12 +46,12 @@ where
}
}

impl<CTX, INSP, PRECOMPILES> InspectCommitEvm
for Evm<CTX, INSP, EthInstructions<EthInterpreter, CTX>, PRECOMPILES>
impl<CTX, INSP, INST, PRECOMPILES> InspectCommitEvm for Evm<CTX, INSP, INST, PRECOMPILES>
where
CTX: ContextSetters
+ ContextTr<Journal: JournalTr<FinalOutput = JournalOutput> + JournalExt, Db: DatabaseCommit>,
INSP: Inspector<CTX, EthInterpreter>,
INST: InstructionProvider<Context = CTX, InterpreterTypes = EthInterpreter>,
PRECOMPILES: PrecompileProvider<CTX, Output = InterpreterResult>,
{
fn inspect_commit_previous(&mut self) -> Self::CommitOutput {
Expand Down
3 changes: 1 addition & 2 deletions examples/custom_opcodes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ rust_2018_idioms = "deny"
all = "warn"

[dependencies]
revm.workspace = true
database.workspace = true
revm = {workspace = true, features = ["std", "serde-json"]}
Loading
Loading