diff --git a/x/dogfood/keeper/impl_sdk.go b/x/dogfood/keeper/impl_sdk.go index 0496da2b5..826428bbf 100644 --- a/x/dogfood/keeper/impl_sdk.go +++ b/x/dogfood/keeper/impl_sdk.go @@ -179,10 +179,16 @@ func (k Keeper) IterateBondedValidatorsByPower( // will only happen if there is an error in deserialization. continue } + found, addr := k.operatorKeeper.GetOperatorAddressForChainIDAndConsAddr( + ctx, ctx.ChainID(), sdk.GetConsAddress(pk), + ) + if !found { + // this should never happen. should we panic? + continue + } val, err := stakingtypes.NewValidator( // TODO: this is not the correct address, which is derived from - // sdk.ValAddress(sdk.AccAddress) - sdk.ValAddress(pk.Address()), + sdk.ValAddress(addr), pk, stakingtypes.Description{}, ) if err != nil { diff --git a/x/oracle/keeper/single.go b/x/oracle/keeper/single.go index 4f769c2ff..503301307 100644 --- a/x/oracle/keeper/single.go +++ b/x/oracle/keeper/single.go @@ -78,8 +78,8 @@ func recacheAggregatorContext(ctx sdk.Context, agc *aggregator.AggregatorContext totalPower := big.NewInt(0) validatorPowers := make(map[string]*big.Int) k.IterateBondedValidatorsByPower(ctx, func(_ int64, validator stakingtypes.ValidatorI) bool { - power := big.NewInt(validator.GetConsensusPower(validator.GetBondedTokens())) - addr := string(validator.GetOperator()) + power := big.NewInt(validator.GetConsensusPower(sdk.DefaultPowerReduction)) + addr := validator.GetOperator().String() validatorPowers[addr] = power totalPower = new(big.Int).Add(totalPower, power) return false @@ -141,7 +141,7 @@ func initAggregatorContext(ctx sdk.Context, agc *aggregator.AggregatorContext, k totalPower := big.NewInt(0) validatorPowers := make(map[string]*big.Int) k.IterateBondedValidatorsByPower(ctx, func(_ int64, validator stakingtypes.ValidatorI) bool { - power := big.NewInt(validator.GetConsensusPower(validator.GetBondedTokens())) + power := big.NewInt(validator.GetConsensusPower(sdk.DefaultPowerReduction)) addr := validator.GetOperator().String() validatorPowers[addr] = power totalPower = new(big.Int).Add(totalPower, power)