From f85a2fc499c9c8ed780b953268b8fb2ffb478fe8 Mon Sep 17 00:00:00 2001 From: rakita Date: Thu, 3 Oct 2024 13:29:32 +0200 Subject: [PATCH] fix some panics --- crates/statetest-types/src/transaction.rs | 6 ++++-- crates/wiring/src/default/tx.rs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/statetest-types/src/transaction.rs b/crates/statetest-types/src/transaction.rs index 692d848308..ca080f8daf 100644 --- a/crates/statetest-types/src/transaction.rs +++ b/crates/statetest-types/src/transaction.rs @@ -41,8 +41,10 @@ impl TransactionParts { let mut tx_type = TransactionType::Legacy; // if it has access list it is EIP-2930 tx - if self.access_lists.get(access_list_index).is_some() { - tx_type = TransactionType::Eip2930; + if let Some(access_list) = self.access_lists.get(access_list_index) { + if access_list.is_some() { + tx_type = TransactionType::Eip2930; + } } // If there is max_fee it is EIP-1559 tx diff --git a/crates/wiring/src/default/tx.rs b/crates/wiring/src/default/tx.rs index bf531fa252..636817aea2 100644 --- a/crates/wiring/src/default/tx.rs +++ b/crates/wiring/src/default/tx.rs @@ -148,7 +148,7 @@ impl LegacyTx for TxEnv { } fn gas_price(&self) -> u128 { - self.gas_price.to() + self.gas_price.try_into().unwrap_or(u128::MAX) } }