Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: misscounters grpc-web get api #2547

Merged
merged 12 commits into from
Jun 14, 2024
2 changes: 2 additions & 0 deletions x/leverage/keeper/interest.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ func (k Keeper) AccrueAllInterest(ctx sdk.Context) error {
}
}

k.Logger(ctx).Debug("Rewards for oracle and auction", "oracleRewards", oracleRewards.String(),
"auctionRewards", auctionRewards.String())
if err := k.fundModules(ctx, oracleRewards, auctionRewards); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions x/leverage/keeper/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ func (k Keeper) fundModules(ctx sdk.Context, toOracle, toAuction sdk.Coins) erro
// This action is caused by end blocker, not a message handler, so we need to emit an event
k.Logger(ctx).Debug(
"funded ",
"to oracle", toOracleCheck,
"to auction", toAuctionCheck,
"to oracle", toOracleCheck.String(),
"to auction", toAuctionCheck.String(),
)
send := k.bankKeeper.SendCoinsFromModuleToModule
if !toOracleCheck.IsZero() {
Expand Down
8 changes: 1 addition & 7 deletions x/oracle/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,7 @@
MissCounter: missCounter,
})
} else {
q.IterateMissCounters(ctx, func(val sdk.ValAddress, u uint64) bool {
pfMissCounts = append(pfMissCounts, types.PriceMissCounter{
Validator: val.String(),
MissCounter: u,
})
return false
})
pfMissCounts = q.Keeper.GetAllMissCounters(ctx)

Check warning on line 383 in x/oracle/keeper/grpc_query.go

View check run for this annotation

Codecov / codecov/patch

x/oracle/keeper/grpc_query.go#L383

Added line #L383 was not covered by tests
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
}

return &types.QueryMissCountersResponse{
Expand Down
12 changes: 12 additions & 0 deletions x/oracle/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,18 @@
}
}

// GetAllMissCounters returns all bonded validators pf miss counter value
func (k Keeper) GetAllMissCounters(ctx sdk.Context) []types.PriceMissCounter {
gsk967 marked this conversation as resolved.
Show resolved Hide resolved
missCounters := make([]types.PriceMissCounter, 0)
for _, v := range k.StakingKeeper.GetBondedValidatorsByPower(ctx) {
missCounters = append(missCounters, types.PriceMissCounter{
Validator: v.OperatorAddress,
MissCounter: k.GetMissCounter(ctx, v.GetOperator()),
})

Check warning on line 261 in x/oracle/keeper/keeper.go

View check run for this annotation

Codecov / codecov/patch

x/oracle/keeper/keeper.go#L255-L261

Added lines #L255 - L261 were not covered by tests
}
return missCounters

Check warning on line 263 in x/oracle/keeper/keeper.go

View check run for this annotation

Codecov / codecov/patch

x/oracle/keeper/keeper.go#L263

Added line #L263 was not covered by tests
}
gsk967 marked this conversation as resolved.
Show resolved Hide resolved

// GetAggregateExchangeRatePrevote retrieves an oracle prevote from the store.
func (k Keeper) GetAggregateExchangeRatePrevote(
ctx sdk.Context,
Expand Down
Loading