@@ -291,6 +291,22 @@ impl<'a> TryInto<Transaction> for TransactionTraceAt<'a> {
291
291
format_err ! ( "EIP-4844 transactions cannot be contract creation transactions. The 'to' field must contain a valid address." )
292
292
} ) ?;
293
293
294
+ let blob_versioned_hashes: Vec < B256 > = self
295
+ . trace
296
+ . blob_hashes
297
+ . iter ( )
298
+ . map ( |hash| B256 :: from_slice ( hash) )
299
+ . collect ( ) ;
300
+
301
+ let max_fee_per_blob_gas_u128 = self
302
+ . trace
303
+ . blob_gas_fee_cap
304
+ . as_ref ( )
305
+ . map_or ( 0u128 , |x| {
306
+ let val: U256 = x. into ( ) ;
307
+ val. to :: < u128 > ( )
308
+ } ) ;
309
+
294
310
let tx_eip4844 = TxEip4844 {
295
311
chain_id : 0 , // TODO(alloy_migration): extract actual chain_id from trace (0 = placeholder)
296
312
nonce,
@@ -300,8 +316,8 @@ impl<'a> TryInto<Transaction> for TransactionTraceAt<'a> {
300
316
to : to_address,
301
317
value,
302
318
access_list : access_list. clone ( ) , // Use actual access list from trace
303
- blob_versioned_hashes : Vec :: new ( ) , // TODO(alloy_migration): blob hashes not available in current protobuf definition
304
- max_fee_per_blob_gas : 0u128 , // TODO(alloy_migration): blob gas fee not available in current protobuf definition
319
+ blob_versioned_hashes,
320
+ max_fee_per_blob_gas : max_fee_per_blob_gas_u128 ,
305
321
input : input. clone ( ) ,
306
322
} ;
307
323
let tx = TxEip4844Variant :: TxEip4844 ( tx_eip4844) ;
@@ -317,6 +333,13 @@ impl<'a> TryInto<Transaction> for TransactionTraceAt<'a> {
317
333
format_err ! ( "EIP-7702 transactions cannot be contract creation transactions. The 'to' field must contain a valid address." )
318
334
} ) ?;
319
335
336
+ // Convert set_code_authorizations to alloy authorization list
337
+ // Note: Alloy's SignedAuthorization expects the full authorization data
338
+ // For now, we'll leave this empty as converting the protobuf SetCodeAuthorization
339
+ // to alloy's SignedAuthorization requires signature reconstruction which is complex.
340
+ // The authorization data is available in self.trace.set_code_authorizations if needed.
341
+ let authorization_list = Vec :: new ( ) ; // TODO(alloy_migration): Complex conversion from SetCodeAuthorization to alloy::consensus::SignedAuthorization
342
+
320
343
let tx = TxEip7702 {
321
344
chain_id : 0 , // TODO(alloy_migration): extract actual chain_id from trace (0 = placeholder)
322
345
nonce,
@@ -326,7 +349,7 @@ impl<'a> TryInto<Transaction> for TransactionTraceAt<'a> {
326
349
to : to_address,
327
350
value,
328
351
access_list : access_list. clone ( ) , // Use actual access list from trace
329
- authorization_list : Vec :: new ( ) , // TODO(alloy_migration): authorization list not available in current protobuf definition
352
+ authorization_list,
330
353
input : input. clone ( ) ,
331
354
} ;
332
355
let signed_tx = Signed :: new_unchecked (
@@ -396,17 +419,33 @@ impl TryInto<AlloyBlock> for &Block {
396
419
mix_hash : header. mix_hash . try_decode_proto ( "mix hash" ) ?,
397
420
nonce : header. nonce . into ( ) ,
398
421
399
- withdrawals_root : None , // TODO(alloy_migration): not available in current protobuf definition
400
- blob_gas_used : None , // TODO(alloy_migration): not available in current protobuf definition
401
- excess_blob_gas : None , // TODO(alloy_migration): not available in current protobuf definition
402
- parent_beacon_block_root : None , // TODO(alloy_migration): not available in current protobuf definition
403
- requests_hash : None , // TODO(alloy_migration): not available in current protobuf definition
422
+ withdrawals_root : if header. withdrawals_root . is_empty ( ) {
423
+ None
424
+ } else {
425
+ Some ( header. withdrawals_root . try_decode_proto ( "withdrawals root" ) ?)
426
+ } ,
427
+ blob_gas_used : header. blob_gas_used ,
428
+ excess_blob_gas : header. excess_blob_gas ,
429
+ parent_beacon_block_root : if header. parent_beacon_root . is_empty ( ) {
430
+ None
431
+ } else {
432
+ Some ( header. parent_beacon_root . try_decode_proto ( "parent beacon root" ) ?)
433
+ } ,
434
+ requests_hash : if header. requests_hash . is_empty ( ) {
435
+ None
436
+ } else {
437
+ Some ( header. requests_hash . try_decode_proto ( "requests hash" ) ?)
438
+ }
404
439
} ;
405
440
406
441
let rpc_header = alloy:: rpc:: types:: Header {
407
442
hash : block_hash,
408
443
inner : consensus_header,
409
- total_difficulty : header. total_difficulty . as_ref ( ) . map ( |v| v. into ( ) ) ,
444
+ total_difficulty : {
445
+ #[ allow( deprecated) ]
446
+ let total_difficulty = & header. total_difficulty ;
447
+ total_difficulty. as_ref ( ) . map ( |v| v. into ( ) )
448
+ } ,
410
449
size : Some ( U256 :: from ( self . size ) ) ,
411
450
} ;
412
451
@@ -577,8 +616,11 @@ fn transaction_trace_to_alloy_txn_reciept(
577
616
let val: U256 = x. into ( ) ;
578
617
val. to :: < u128 > ( )
579
618
} ) , // gas_price already contains effective gas price per protobuf spec
580
- blob_gas_used : None , // TODO(alloy_migration): blob gas used not available in current protobuf definition
581
- blob_gas_price : None , // TODO(alloy_migration): blob gas price not available in current protobuf definition
619
+ blob_gas_used : r. blob_gas_used ,
620
+ blob_gas_price : r. blob_gas_price . as_ref ( ) . map ( |x| {
621
+ let val: U256 = x. into ( ) ;
622
+ val. to :: < u128 > ( )
623
+ } ) ,
582
624
inner : envelope,
583
625
} ) )
584
626
}
0 commit comments