Skip to content

Commit

Permalink
Hash selected upkeep IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
ferglor committed Apr 22, 2024
1 parent e399dee commit c2e8dbe
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package logprovider

import (
"crypto/md5"

Check failure on line 4 in core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1.go

View workflow job for this annotation

GitHub Actions / lint

G501: Blocklisted import crypto/md5: weak cryptographic primitive (gosec)
"encoding/hex"
"math"
"math/big"
"sort"
"strings"
"sync"
"sync/atomic"

Expand Down Expand Up @@ -155,10 +158,16 @@ func (b *logBuffer) dequeue(start, end int64, upkeepLimit, capacity int, upkeepS
numLogs += len(logs)
remainingLogs += remaining
}
b.lggr.Debugw("dequeued logs for upkeeps", "numUpkeeps", len(selectedUpkeeps), "numLogs", numLogs)
b.lggr.Debugw("dequeued logs for upkeeps", "numUpkeeps", len(selectedUpkeeps), "numLogs", numLogs, "hash", hashCombinedStrings(selectedUpkeeps))
return result, remainingLogs
}

func hashCombinedStrings(s []string) string {
combined := strings.Join(s, "")
hashed := md5.Sum([]byte(combined))

Check failure on line 167 in core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer_v1.go

View workflow job for this annotation

GitHub Actions / lint

G401: Use of weak cryptographic primitive (gosec)
return hex.EncodeToString(hashed[:8])
}

func (b *logBuffer) SetConfig(lookback, blockRate, logLimit uint32) {
b.lock.Lock()
defer b.lock.Unlock()
Expand Down

0 comments on commit c2e8dbe

Please sign in to comment.