Skip to content

Commit 3d2afe0

Browse files
authored
fix: provide the sender when converting to request (#12473)
* fix: provide the sender when converting to request * rm track * fix
1 parent fa2f0d1 commit 3d2afe0

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/evm/core/src/utils.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ pub fn get_function<'a>(
141141
pub fn configure_tx_env(env: &mut EnvMut<'_>, tx: &Transaction<AnyTxEnvelope>) {
142142
let from = tx.from();
143143
if let AnyTxEnvelope::Ethereum(tx) = &tx.inner.inner() {
144-
configure_tx_req_env(env, &tx.clone().into(), Some(from)).expect("cannot fail");
144+
configure_tx_req_env(
145+
env,
146+
&TransactionRequest::from_transaction_with_sender(tx.clone(), from),
147+
Some(from),
148+
)
149+
.expect("cannot fail");
145150
}
146151
}
147152

@@ -180,8 +185,11 @@ pub fn configure_tx_req_env(
180185
env.tx.kind = to.unwrap_or(TxKind::Create);
181186
// If the transaction is impersonated, we need to set the caller to the from
182187
// address Ref: https://github.com/foundry-rs/foundry/issues/9541
183-
env.tx.caller =
184-
impersonated_from.unwrap_or(from.ok_or_else(|| eyre::eyre!("missing `from` field"))?);
188+
env.tx.caller = if let Some(caller) = impersonated_from {
189+
caller
190+
} else {
191+
from.ok_or_else(|| eyre::eyre!("missing `from` field"))?
192+
};
185193
env.tx.gas_limit = gas.ok_or_else(|| eyre::eyre!("missing `gas` field"))?;
186194
env.tx.nonce = nonce.unwrap_or_default();
187195
env.tx.value = value.unwrap_or_default();

0 commit comments

Comments
 (0)