Skip to content

Commit

Permalink
fix(oracle): ensure map iteration is deteministic
Browse files Browse the repository at this point in the history
  • Loading branch information
leonz789 committed Dec 10, 2024
1 parent 27a99e2 commit cb0bd1c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion x/oracle/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"math/big"
"sort"
"strings"

// this line is used by starport scaffolding # 1
Expand Down Expand Up @@ -204,7 +205,13 @@ func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Val
}()
// update&check slashing info
validatorPowers := agc.GetValidatorPowers()
for validator, power := range validatorPowers {
validators := make([]string, 0, len(validatorPowers))
for validator := range validatorPowers {
validators = append(validators, validator)
}
sort.Strings(validators)
for _, validator := range validators {
power := validatorPowers[validator]
reportedInfo, found := am.keeper.GetValidatorReportInfo(ctx, validator)
if !found {
logger.Error(fmt.Sprintf("Expected report info for validator %s but not found", validator))
Expand Down

0 comments on commit cb0bd1c

Please sign in to comment.