Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Restrict ContextPrecompiles only to EvmContext #1174

Merged
merged 3 commits into from
Mar 8, 2024
Merged

Conversation

rakita
Copy link
Member

@rakita rakita commented Mar 8, 2024

Making context precompiles take full context (External and Evm) would make a problem in Inspector

On main we have moved Precompiles from EvmContext and Inspector would not have access to it, this would break foundry and other tracers.

This PR make Context precompile access only EvmContext and makes no changes to Inspector.

EvmContext is now:

pub struct EvmContext<DB: Database> {
   pub inner: InnerEvmContext<DB>,
   /// Precompiles that are available for evm.
   pub precompiles: ContextPrecompiles<DB>,
}

and it implemented Deref and DerefMut on inner

Copy link
Contributor

github-actions bot commented Mar 8, 2024

Valgrind Results:

==4055== Cachegrind, a cache and branch-prediction profiler
==4055== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote et al.
==4055== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==4055== Command: target/release/snailtracer
==4055== 
--4055-- warning: L3 cache found, using its data for the LL simulation.
Snailtracer Host+Interpreter benchmark (2.1s) ...            not enough samples
==4055== 
==4055== I   refs:      463,577,654
==4055== I1  misses:          3,842
==4055== LLi misses:          2,986
==4055== I1  miss rate:        0.00%
==4055== LLi miss rate:        0.00%
==4055== 
==4055== D   refs:      237,187,082  (160,464,472 rd   + 76,722,610 wr)
==4055== D1  misses:        324,458  (    184,602 rd   +    139,856 wr)
==4055== LLd misses:        137,568  (      4,059 rd   +    133,509 wr)
==4055== D1  miss rate:         0.1% (        0.1%     +        0.2%  )
==4055== LLd miss rate:         0.1% (        0.0%     +        0.2%  )
==4055== 
==4055== LL refs:           328,300  (    188,444 rd   +    139,856 wr)
==4055== LL misses:         140,554  (      7,045 rd   +    133,509 wr)
==4055== LL miss rate:          0.0% (        0.0%     +        0.2%  )

crates/revm/src/context/evm_context.rs Outdated Show resolved Hide resolved
crates/revm/src/context/evm_context.rs Outdated Show resolved Hide resolved
@rakita rakita merged commit 44398e3 into main Mar 8, 2024
25 checks passed
@github-actions github-actions bot mentioned this pull request Mar 8, 2024
mattsse added a commit to paradigmxyz/revm-inspectors that referenced this pull request Mar 8, 2024
blocked by bluealloy/revm#1174

the `GethDefaultTracingOptions` dont have any effect on the call and
prestate tracer

this adds special functions for those tracers.

The prestate tracer can be simplified entirely and doesn't even have to
be a tracer I think, but need to handle that separately
@DaniPopes DaniPopes deleted the inner_evm_context branch March 13, 2024 23:38
fubuloubu pushed a commit to ApeWorX/revm that referenced this pull request Apr 11, 2024
* first stage move Precompiles inside EvmContext. Create InnerEvmContext

* Move precompiles and split InnerEvmContext to its file

* fix optimism, fmt and clippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants