File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed
Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package validator
22
33import (
44 "encoding/hex"
5- "sort "
5+ "slices "
66 "strconv"
77
88 "github.com/attestantio/go-eth2-client/spec/phase0"
@@ -140,7 +140,7 @@ func pendingDetails(data map[phase0.Root]map[spectypes.OperatorID]map[uint64][]p
140140 for ts := range byTs {
141141 tsKeys = append (tsKeys , ts )
142142 }
143- sort . Slice (tsKeys , func ( i , j int ) bool { return tsKeys [ i ] < tsKeys [ j ] } )
143+ slices . Sort (tsKeys )
144144
145145 buckets := make ([]map [string ]any , 0 , len (tsKeys ))
146146 for _ , ts := range tsKeys {
@@ -159,15 +159,15 @@ func pendingDetails(data map[phase0.Root]map[spectypes.OperatorID]map[uint64][]p
159159 for v := range ded {
160160 arr = append (arr , v )
161161 }
162- sort . Slice (arr , func ( i , j int ) bool { return arr [ i ] < arr [ j ] } )
162+ slices . Sort (arr )
163163 buckets = append (buckets , map [string ]any {"t" : ts , "indices" : arr })
164164 }
165165 // union indices sorted
166166 unionArr := make ([]uint64 , 0 , len (union ))
167167 for v := range union {
168168 unionArr = append (unionArr , v )
169169 }
170- sort . Slice (unionArr , func ( i , j int ) bool { return unionArr [ i ] < unionArr [ j ] } )
170+ slices . Sort (unionArr )
171171
172172 inner [strconv .FormatUint (signer , 10 )] = map [string ]any {
173173 "by_timestamp" : buckets ,
Original file line number Diff line number Diff line change 44 "crypto/sha256"
55 "encoding/binary"
66 "slices"
7- "sort"
87 "sync/atomic"
98 "time"
109
@@ -210,9 +209,7 @@ func (s *SSVShare) Quorum() uint64 {
210209
211210// ComputeClusterIDHash will compute cluster ID hash with given owner address and operator ids
212211func ComputeClusterIDHash (address common.Address , operatorIds []uint64 ) []byte {
213- sort .Slice (operatorIds , func (i , j int ) bool {
214- return operatorIds [i ] < operatorIds [j ]
215- })
212+ slices .Sort (operatorIds )
216213
217214 // Encode the address and operator IDs in the same way as Solidity's abi.encodePacked
218215 var data []byte
@@ -245,9 +242,7 @@ func ValidCommitteeSize(committeeSize uint64) bool {
245242// Return a 32 bytes ID for the committee of operators
246243func ComputeCommitteeID (committee []spectypes.OperatorID ) spectypes.CommitteeID {
247244 // sort
248- sort .Slice (committee , func (i , j int ) bool {
249- return committee [i ] < committee [j ]
250- })
245+ slices .Sort (committee )
251246 // Convert to bytes
252247 bytes := make ([]byte , len (committee )* 4 )
253248 for i , v := range committee {
You can’t perform that action at this time.
0 commit comments