Skip to content
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

Remove FillableTransaction trait #8776

Closed
Tracked by #8988
emhane opened this issue Jun 12, 2024 · 0 comments · Fixed by #8800 or #8887
Closed
Tracked by #8988

Remove FillableTransaction trait #8776

emhane opened this issue Jun 12, 2024 · 0 comments · Fixed by #8800 or #8887
Assignees
Labels
A-op-reth Related to Optimism and op-reth A-rpc Related to the RPC implementation C-debt Refactor of code section that is hard to understand or maintain

Comments

@emhane
Copy link
Member

emhane commented Jun 12, 2024

Describe the feature

FillableTransaction trait should be incorporated into ConfigureEvmEnv trait.

/// Helper type to work with different transaction types when configuring the EVM env.
///
/// This makes it easier to handle errors.
pub trait FillableTransaction {
/// Returns the hash of the transaction.
fn hash(&self) -> TxHash;
/// Fill the transaction environment with the given transaction.
fn try_fill_tx_env(&self, tx_env: &mut TxEnv) -> EthResult<()>;
}

reth/crates/evm/src/lib.rs

Lines 96 to 123 in 0de932d

/// This represents the set of methods used to configure the EVM's environment before block
/// execution.
pub trait ConfigureEvmEnv: Send + Sync + Unpin + Clone + 'static {
/// Fill transaction environment from a [`TransactionSigned`] and the given sender address.
fn fill_tx_env(tx_env: &mut TxEnv, transaction: &TransactionSigned, sender: Address);
/// Fill [`CfgEnvWithHandlerCfg`] fields according to the chain spec and given header
fn fill_cfg_env(
cfg_env: &mut CfgEnvWithHandlerCfg,
chain_spec: &ChainSpec,
header: &Header,
total_difficulty: U256,
);
/// Convenience function to call both [`fill_cfg_env`](ConfigureEvmEnv::fill_cfg_env) and
/// [`fill_block_env`].
fn fill_cfg_and_block_env(
cfg: &mut CfgEnvWithHandlerCfg,
block_env: &mut BlockEnv,
chain_spec: &ChainSpec,
header: &Header,
total_difficulty: U256,
) {
Self::fill_cfg_env(cfg, chain_spec, header, total_difficulty);
let after_merge = cfg.handler_cfg.spec_id >= SpecId::MERGE;
fill_block_env(block_env, chain_spec, header, after_merge);
}
}

Additional context

No response

@emhane emhane added C-debt Refactor of code section that is hard to understand or maintain A-rpc Related to the RPC implementation A-op-reth Related to Optimism and op-reth labels Jun 12, 2024
@emhane emhane self-assigned this Jun 12, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Reth Tracker Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-op-reth Related to Optimism and op-reth A-rpc Related to the RPC implementation C-debt Refactor of code section that is hard to understand or maintain
Projects
Archived in project
1 participant