@@ -97,8 +97,10 @@ func (kv *KVIndexer) IndexBlock(block *tmtypes.Block, txResults []*abci.Response
9797 txHash := common .HexToHash (ethMsg .Hash )
9898
9999 txResult := ethermint.TxResult {
100- Height : height ,
101- TxIndex : uint32 (txIndex ),
100+ Height : height ,
101+ // #nosec G115 index always positive
102+ TxIndex : uint32 (txIndex ),
103+ // #nosec G115 index always positive
102104 MsgIndex : uint32 (msgIndex ),
103105 EthTxIndex : ethTxIndex ,
104106 }
@@ -180,7 +182,9 @@ func TxHashKey(hash common.Hash) []byte {
180182
181183// TxIndexKey returns the key for db entry: `(block number, tx index) -> tx hash`
182184func TxIndexKey (blockNumber int64 , txIndex int32 ) []byte {
185+ // #nosec G115 block number always positive
183186 bz1 := sdk .Uint64ToBigEndian (uint64 (blockNumber ))
187+ // #nosec G115 index always positive
184188 bz2 := sdk .Uint64ToBigEndian (uint64 (txIndex ))
185189 return append (append ([]byte {KeyPrefixTxIndex }, bz1 ... ), bz2 ... )
186190}
@@ -241,5 +245,6 @@ func parseBlockNumberFromKey(key []byte) (int64, error) {
241245 return 0 , fmt .Errorf ("wrong tx index key length, expect: %d, got: %d" , TxIndexKeyLength , len (key ))
242246 }
243247
248+ // #nosec G115 block number always in range
244249 return int64 (sdk .BigEndianToUint64 (key [1 :9 ])), nil
245250}
0 commit comments