Open tcoratger opened 5 months ago
this issue is mostly solved for execution via:
which does not require any evm
but we still have it in rpc.
if we look at the most common usecase, eth_call/tracing then this follows this pattern:
so ideally transact
and inspect would be part of the high level interface of the type responsible for this.
there's perhaps a use case to do a tiered abstraction:
transact(tx, BlockId)
@mattsse Would you agree with the following changes:
EvmContext
to EvmConfig
, which returns the current context (including any external context which we don't have for now).EvmConfig
, returning a EvmExecutionAndState
(placeholder) instance. Should EvmExecutionAndState
be an associated type of EvmConfig
?EvmExecutionAndState
.Should EvmExecutionAndState be an associated type
I believe so
Update EvmContext to EvmConfig, which returns the current context (including any external context which we don't have for now).
I think that makes sense.
I'd try to model this from the transact/execute pov, for example executing a transaction generally works as follows:
revm::Database
)so a model for this could look smth like:
trait Executor {
type Input;
type Output;
type Config; // though this could be part of input
}
this is similar what we have here https://github.com/paradigmxyz/reth/blob/70b6bc45ad9c61ef1e64697d59fb975169df2df4/crates/evm/src/execute.rs#L11-L15
Describe the feature
At the moment,
ConfigureEvm
traithttps://github.com/paradigmxyz/reth/blob/dd2113173e4408e0565c5edda439c1b15092ed8e/crates/evm/src/lib.rs#L26-L93
implements methods that return
Evm
which is a structure of revm implementation.In order to be able to support other implementations of the EVM, like the one written in Cairo by Kakarot for example (https://github.com/kkrt-labs/kakarot) we would like to add a level of abstraction around the type of elements returned by
ConfigureEvm
. This would allow any EVM implementation to easily plug into reth and run with all other elements of the stack smoothly. As a first draft, we thought of the following two features that could be implemented and returned by the various methods ofConfigureEvm
in order to add this missing level of abstraction:into_db_and_env_with_handler_cfg
: Returns the database and EVM environment configured with the chain spec ID.EvmContext
trait provides access to various environments and configurations necessary for generating and managing the EVM. It includes methods for accessing and modifying the EVM configuration, transaction environment, and block environment. It also handles setting and retrieving the EVM's specification ID.cfg
andcfg_mut
: Get and set the EVM configuration environment (CfgEnv
).tx
andtx_mut
: Get and set the transaction environment (TxEnv
).block
andblock_mut
: Get and set the block environment (BlockEnv
).spec_id
andwith_spec_id
: Get and set the EVM specification ID (SpecId
).cc @greged93 @mattsse
Additional context
No response