Skip to content

Commit f82e063

Browse files
authored
Set chain id in simulation fillers (#95)
* fix: set chain id in gas estimation and call * fix: import * chore: version
1 parent 67050c7 commit f82e063

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "trevm"
3-
version = "0.20.1"
3+
version = "0.20.2"
44
rust-version = "1.83.0"
55
edition = "2021"
66
authors = ["init4"]

src/fill/fillers.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,19 @@ impl Cfg for GasEstimationFiller {
6868
cfg_env.disable_eip3607 = true;
6969
DisableNonceCheck.fill_cfg_env(cfg_env);
7070
}
71+
72+
fn fill_cfg<Db: revm::Database, Insp, Inst, Prec>(
73+
&self,
74+
evm: &mut revm::context::Evm<crate::helpers::Ctx<Db>, Insp, Inst, Prec>,
75+
) {
76+
evm.data.ctx.modify_cfg(|cfg_env| self.fill_cfg_env(cfg_env));
77+
78+
let chain_id = evm.data.ctx.cfg.chain_id;
79+
80+
evm.data.ctx.modify_tx(|tx_env| {
81+
tx_env.chain_id = Some(chain_id);
82+
});
83+
}
7184
}
7285

7386
#[cfg(feature = "estimate_gas")]
@@ -89,6 +102,19 @@ impl Cfg for CallFiller {
89102
cfg_env.disable_eip3607 = true;
90103
DisableNonceCheck.fill_cfg_env(cfg_env);
91104
}
105+
106+
fn fill_cfg<Db: revm::Database, Insp, Inst, Prec>(
107+
&self,
108+
evm: &mut revm::context::Evm<crate::helpers::Ctx<Db>, Insp, Inst, Prec>,
109+
) {
110+
evm.data.ctx.modify_cfg(|cfg_env| self.fill_cfg_env(cfg_env));
111+
112+
let chain_id = evm.data.ctx.cfg.chain_id;
113+
114+
evm.data.ctx.modify_tx(|tx_env| {
115+
tx_env.chain_id = Some(chain_id);
116+
});
117+
}
92118
}
93119

94120
#[cfg(feature = "call")]

0 commit comments

Comments
 (0)