Skip to content

Commit

Permalink
fix: misscounters grpc-web get api (#2547)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
gsk967 and robert-zaremba authored Jun 14, 2024
1 parent bb1fcda commit 503e148
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
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 @@ 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{
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 @@ 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,
Expand Down

0 comments on commit 503e148

Please sign in to comment.