Closed Wodann closed 5 months ago
revm
(sha: 1edfeb6
) has the following variations when the optimism
feature flag is enabled:
TxEnv
contains additional field optimism
for OptimismFields
. This also affects:
enum InvalidTransaction
: DepositSystemTxPostRegolith and HaltedDepositPostRegolithHaltReason::FailedDeposit
was addedSpecId
contains additional variants for optimism: bedrock, regolith, canyon, and ecotone. This also affects:
PrecompileSpecId
HandlerCfg
contains additional field is_optimism
for a boolean toggle between vanilla and optimism ethereumInnerEvmContext
contains additional field l1_block_info
In Rust:
When a dependency is used by multiple packages, Cargo will use the union of all features enabled on that dependency when building it. This helps ensure that only a single copy of the dependency is used.
As such, if we want to support both vanilla Ethereum and optimism, no matter what we do, we'll always be compiling revm
with optimism enabled. When scaling to even more chains, this would quickly explode the complexity of the revm
code.
My analysis of this design is that the complexity can be reduced by:
SpecId
s inside revm
directly, but using them as an external helper type that's specific for vanilla Ethereum vs optimism. Internally this would map to EIPs being toggled. The Evm
would then internally check whether an EIP is enabled.InnerEvmContext::l1_block_info
and TxEnv::optimism
to the external context (or a separate "chain context"). This would then be exposed to the handlers to enable different chains (incl. transaction types).is_optimism
as this would be signalled through a struct OptimismContext
.EvmBuilder
pattern.ExecutionResult
would need to be a generic in order to support different types of HaltReason
. The result type of transactions would be determined this way too.Evm
to work for a particular type of chain.This should be extensible to other chains - beyond optimism - as well.
See https://github.com/NomicFoundation/edr/issues/377#issuecomment-2098784211 for how we can work around the optimism
feature flag limitation.
With this in place, we should:
trait ChainSpec
which specifies typesThere is an optimism handle register with custom bytecodes
Can you expand on this?
There is an optimism handle register with custom bytecodes
Can you expand on this?
I fixed the wording. They're not custom bytecode. Rather, custom handler logic which is used in the EVM
Definition of Done