Skip to content

Commit

Permalink
Extract caller address from tx
Browse files Browse the repository at this point in the history
  • Loading branch information
jbargu committed May 31, 2024
1 parent 5c131d9 commit 659f7a1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/middleware/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,15 @@ impl Middleware for ArbiterMiddleware {
Some(&to) => TransactTo::Call(to.to_fixed_bytes().into()),
None => TransactTo::Create(CreateScheme::Create),
};

// Extract `from` field if it exists
let caller = match tx.from() {
Some(&from) => from.to_fixed_bytes().into(),
None => self.address().to_fixed_bytes().into(),
};

let tx_env = TxEnv {
caller: self.address().to_fixed_bytes().into(),
caller,
gas_limit: u64::MAX,
gas_price: revm::primitives::U256::from_limbs(self.get_gas_price().await?.0),
gas_priority_fee: None,
Expand Down

0 comments on commit 659f7a1

Please sign in to comment.