Skip to content

Commit

Permalink
feat: Restrict ContextPrecompiles only to EvmContext (#1174)
Browse files Browse the repository at this point in the history
* first stage move Precompiles inside EvmContext. Create InnerEvmContext

* Move precompiles and split InnerEvmContext to its file

* fix optimism, fmt and clippy
  • Loading branch information
rakita authored Mar 8, 2024
1 parent 2f96098 commit 44398e3
Show file tree
Hide file tree
Showing 15 changed files with 923 additions and 820 deletions.
13 changes: 4 additions & 9 deletions crates/revm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ mod test {
primitives::{
address, AccountInfo, Address, Bytecode, Bytes, PrecompileResult, TransactTo, U256,
},
Context, ContextPrecompile, ContextStatefulPrecompile, Evm, EvmContext, InMemoryDB,
Context, ContextPrecompile, ContextStatefulPrecompile, Evm, InMemoryDB, InnerEvmContext,
};
use revm_interpreter::{Host, Interpreter};
use std::sync::Arc;
Expand Down Expand Up @@ -534,11 +534,7 @@ mod test {
// .with_db(..)
.build();

let Context {
external: _,
evm: EvmContext { db: _, .. },
..
} = evm.into_context();
let Context { external: _, .. } = evm.into_context();
}

#[test]
Expand All @@ -561,13 +557,12 @@ mod test {
fn build_custom_precompile() {
struct CustomPrecompile;

impl ContextStatefulPrecompile<EvmContext<EmptyDB>, ()> for CustomPrecompile {
impl ContextStatefulPrecompile<EmptyDB> for CustomPrecompile {
fn call(
&self,
_input: &Bytes,
_gas_price: u64,
_context: &mut EvmContext<EmptyDB>,
_extctx: &mut (),
_context: &mut InnerEvmContext<EmptyDB>,
) -> PrecompileResult {
Ok((10, Bytes::new()))
}
Expand Down
Loading

0 comments on commit 44398e3

Please sign in to comment.