@@ -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,7 +1417,7 @@ impl Backend {
1410
1417
authorization_list,
1411
1418
nonce,
1412
1419
sidecar : _,
1413
- chain_id : _ ,
1420
+ chain_id,
1414
1421
transaction_type,
1415
1422
.. // Rest of the gas fees related fields are taken from `fee_details`
1416
1423
} ,
@@ -1424,6 +1431,20 @@ impl Backend {
1424
1431
max_fee_per_blob_gas,
1425
1432
} = fee_details;
1426
1433
1434
+ let tx_type = transaction_type. unwrap_or_else ( || {
1435
+ if authorization_list. is_some ( ) {
1436
+ EIP7702_TX_TYPE_ID
1437
+ } else if blob_versioned_hashes. is_some ( ) {
1438
+ EIP4844_TX_TYPE_ID
1439
+ } else if max_fee_per_gas. is_some ( ) || max_priority_fee_per_gas. is_some ( ) {
1440
+ EIP1559_TX_TYPE_ID
1441
+ } else if access_list. is_some ( ) {
1442
+ EIP2930_TX_TYPE_ID
1443
+ } else {
1444
+ LEGACY_TX_TYPE_ID
1445
+ }
1446
+ } ) ;
1447
+
1427
1448
let gas_limit = gas. unwrap_or ( block_env. gas_limit ) ;
1428
1449
let mut env = self . env . read ( ) . clone ( ) ;
1429
1450
env. evm_env . block_env = block_env;
@@ -1463,10 +1484,10 @@ impl Backend {
1463
1484
Some ( addr) => TxKind :: Call ( * addr) ,
1464
1485
None => TxKind :: Create ,
1465
1486
} ,
1466
- tx_type : transaction_type . unwrap_or_default ( ) ,
1487
+ tx_type,
1467
1488
value : value. unwrap_or_default ( ) ,
1468
1489
data : input. into_input ( ) . unwrap_or_default ( ) ,
1469
- chain_id : None ,
1490
+ chain_id : Some ( chain_id . unwrap_or ( self . env . read ( ) . evm_env . cfg_env . chain_id ) ) ,
1470
1491
access_list : access_list. unwrap_or_default ( ) ,
1471
1492
blob_hashes,
1472
1493
authorization_list : authorization_list. unwrap_or_default ( ) ,
0 commit comments