Skip to content

Commit 9813034

Browse files
committed
refactor(conflict): Drop the target ID width constant
1 parent 0b986d6 commit 9813034

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎submitqueue/extension/conflict/tango/signature.go‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ import (
2323
"slices"
2424
)
2525

26-
// targetIDBytes is how much of a label's SHA-256 digest forms its target ID.
27-
// 8 bytes fit a uint64; a collision only adds a false conflict.
28-
const targetIDBytes = 8
29-
3026
// LabelDistance is one affected target: its label exactly as Tango reported it
3127
// and its distance from the nearest directly changed source.
3228
type LabelDistance struct {
@@ -49,9 +45,10 @@ type hashedTarget struct {
4945
}
5046

5147
// targetID returns the first 8 bytes of the SHA-256 of label, read big-endian.
48+
// A collision only adds a false conflict.
5249
func targetID(label string) uint64 {
5350
digest := sha256.Sum256([]byte(label))
54-
return binary.BigEndian.Uint64(digest[:targetIDBytes])
51+
return binary.BigEndian.Uint64(digest[:])
5552
}
5653

5754
// toSignatureTargets returns the signature targets sorted ascending by ID, one

0 commit comments

Comments
 (0)