Revm Framework
Creating new variant of Revm is done by using a framework that is provided by the project. The framework is a set of traits that can be overridden to create a new logic that is needed. Overriding those traits can add new precompile or omit/change some logic of the EVM.
The main traits that are used for creating a new variant are:
Steps to implement a new variant:
- Include Revm
- Add main Evm type
MyEvm
and give it a Context, Precompile, Instructions and optionally Inspector. - Implement EvmTr for
MyEvm
. - Create a empty
MyEvmHandler
type and implementHandler for it. Override any logic that you want. - Now you can use
MyEvmHandler
to run your ownMyEvm
instance. Other steps are more for agronomics and easier usage. - Create a
MyContextBuilder
trait that will build your context with default types you want to use. - Create a
MyEvmBuilder
trait that will build your Evm with default instructions and precompiles. - Implement
ExecuteEvm
,ExecuteCommitEvm
to have same interface as any other variant of EVM.