Skip to content

Commit ed86c64

Browse files
authored
chore: use existing minimal_tx_type fn (#10826)
1 parent e6de72c commit ed86c64

File tree

1 file changed

+3
-24
lines changed
  • crates/anvil/src/eth/backend/mem

1 file changed

+3
-24
lines changed

crates/anvil/src/eth/backend/mem/mod.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,7 @@ use alloy_consensus::{
3939
Account, BlockHeader, EnvKzgSettings, Header, Receipt, ReceiptWithBloom, Signed,
4040
Transaction as TransactionTrait, TxEnvelope,
4141
};
42-
use alloy_eips::{
43-
eip1559::BaseFeeParams,
44-
eip2718::{
45-
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
46-
LEGACY_TX_TYPE_ID,
47-
},
48-
eip7840::BlobParams,
49-
};
42+
use alloy_eips::{eip1559::BaseFeeParams, eip7840::BlobParams};
5043
use alloy_evm::{eth::EthEvmContext, precompiles::PrecompilesMap, Database, Evm};
5144
use alloy_network::{
5245
AnyHeader, AnyRpcBlock, AnyRpcHeader, AnyRpcTransaction, AnyTxEnvelope, AnyTxType,
@@ -1443,6 +1436,8 @@ impl Backend {
14431436
fee_details: FeeDetails,
14441437
block_env: BlockEnv,
14451438
) -> Env {
1439+
let tx_type = request.minimal_tx_type() as u8;
1440+
14461441
let WithOtherFields::<TransactionRequest> {
14471442
inner:
14481443
TransactionRequest {
@@ -1458,27 +1453,11 @@ impl Backend {
14581453
sidecar: _,
14591454
chain_id,
14601455
transaction_type,
1461-
max_fee_per_gas,
1462-
max_priority_fee_per_gas,
14631456
.. // Rest of the gas fees related fields are taken from `fee_details`
14641457
},
14651458
other,
14661459
} = request;
14671460

1468-
let tx_type = transaction_type.unwrap_or_else(|| {
1469-
if authorization_list.is_some() {
1470-
EIP7702_TX_TYPE_ID
1471-
} else if blob_versioned_hashes.is_some() {
1472-
EIP4844_TX_TYPE_ID
1473-
} else if max_fee_per_gas.is_some() || max_priority_fee_per_gas.is_some() {
1474-
EIP1559_TX_TYPE_ID
1475-
} else if access_list.is_some() {
1476-
EIP2930_TX_TYPE_ID
1477-
} else {
1478-
LEGACY_TX_TYPE_ID
1479-
}
1480-
});
1481-
14821461
let FeeDetails {
14831462
gas_price,
14841463
max_fee_per_gas,

0 commit comments

Comments
 (0)