Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "trevm"
version = "0.31.0"
version = "0.31.1"
rust-version = "1.83.0"
edition = "2021"
authors = ["init4"]
Expand Down
21 changes: 21 additions & 0 deletions src/fill/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ pub trait Tx: Send + Sync {
{
evm.ctx.modify_tx(|tx_env| self.fill_tx_env(tx_env));
}

/// Create a new [`TxEnv`] filled by this filler.
fn to_tx_env(&self) -> TxEnv {
let mut tx_env = TxEnv::default();
self.fill_tx_env(&mut tx_env);
tx_env
}
}

impl Tx for TxEnv {
Expand Down Expand Up @@ -83,6 +90,13 @@ pub trait Block: Send + Sync {
fn tx_count_hint(&self) -> Option<usize> {
None
}

/// Create a new [`BlockEnv`] filled by this filler.
fn to_block_env(&self) -> BlockEnv {
let mut block_env = BlockEnv::default();
self.fill_block_env(&mut block_env);
block_env
}
}

impl<T> Block for T
Expand Down Expand Up @@ -142,6 +156,13 @@ pub trait Cfg: Send + Sync {
{
evm.ctx.modify_cfg(|cfg_env| self.fill_cfg_env(cfg_env));
}

/// Create a new [`CfgEnv`] filled by this filler.
fn to_cfg_env(&self) -> CfgEnv {
let mut cfg_env = CfgEnv::default();
self.fill_cfg_env(&mut cfg_env);
cfg_env
}
}

impl Cfg for Arc<dyn Cfg> {
Expand Down
Loading