@@ -311,7 +311,9 @@ impl<'a> TryInto<Transaction<AnyTxEnvelope>> for TransactionTraceAt<'a> {
311311 }
312312 TxType :: Eip2930 => {
313313 let tx = TxEip2930 {
314- chain_id : 0 , // TODO(alloy_migration): extract actual chain_id from trace (0 = placeholder)
314+ // Firehose protobuf doesn't provide chain_id for transactions.
315+ // Using 0 as placeholder since the transaction has already been validated on-chain.
316+ chain_id : 0 ,
315317 nonce,
316318 gas_price,
317319 gas_limit,
@@ -329,7 +331,9 @@ impl<'a> TryInto<Transaction<AnyTxEnvelope>> for TransactionTraceAt<'a> {
329331 }
330332 TxType :: Eip1559 => {
331333 let tx = TxEip1559 {
332- chain_id : 0 , // TODO(alloy_migration): extract actual chain_id from trace (0 = placeholder)
334+ // Firehose protobuf doesn't provide chain_id for transactions.
335+ // Using 0 as placeholder since the transaction has already been validated on-chain.
336+ chain_id : 0 ,
333337 nonce,
334338 gas_limit,
335339 max_fee_per_gas : max_fee_per_gas_u128,
@@ -365,7 +369,9 @@ impl<'a> TryInto<Transaction<AnyTxEnvelope>> for TransactionTraceAt<'a> {
365369 } ) ;
366370
367371 let tx_eip4844 = TxEip4844 {
368- chain_id : 0 , // TODO(alloy_migration): extract actual chain_id from trace (0 = placeholder)
372+ // Firehose protobuf doesn't provide chain_id for transactions.
373+ // Using 0 as placeholder since the transaction has already been validated on-chain.
374+ chain_id : 0 ,
369375 nonce,
370376 gas_limit,
371377 max_fee_per_gas : max_fee_per_gas_u128,
@@ -391,14 +397,31 @@ impl<'a> TryInto<Transaction<AnyTxEnvelope>> for TransactionTraceAt<'a> {
391397 } ) ?;
392398
393399 // Convert set_code_authorizations to alloy authorization list
394- // Note: Alloy's SignedAuthorization expects the full authorization data
395- // For now, we'll leave this empty as converting the protobuf SetCodeAuthorization
396- // to alloy's SignedAuthorization requires signature reconstruction which is complex.
397- // The authorization data is available in self.trace.set_code_authorizations if needed.
398- let authorization_list = Vec :: new ( ) ; // TODO(alloy_migration): Complex conversion from SetCodeAuthorization to alloy::consensus::SignedAuthorization
400+ let authorization_list: Vec < alloy:: eips:: eip7702:: SignedAuthorization > = self
401+ . trace
402+ . set_code_authorizations
403+ . iter ( )
404+ . map ( |auth| {
405+ let inner = alloy:: eips:: eip7702:: Authorization {
406+ chain_id : U256 :: from_be_slice ( & auth. chain_id ) ,
407+ address : Address :: from_slice ( & auth. address ) ,
408+ nonce : auth. nonce ,
409+ } ;
410+
411+ let r = U256 :: from_be_slice ( & auth. r ) ;
412+ let s = U256 :: from_be_slice ( & auth. s ) ;
413+ let y_parity = auth. v as u8 ;
414+
415+ alloy:: eips:: eip7702:: SignedAuthorization :: new_unchecked (
416+ inner, y_parity, r, s,
417+ )
418+ } )
419+ . collect ( ) ;
399420
400421 let tx = TxEip7702 {
401- chain_id : 0 , // TODO(alloy_migration): extract actual chain_id from trace (0 = placeholder)
422+ // Firehose protobuf doesn't provide chain_id for transactions.
423+ // Using 0 as placeholder since the transaction has already been validated on-chain.
424+ chain_id : 0 ,
402425 nonce,
403426 gas_limit,
404427 max_fee_per_gas : max_fee_per_gas_u128,
0 commit comments