@@ -42,7 +42,14 @@ use alloy_consensus::{
42
42
Account , BlockHeader , EnvKzgSettings , Header , Receipt , ReceiptWithBloom , Signed ,
43
43
Transaction as TransactionTrait , TxEnvelope ,
44
44
} ;
45
- use alloy_eips:: { eip1559:: BaseFeeParams , eip4844:: MAX_BLOBS_PER_BLOCK } ;
45
+ use alloy_eips:: {
46
+ eip1559:: BaseFeeParams ,
47
+ eip2718:: {
48
+ EIP1559_TX_TYPE_ID , EIP2930_TX_TYPE_ID , EIP4844_TX_TYPE_ID , EIP7702_TX_TYPE_ID ,
49
+ LEGACY_TX_TYPE_ID ,
50
+ } ,
51
+ eip4844:: MAX_BLOBS_PER_BLOCK ,
52
+ } ;
46
53
use alloy_evm:: { eth:: EthEvmContext , Database , Evm } ;
47
54
use alloy_network:: {
48
55
AnyHeader , AnyRpcBlock , AnyRpcHeader , AnyRpcTransaction , AnyTxEnvelope , AnyTxType ,
@@ -1410,13 +1417,29 @@ impl Backend {
1410
1417
authorization_list,
1411
1418
nonce,
1412
1419
sidecar : _,
1413
- chain_id : _ ,
1420
+ chain_id,
1414
1421
transaction_type,
1422
+ max_fee_per_gas,
1423
+ max_priority_fee_per_gas,
1415
1424
.. // Rest of the gas fees related fields are taken from `fee_details`
1416
1425
} ,
1417
1426
other,
1418
1427
} = request;
1419
1428
1429
+ let tx_type = transaction_type. unwrap_or_else ( || {
1430
+ if authorization_list. is_some ( ) {
1431
+ EIP7702_TX_TYPE_ID
1432
+ } else if blob_versioned_hashes. is_some ( ) {
1433
+ EIP4844_TX_TYPE_ID
1434
+ } else if max_fee_per_gas. is_some ( ) || max_priority_fee_per_gas. is_some ( ) {
1435
+ EIP1559_TX_TYPE_ID
1436
+ } else if access_list. is_some ( ) {
1437
+ EIP2930_TX_TYPE_ID
1438
+ } else {
1439
+ LEGACY_TX_TYPE_ID
1440
+ }
1441
+ } ) ;
1442
+
1420
1443
let FeeDetails {
1421
1444
gas_price,
1422
1445
max_fee_per_gas,
@@ -1463,10 +1486,10 @@ impl Backend {
1463
1486
Some ( addr) => TxKind :: Call ( * addr) ,
1464
1487
None => TxKind :: Create ,
1465
1488
} ,
1466
- tx_type : transaction_type . unwrap_or_default ( ) ,
1489
+ tx_type,
1467
1490
value : value. unwrap_or_default ( ) ,
1468
1491
data : input. into_input ( ) . unwrap_or_default ( ) ,
1469
- chain_id : None ,
1492
+ chain_id : Some ( chain_id . unwrap_or ( self . env . read ( ) . evm_env . cfg_env . chain_id ) ) ,
1470
1493
access_list : access_list. unwrap_or_default ( ) ,
1471
1494
blob_hashes,
1472
1495
authorization_list : authorization_list. unwrap_or_default ( ) ,
0 commit comments