From 503e148f25a719b14688ceb00aaa1ad9d0b885ed Mon Sep 17 00:00:00 2001 From: Sai Kumar <17549398+gsk967@users.noreply.github.com> Date: Fri, 14 Jun 2024 20:42:22 +0530 Subject: [PATCH] fix: misscounters grpc-web get api (#2547) * testing: set auction params for the feature testnet * fix: fix the auction creation in every end block (#2536) * fix: fix the auction creation in every block * ++ * set auction id 0 on query * fix: fix the rewards collects for bid (#2539) * fix the amount collect to reward auction fee collector * added rewards info for toAuctionCheck * fix the grpc of miss counter api * revert test params * update the changelog --------- Co-authored-by: Robert Zaremba --- CHANGELOG.md | 1 + x/leverage/keeper/interest.go | 2 ++ x/leverage/keeper/oracle.go | 4 ++-- x/oracle/keeper/grpc_query.go | 8 +------- x/oracle/keeper/keeper.go | 12 ++++++++++++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb44df2909..ca989ff242 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes - [2473](https://github.com/umee-network/umee/pull/2473) Correct x/ugov Amino registration for x/ugov messages (they don't have MessageName option). +- [2547](https://github.com/umee-network/umee/pull/2547) Fix the `MissCounters` grpc-web get api result. ## v6.4.0 - 2024-03-21 diff --git a/x/leverage/keeper/interest.go b/x/leverage/keeper/interest.go index f601af9777..ec504ccf66 100644 --- a/x/leverage/keeper/interest.go +++ b/x/leverage/keeper/interest.go @@ -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 } diff --git a/x/leverage/keeper/oracle.go b/x/leverage/keeper/oracle.go index 88274c1530..f35f494320 100644 --- a/x/leverage/keeper/oracle.go +++ b/x/leverage/keeper/oracle.go @@ -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() { diff --git a/x/oracle/keeper/grpc_query.go b/x/oracle/keeper/grpc_query.go index fe3e206b16..337aad3a98 100644 --- a/x/oracle/keeper/grpc_query.go +++ b/x/oracle/keeper/grpc_query.go @@ -380,13 +380,7 @@ func (q querier) MissCounters(goCtx context.Context, req *types.QueryMissCounter 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) } return &types.QueryMissCountersResponse{ diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index c2404a1ea8..ead29e73fb 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -251,6 +251,18 @@ func (k Keeper) IterateMissCounters(ctx sdk.Context, handler func(sdk.ValAddress } } +// GetAllMissCounters returns all bonded validators pf miss counter value +func (k Keeper) GetAllMissCounters(ctx sdk.Context) []types.PriceMissCounter { + 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()), + }) + } + return missCounters +} + // GetAggregateExchangeRatePrevote retrieves an oracle prevote from the store. func (k Keeper) GetAggregateExchangeRatePrevote( ctx sdk.Context,