Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions operator/dutytracer/eviction.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package validator

import (
"encoding/hex"
"sort"
"slices"
"strconv"

"github.com/attestantio/go-eth2-client/spec/phase0"
Expand Down Expand Up @@ -140,7 +140,7 @@ func pendingDetails(data map[phase0.Root]map[spectypes.OperatorID]map[uint64][]p
for ts := range byTs {
tsKeys = append(tsKeys, ts)
}
sort.Slice(tsKeys, func(i, j int) bool { return tsKeys[i] < tsKeys[j] })
slices.Sort(tsKeys)

buckets := make([]map[string]any, 0, len(tsKeys))
for _, ts := range tsKeys {
Expand All @@ -159,15 +159,15 @@ func pendingDetails(data map[phase0.Root]map[spectypes.OperatorID]map[uint64][]p
for v := range ded {
arr = append(arr, v)
}
sort.Slice(arr, func(i, j int) bool { return arr[i] < arr[j] })
slices.Sort(arr)
buckets = append(buckets, map[string]any{"t": ts, "indices": arr})
}
// union indices sorted
unionArr := make([]uint64, 0, len(union))
for v := range union {
unionArr = append(unionArr, v)
}
sort.Slice(unionArr, func(i, j int) bool { return unionArr[i] < unionArr[j] })
slices.Sort(unionArr)

inner[strconv.FormatUint(signer, 10)] = map[string]any{
"by_timestamp": buckets,
Expand Down
9 changes: 2 additions & 7 deletions protocol/v2/types/ssvshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"crypto/sha256"
"encoding/binary"
"slices"
"sort"
"sync/atomic"
"time"

Expand Down Expand Up @@ -210,9 +209,7 @@ func (s *SSVShare) Quorum() uint64 {

// ComputeClusterIDHash will compute cluster ID hash with given owner address and operator ids
func ComputeClusterIDHash(address common.Address, operatorIds []uint64) []byte {
sort.Slice(operatorIds, func(i, j int) bool {
return operatorIds[i] < operatorIds[j]
})
slices.Sort(operatorIds)

// Encode the address and operator IDs in the same way as Solidity's abi.encodePacked
var data []byte
Expand Down Expand Up @@ -245,9 +242,7 @@ func ValidCommitteeSize(committeeSize uint64) bool {
// Return a 32 bytes ID for the committee of operators
func ComputeCommitteeID(committee []spectypes.OperatorID) spectypes.CommitteeID {
// sort
sort.Slice(committee, func(i, j int) bool {
return committee[i] < committee[j]
})
slices.Sort(committee)
// Convert to bytes
bytes := make([]byte, len(committee)*4)
for i, v := range committee {
Expand Down