Support custom backends in forge crate #9262
Labels
A-forge-builder
Area: forge-builder
A-internals
Area: internals
T-feature
Type: feature
T-post-V1
Area: to tackle after V1
Component
Forge
Describe the feature you would like
❓ What are we doing?
We are building tooling that gives smart contract developers ways to create and verify zk-proofs in Solidity. We are utilizing revm with custom revm inspectors. We want to make it easy for developers to test their smart contracts using
forge
.The problem
We have a few inspectors that are necessary for the vlayer contracts to work. There's currently no easy way to run forge with with custom revm inspectors.
What we had to do was copy a bunch of code to replace backend in test executor with our custom backend with custom revm inspector.
Unfortinately, it's very deep in the call tree with nested builders, which made it necessary for us to copy a lot of very slightly modified
forge
code.This makes it hard for us to keep it up to date with the current
foundry
codebase.Another big issue is the fact that there're a lot of large files in the
/bin
dir, with makes it impossible to import them in any other crate.Can it be improved?
Yes, we believe so! And we think that it would be useful for other developers, if the
forge
crate was more modular and easy to use.But talking solely about our use case, here's a minimal set of changes that would make our life much easier:
/bin/cmd
to/src/cmd
Executor
andExecutorBuilder
traitsdyn ExecutorBuilder
inTestArgs::execute_tests
and pass it down the treeExecutorBuilder::build()
would returnBox<dyn Executor>
Box<dyn Executor>
This way, we'd only need to reimplement
call_with_env
in the executor.We will be happy to discuss this proposal and prepare the pull request!
Additional context
No response
The text was updated successfully, but these errors were encountered: