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(anvil): use ContextPrecompile instead of Precompile in Anvil's precompile injection API #7703

Open
Tracked by #8269
alexfertel opened this issue Apr 18, 2024 · 3 comments
Labels
A-compatibility Area: compatibility C-anvil Command: anvil T-feature Type: feature

Comments

@alexfertel
Copy link
Contributor

Component

Anvil

Describe the feature you would like

We've been using the new precompile injection API created in #7589, and it's working well.

After some use, the need for ContextPrecompile arose: we needed a way to get the code of an account, and with the params of Precompile, this can't be done. If I understand correctly the implementation in revm, ContextPrecompile does give access to account state through InnerEvmContext::code_hash.

Since ContextPrecompile is a superset of Precompile, this should be fine. I tried making an initial PoC, but the generics of ContextPrecompile<DB: Database> get a bit in the way.

Current workaround is creating a provider inside the precompile and making a get_code_at async call. This works fine, it's just that it's a bit awkward having to make an RPC call, when we are executing in the context of an EVM.

Additional context

No response

@alexfertel alexfertel added the T-feature Type: feature label Apr 18, 2024
@palango
Copy link

palango commented May 29, 2024

I'm also facing the same issue, needing to create a precompile that has (write)access to state.

The workaround mentioned above unfortunately doesn't work, as I need low level access to accounts. Is there an obvious way to satisfy the DB constraint without pulling it through the whole codebase?

@pahor167
Copy link

Unfortunately this is blocking us from fully onboarding Anvil for Celo. Is there any chance that this feature will be addressed any time soon ? @gakonst

@shazarre
Copy link

hey @mattsse @onbjerg @Evalir @DaniPopes any chance this could be implemented any time soon? we're currently migrating our tests to anvil and this is blocking us as well

thanks in advance for looking into it!

@zerosnacks zerosnacks added the C-anvil Command: anvil label Jun 27, 2024
@zerosnacks zerosnacks added the A-compatibility Area: compatibility label Jul 15, 2024
@zerosnacks zerosnacks changed the title Use ContextPrecompile instead of Precompile in Anvil's precompile injection API feat(anvil): use ContextPrecompile instead of Precompile in Anvil's precompile injection API Jul 15, 2024
@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@jenpaff jenpaff removed this from the v1.0.0 milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compatibility Area: compatibility C-anvil Command: anvil T-feature Type: feature
Projects
None yet
Development

No branches or pull requests

6 participants