@@ -467,20 +467,21 @@ func TestReceiptsFromCometBlock(t *testing.T) {
467467 }
468468 tcs := []struct {
469469 name string
470- ethTxIndex int32
470+ ethTxIndex int
471471 }{
472472 {"tx_with_index_5" , 5 },
473473 {"tx_with_index_10" , 10 },
474474 }
475475 for _ , tc := range tcs {
476476 t .Run (tc .name , func (t * testing.T ) {
477- msgs := []* evmtypes.MsgEthereumTx {
478- buildMsgEthereumTx (t ),
477+ var msgs []* evmtypes.MsgEthereumTx
478+ for range tc .ethTxIndex + 1 {
479+ msgs = append (msgs , buildMsgEthereumTx (t ))
479480 }
480481 expectedTxResult := & servertypes.TxResult {
481482 Height : height ,
482483 TxIndex : 0 ,
483- EthTxIndex : tc .ethTxIndex ,
484+ EthTxIndex : int32 ( tc .ethTxIndex ), // #nosec G115 -- no overflow here
484485 MsgIndex : 0 ,
485486 }
486487 mockIndexer := & MockIndexer {
@@ -493,13 +494,13 @@ func TestReceiptsFromCometBlock(t *testing.T) {
493494 mockEVMQueryClient .On ("BaseFee" , mock .Anything , mock .Anything ).Return (& evmtypes.QueryBaseFeeResponse {}, nil )
494495 receipts , err := backend .ReceiptsFromCometBlock (resBlock , blockRes , msgs )
495496 require .NoError (t , err )
496- require .Len (t , receipts , 1 )
497- actualTxIndex := receipts [0 ].TransactionIndex
497+ require .Len (t , receipts , tc . ethTxIndex + 1 )
498+ actualTxIndex := receipts [tc . ethTxIndex ].TransactionIndex
498499 require .NotEqual (t , uint (0 ), actualTxIndex )
499500 require .Equal (t , uint (tc .ethTxIndex ), actualTxIndex ) // #nosec G115
500- require .Equal (t , msgs [0 ].Hash (), receipts [0 ].TxHash )
501- require .Equal (t , big .NewInt (height ), receipts [0 ].BlockNumber )
502- require .Equal (t , ethtypes .ReceiptStatusSuccessful , receipts [0 ].Status )
501+ require .Equal (t , msgs [tc . ethTxIndex ].Hash (), receipts [tc . ethTxIndex ].TxHash )
502+ require .Equal (t , big .NewInt (height ), receipts [tc . ethTxIndex ].BlockNumber )
503+ require .Equal (t , ethtypes .ReceiptStatusSuccessful , receipts [tc . ethTxIndex ].Status )
503504 })
504505 }
505506}
0 commit comments