-
Notifications
You must be signed in to change notification settings - Fork 644
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
Generic transaction and block Environment. #916
Comments
Make Transaction generic contains tx type so we have a clean difference between transactions, currently we have done it ad hoc if field is |
Yeah, at least for the concrete types we would want something like this: /// Ethereum tx env
pub struct EthTxEnv {
// ... the tx env fields for mainnet ethereum
}
/// Data used to calculate the l1 cost of a transaction
pub struct RollupCostData {
/// The number of ones in the rlp encoding of the signed transaction being executed
pub ones: u64,
/// The number of zeroes in the rlp encoding of the signed transaction being executed
pub zeroes: u64,
}
/// Optimism tx env
pub struct OptimismTxEnv {
/// The underlying ethereum tx environment
pub eth_env: EthTxEnv,
// ... then the optimism specific fields
// ideally including this:
pub rollup_cost_data: RollupCostData,
} And each of these would implement an environment trait with methods to expose what we currently use in mainnet eth execution. We'd also want some flexibility, for example to let optimism actually use its custom tx env fields. revm/crates/primitives/src/env.rs Lines 84 to 94 in 7cf937a
revm/crates/primitives/src/env.rs Lines 207 to 212 in 7cf937a
revm/crates/revm/src/optimism/handler_register.rs Lines 125 to 150 in 7cf937a
Not sure how yet we could provide this flexibility, maybe adding some hooks that are run in the beginning of tx validation, or elsewhere |
This is imagined to be a |
I'll give this a shot |
Done on main |
After Evm builder is finished we should generalize the Block and Transaction to the trait, this would allow adding new fields to both of those structs and elevate usage of the External Contexts as it would allow multiple generics and easier integration with other types.
Evn should stay as the default type that we use, and this would be overridable in EvmBuilder.
The text was updated successfully, but these errors were encountered: