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(cheatcodes): add cheatcode to defer call to fork #9192

Open
bernard-wagner opened this issue Oct 24, 2024 · 1 comment
Open

feat(cheatcodes): add cheatcode to defer call to fork #9192

bernard-wagner opened this issue Oct 24, 2024 · 1 comment
Labels
A-cheatcodes Area: cheatcodes T-feature Type: feature T-to-discuss Type: requires discussion

Comments

@bernard-wagner
Copy link
Contributor

Component

Forge

Describe the feature you would like

There are already some thoughts given in #7262 to handle precompiles, but with more L2s implementing non-evm VMs (thinking mainly of Arbitrum Stylus) the issue is expanding past just precompiles.

As a more generic approach, it would be useful to mark a contract address or a call filter similar to vm.mockCall that defers execution to the fork endpoint.

vm.deferExecution(0x000000000000000000000000000000000000006C);

vm.deferExecution(0x000000000000000000000000000000000000006C, abi.encodeWithSignature('getPricesInWei()'));

When the interrupter encounters a call that is deferred it performs an eth_call against the fork-url on the fork block number. Ideally, there would be some additional caching.

Only static calls would be supported initially, as this is the most common use case and any state changes would be far more complex to handle (state overrides in eth_call and debug tracing to get any storage changes).

Additional context

No response

@bernard-wagner bernard-wagner added T-feature Type: feature T-needs-triage Type: this issue needs to be labelled labels Oct 24, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Oct 24, 2024
@zerosnacks
Copy link
Member

Would it be possible to use the vm.rpc cheatcode in combination with mockCall here to return the data received from vm.rpc?

@zerosnacks zerosnacks added the A-cheatcodes Area: cheatcodes label Oct 25, 2024
@zerosnacks zerosnacks changed the title feat(forge): Cheatcode to defer call to fork feat(cheatcodes): add cheatcode to defer call to fork Oct 25, 2024
@zerosnacks zerosnacks added T-to-discuss Type: requires discussion and removed T-needs-triage Type: this issue needs to be labelled labels Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cheatcodes Area: cheatcodes T-feature Type: feature T-to-discuss Type: requires discussion
Projects
Status: Todo
Development

No branches or pull requests

3 participants
@bernard-wagner @zerosnacks and others