Skip to content

Commit

Permalink
fix the chain!
Browse files Browse the repository at this point in the history
  • Loading branch information
Yarom Swisa authored and Yarom Swisa committed Aug 16, 2023
1 parent 0e03887 commit e1d3290
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 1 addition & 3 deletions utils/rand/rand.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"crypto/sha256"
"encoding/binary"
"math/rand"

"github.com/vpxyz/xorshift/xoroshiro128starstar"
)

func generateSeed(data []byte) int64 {
Expand All @@ -17,7 +15,7 @@ func generateSeed(data []byte) int64 {
// New returns a new RPNG instance properly seeded
func New(data []byte) *rand.Rand {
seed := generateSeed(data)
source := xoroshiro128starstar.NewSource(seed)
source := rand.NewSource(seed)
return rand.New(source)
}

Expand Down
8 changes: 7 additions & 1 deletion x/pairing/keeper/scores/score.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,14 @@ func GetStrategy() ScoreStrategy {
// and the previous slot
func CalcPairingScore(scores []*PairingScore, strategy ScoreStrategy, diffSlot *PairingSlot) error {
// calculate the score for each req for each provider
keys := []string{}
for key, _ := range diffSlot.Reqs {
keys = append(keys, key)
}

for _, score := range scores {
for _, req := range diffSlot.Reqs {
for _, key := range keys {
req := diffSlot.Reqs[key]
reqName := req.GetName()
weight, ok := strategy[reqName]
if !ok {
Expand Down
3 changes: 3 additions & 0 deletions x/plans/types/geolocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func init() {
allGeoEnumRegions |= geoloc
}
}
sort.Slice(allGeoEnumRegionsList, func(i, j int) bool {
return allGeoEnumRegionsList[i] < allGeoEnumRegionsList[j]
})
}

// IsValidGeoEnum tests the validity of a given geolocation
Expand Down

0 comments on commit e1d3290

Please sign in to comment.