Sitelet https://github.com/init4tech/trevm/commit/6c0344237de6293c31f2a4291f0f959722b11b95
Skip to content

Commit 6c03442

Browse files
authored
feat: track caller on unwrap in filler (#145)
1 parent f4aee27 commit 6c03442

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

‎src/fill/alloy.rs‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ macro_rules! delegate_alloy_txs {
2323
delegate_alloy_txs!(@owned $target);
2424

2525
impl Tx for Signed<$target> {
26+
#[track_caller]
2627
fn fill_tx_env(&self, tx_env: &mut TxEnv) {
2728
let t = self.try_to_recovered_ref().unwrap();
2829
t.fill_tx_env(tx_env);
@@ -34,6 +35,7 @@ macro_rules! delegate_alloy_txs {
3435
delegate_alloy_txs!(@owned $target);
3536

3637
impl Tx for $target {
38+
#[track_caller]
3739
fn fill_tx_env(&self, tx_env: &mut TxEnv) {
3840
self.try_to_recovered_ref().unwrap().fill_tx_env(tx_env);
3941
}
@@ -445,21 +447,8 @@ impl Tx for alloy::rpc::types::TransactionRequest {
445447
*caller = self.from.unwrap_or_default();
446448

447449
// Determine the minimal tx type usable.
448-
*tx_type = {
449-
if self.transaction_type.is_some() {
450-
self.transaction_type.unwrap()
451-
} else if self.authorization_list.is_some() {
452-
TxType::Eip7702 as u8
453-
} else if self.has_eip4844_fields() {
454-
TxType::Eip4844 as u8
455-
} else if self.has_eip1559_fields() {
456-
TxType::Eip1559 as u8
457-
} else if self.access_list.is_some() {
458-
TxType::Eip2930 as u8
459-
} else {
460-
TxType::Legacy as u8
461-
}
462-
};
450+
*tx_type = self.transaction_type.unwrap_or_else(|| self.preferred_type() as u8);
451+
463452
*gas_limit = self.gas.unwrap_or(u64::MAX);
464453
*gas_price =
465454
self.gas_price.unwrap_or_default().max(self.max_fee_per_gas.unwrap_or_default());

0 commit comments

Comments
 (0)