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

refactor: Update median tracking for historacle pricing #1632

Merged
merged 32 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a48bb43
Refactor historacle median tracking
rbajollari Dec 1, 2022
1501fb1
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 1, 2022
a90346e
lint
rbajollari Dec 1, 2022
7fc2c74
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 1, 2022
a545a28
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 2, 2022
c9356a3
Update historacle keeper methods
rbajollari Dec 2, 2022
803e219
Add pricestats unit test
rbajollari Dec 2, 2022
e91f75b
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 2, 2022
97627a0
Add Get to getter keeper methods
rbajollari Dec 3, 2022
c6a5f60
PR comments
rbajollari Dec 5, 2022
dd9f000
Update x/oracle/types/keys.go
rbajollari Dec 5, 2022
eb0f1b0
Add ParseBlockFromKey comment
rbajollari Dec 5, 2022
a0630a0
lint
rbajollari Dec 5, 2022
85c2ffc
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 5, 2022
ced6379
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 5, 2022
f9b761c
Add decmath util package
rbajollari Dec 6, 2022
2fff271
Update keeper methods in historacle design doc
rbajollari Dec 6, 2022
d8fd83f
Update WithinMedianDeviation
rbajollari Dec 6, 2022
fcfcf60
revert file picked up by gofmt
rbajollari Dec 6, 2022
ff0ed4c
switch umee version from v3.2.0 -> ../ (again)
adamewozniak Dec 6, 2022
ffeda21
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 8, 2022
8d6ee4f
Fix keeper method names
rbajollari Dec 8, 2022
e3d3154
Update util/decmath/decmath.go
rbajollari Dec 8, 2022
1813826
Update util/decmath/decmath.go
rbajollari Dec 8, 2022
78fca1b
Update util/decmath/decmath.go
rbajollari Dec 8, 2022
4d1160f
Update x/oracle/abci.go
rbajollari Dec 8, 2022
2b3896a
Merge branch 'main' into ryan/historacle-median-tracking
rbajollari Dec 8, 2022
43db6cb
PR comments
rbajollari Dec 8, 2022
0c0e5eb
lint
rbajollari Dec 8, 2022
8e41f41
update method names in design doc
rbajollari Dec 8, 2022
aad1422
Use KVStoreReversePrefixIteratorPaginated
rbajollari Dec 8, 2022
694d5d3
Update iterator method names and comments
rbajollari Dec 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions proto/umee/oracle/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ message GenesisState {
repeated AggregateExchangeRateVote aggregate_exchange_rate_votes = 6
[(gogoproto.nullable) = false];
repeated HistoricPrice historic_prices = 8 [(gogoproto.nullable) = false];
repeated ExchangeRateTuple medians = 7 [(gogoproto.nullable) = false];
repeated ExchangeRateTuple medianDeviations = 9 [(gogoproto.nullable) = false];
rbajollari marked this conversation as resolved.
Show resolved Hide resolved
repeated HistoricPrice medians = 7 [(gogoproto.nullable) = false];
repeated HistoricPrice medianDeviations = 9 [(gogoproto.nullable) = false];
}

// FeederDelegation is the address for where oracle feeder authority are
Expand Down
30 changes: 13 additions & 17 deletions proto/umee/oracle/v1/oracle.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,19 @@ message Params {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// Stamp Period represents the amount of blocks the historacle module
// waits before recording a set of prices from the oracle.
uint64 stamp_period = 9;
// Prune Period represents the maximum amount of blocks which we want
// to keep a record of our set of exchange rates.
uint64 prune_period = 10;
// Median Period represents the amount blocks we will wait between
// calculating the median and standard deviation of the median of
// historic prices in the last Prune Period.
uint64 median_period = 11;
// Historic Asset List is a list of assets which will use the historic
// price stamping protection methodology (mainly manipulatable assets).
// Any assets not on this list will not be stamped.
repeated Denom historic_accept_list = 12 [
(gogoproto.castrepeated) = "DenomList",
(gogoproto.nullable) = false
];
// Historic Stamp Period represents the amount of blocks the oracle
// module waits before recording a new historic price.
uint64 historic_stamp_period = 9;
// Median Stamp Period represents the amount blocks the oracle module
// waits between calculating and stamping a new median and standard
// deviation of that median.
uint64 median_stamp_period = 10;
// Maximum Price Stamps represents the maximum amount of historic prices
// the oracle module will store before pruning via FIFO.
uint64 maximum_price_stamps = 11;
// Maximum Median Stamps represents the maximum amount of medians the
// oracle module will store before pruning via FIFO.
uint64 maximum_median_stamps = 12;
}

// Denom - the object to hold configurations of each denom
Expand Down
32 changes: 16 additions & 16 deletions x/oracle/abci.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package oracle

import (
"strings"
"time"

"github.com/cosmos/cosmos-sdk/telemetry"
Expand Down Expand Up @@ -41,11 +42,6 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper, experimental bool) error {

k.ClearExchangeRates(ctx)

if isPeriodLastBlock(ctx, params.MedianPeriod) && experimental {
k.ClearMedians(ctx)
k.ClearMedianDeviations(ctx)
}

// NOTE: it filters out inactive or jailed validators
ballotDenomSlice := k.OrganizeBallotByDenom(ctx, validatorClaimMap)

Expand All @@ -63,14 +59,14 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper, experimental bool) error {
}

if experimental {
// Stamp rate every stamp period if asset is set to have historic stats tracked
if isPeriodLastBlock(ctx, params.StampPeriod) && params.HistoricAcceptList.Contains(ballotDenom.Denom) {
k.AddHistoricPrice(ctx, ballotDenom.Denom, exchangeRate)
// Stamp historic price if historic stamp period has passed
rbajollari marked this conversation as resolved.
Show resolved Hide resolved
if isPeriodLastBlock(ctx, params.HistoricStampPeriod) {

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
k.AddHistoricPrice(ctx, strings.ToUpper(ballotDenom.Denom), exchangeRate)
rbajollari marked this conversation as resolved.
Show resolved Hide resolved
Fixed Show fixed Hide fixed
}

// Set median price every median period if asset is set to have historic stats tracked
if isPeriodLastBlock(ctx, params.MedianPeriod) && params.HistoricAcceptList.Contains(ballotDenom.Denom) {
k.CalcAndSetMedian(ctx, ballotDenom.Denom)
// Calculate and stamp median/median deviation if median stamp period has passed
if isPeriodLastBlock(ctx, params.MedianStampPeriod) {
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
k.CalcAndSetMedian(ctx, strings.ToUpper(ballotDenom.Denom))
}
}
}
Expand Down Expand Up @@ -108,11 +104,15 @@ func EndBlocker(ctx sdk.Context, k keeper.Keeper, experimental bool) error {
k.SlashAndResetMissCounters(ctx)
}

// Prune historic prices every prune period
if isPeriodLastBlock(ctx, params.PrunePeriod) && experimental {
pruneBlock := uint64(ctx.BlockHeight()) - params.PrunePeriod
for _, v := range params.HistoricAcceptList {
k.DeleteHistoricPrice(ctx, v.String(), pruneBlock)
// Prune historic prices and medians outside pruning period determined by
// the stamp period multiplied by the max stamps.
if experimental {
pruneHistoricBlock := uint64(ctx.BlockHeight()) - (params.HistoricStampPeriod * params.MaximumPriceStamps)
pruneMedianBlock := uint64(ctx.BlockHeight()) - (params.MedianStampPeriod * params.MaximumMedianStamps)
rbajollari marked this conversation as resolved.
Show resolved Hide resolved
for _, v := range params.AcceptList {
k.DeleteHistoricPrice(ctx, strings.ToUpper(v.SymbolDenom), pruneHistoricBlock)
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
k.DeleteMedian(ctx, strings.ToUpper(v.SymbolDenom), pruneMedianBlock)
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
k.DeleteMedianDeviation(ctx, strings.ToUpper(v.SymbolDenom), pruneMedianBlock)
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
}
}

Expand Down
33 changes: 23 additions & 10 deletions x/oracle/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func (s *IntegrationTestSuite) SetupTest() {
app := umeeapp.Setup(s.T(), isCheckTx, 1)
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{
ChainID: fmt.Sprintf("test-chain-%s", tmrand.Str(4)),
Height: int64(types.DefaultMedianPeriod) - 1,
})

oracle.InitGenesis(ctx, app.OracleKeeper, *types.DefaultGenesisState())
Expand Down Expand Up @@ -90,18 +89,32 @@ func (s *IntegrationTestSuite) TestEndblockerExperimentalFlag() {
// add historic price and calcSet median stats
app.OracleKeeper.AddHistoricPrice(s.ctx, displayDenom, sdk.MustNewDecFromStr("1.0"))
app.OracleKeeper.CalcAndSetMedian(s.ctx, displayDenom)
medianPruneBlock := ctx.BlockHeight() + int64(types.DefaultMaximumMedianStamps*types.DefaultMedianStampPeriod)
ctx = ctx.WithBlockHeight(medianPruneBlock)

// with experimental flag off median stats don't get cleared
// with experimental flag off median doesn't get deleted
oracle.EndBlocker(ctx, app.OracleKeeper, false)
median, err := app.OracleKeeper.GetMedian(s.ctx, displayDenom)
s.Require().NoError(err)
s.Require().Equal(sdk.MustNewDecFromStr("1.0"), median)

// with experimental flag on median stats get cleared
medians := []types.HistoricPrice{}
app.OracleKeeper.IterateAllMedianPrices(
ctx,
func(median types.HistoricPrice) bool {
medians = append(medians, median)
return false
},
)
s.Require().Equal(1, len(medians))

// with experimental flag on median gets deleted
oracle.EndBlocker(ctx, app.OracleKeeper, true)
median, err = app.OracleKeeper.GetMedian(s.ctx, displayDenom)
s.Require().Error(err)
s.Require().Equal(sdk.ZeroDec(), median)
experimentalMedians := []types.HistoricPrice{}
app.OracleKeeper.IterateAllMedianPrices(
ctx,
func(median types.HistoricPrice) bool {
medians = append(experimentalMedians, median)
return false
},
)
s.Require().Equal(0, len(experimentalMedians))
}

func TestOracleTestSuite(t *testing.T) {
Expand Down
17 changes: 11 additions & 6 deletions x/oracle/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, genState types.GenesisSt
}

for _, median := range genState.Medians {
keeper.SetMedian(ctx, median.Denom, median.ExchangeRate)
keeper.SetMedian(ctx, median.ExchangeRateTuple.Denom, median.BlockNum, median.ExchangeRateTuple.ExchangeRate)
}

for _, medianDeviation := range genState.MedianDeviations {
keeper.SetMedianDeviation(ctx, medianDeviation.Denom, medianDeviation.ExchangeRate)
keeper.SetMedianDeviation(
ctx,
medianDeviation.ExchangeRateTuple.Denom,
medianDeviation.BlockNum,
medianDeviation.ExchangeRateTuple.ExchangeRate,
)
}

keeper.SetParams(ctx, genState.Params)
Expand Down Expand Up @@ -139,19 +144,19 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState {
},
)

medianPrices := []types.ExchangeRateTuple{}
medianPrices := []types.HistoricPrice{}
keeper.IterateAllMedianPrices(
ctx,
func(medianPrice types.ExchangeRateTuple) bool {
func(medianPrice types.HistoricPrice) bool {
medianPrices = append(medianPrices, medianPrice)
return false
},
)

medianDeviationPrices := []types.ExchangeRateTuple{}
medianDeviationPrices := []types.HistoricPrice{}
keeper.IterateAllMedianDeviationPrices(
ctx,
func(medianDeviationPrice types.ExchangeRateTuple) bool {
func(medianDeviationPrice types.HistoricPrice) bool {
medianDeviationPrices = append(medianDeviationPrices, medianDeviationPrice)
return false
},
Expand Down
17 changes: 13 additions & 4 deletions x/oracle/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (k Keeper) IterateAllHistoricPrices(
// Iterator stops when exhausting the source, or when the handler returns `true`.
func (k Keeper) IterateAllMedianPrices(
ctx sdk.Context,
handler func(types.ExchangeRateTuple) bool,
handler func(types.HistoricPrice) bool,
) {
store := ctx.KVStore(k.storeKey)
iter := sdk.KVStorePrefixIterator(store, types.KeyPrefixMedian)
Expand All @@ -44,7 +44,11 @@ func (k Keeper) IterateAllMedianPrices(
var decProto sdk.DecProto
k.cdc.MustUnmarshal(iter.Value(), &decProto)
denom := types.ParseDenomFromMedianKey(iter.Key())
median := types.ExchangeRateTuple{ExchangeRate: decProto.Dec, Denom: denom}
blockNum := types.ParseBlockFromMedianKey(iter.Key())
median := types.HistoricPrice{
ExchangeRateTuple: types.ExchangeRateTuple{ExchangeRate: decProto.Dec, Denom: denom},
BlockNum: blockNum,
}

if handler(median) {
break
Expand All @@ -56,7 +60,7 @@ func (k Keeper) IterateAllMedianPrices(
// Iterator stops when exhausting the source, or when the handler returns `true`.
func (k Keeper) IterateAllMedianDeviationPrices(
ctx sdk.Context,
handler func(types.ExchangeRateTuple) bool,
handler func(types.HistoricPrice) bool,
) {
store := ctx.KVStore(k.storeKey)
iter := sdk.KVStorePrefixIterator(store, types.KeyPrefixMedianDeviation)
Expand All @@ -66,7 +70,12 @@ func (k Keeper) IterateAllMedianDeviationPrices(
var decProto sdk.DecProto
k.cdc.MustUnmarshal(iter.Value(), &decProto)
denom := types.ParseDenomFromMedianKey(iter.Key())
medianDeviation := types.ExchangeRateTuple{ExchangeRate: decProto.Dec, Denom: denom}
blockNum := types.ParseBlockFromMedianKey(iter.Key())
medianDeviation := types.HistoricPrice{
ExchangeRateTuple: types.ExchangeRateTuple{ExchangeRate: decProto.Dec, Denom: denom},
BlockNum: blockNum,
}

if handler(medianDeviation) {
break
}
Expand Down
20 changes: 10 additions & 10 deletions x/oracle/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ func (s *IntegrationTestSuite) TestIterateAllMedianPrices() {
}

for _, m := range medians {
keeper.SetMedian(ctx, m.Denom, m.ExchangeRate)
keeper.SetMedian(ctx, m.Denom, uint64(s.ctx.BlockHeight()), m.ExchangeRate)
}

newMedians := []types.ExchangeRateTuple{}
newMedians := []types.HistoricPrice{}
keeper.IterateAllMedianPrices(
ctx,
func(median types.ExchangeRateTuple) bool {
func(median types.HistoricPrice) bool {
newMedians = append(newMedians, median)
return false
},
Expand All @@ -78,8 +78,8 @@ func (s *IntegrationTestSuite) TestIterateAllMedianPrices() {
FOUND:
for _, oldMedian := range medians {
for _, newMedian := range newMedians {
if oldMedian.Denom == newMedian.Denom {
s.Require().Equal(oldMedian.ExchangeRate, newMedian.ExchangeRate)
if oldMedian.Denom == newMedian.ExchangeRateTuple.Denom {
s.Require().Equal(oldMedian.ExchangeRate, newMedian.ExchangeRateTuple.ExchangeRate)
continue FOUND
}
}
Expand All @@ -96,13 +96,13 @@ func (s *IntegrationTestSuite) TestIterateAllMedianDeviationPrices() {
}

for _, m := range medians {
keeper.SetMedianDeviation(ctx, m.Denom, m.ExchangeRate)
keeper.SetMedianDeviation(ctx, m.Denom, uint64(s.ctx.BlockHeight()), m.ExchangeRate)
}

newMedians := []types.ExchangeRateTuple{}
newMedians := []types.HistoricPrice{}
keeper.IterateAllMedianDeviationPrices(
ctx,
func(median types.ExchangeRateTuple) bool {
func(median types.HistoricPrice) bool {
newMedians = append(newMedians, median)
return false
},
Expand All @@ -112,8 +112,8 @@ func (s *IntegrationTestSuite) TestIterateAllMedianDeviationPrices() {
FOUND:
for _, oldMedian := range medians {
for _, newMedian := range newMedians {
if oldMedian.Denom == newMedian.Denom {
s.Require().Equal(oldMedian.ExchangeRate, newMedian.ExchangeRate)
if oldMedian.Denom == newMedian.ExchangeRateTuple.Denom {
s.Require().Equal(oldMedian.ExchangeRate, newMedian.ExchangeRateTuple.ExchangeRate)
continue FOUND
}
}
Expand Down
15 changes: 9 additions & 6 deletions x/oracle/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,15 @@ func (q querier) Medians(
var medians sdk.DecCoins

if len(req.Denom) > 0 {
exchangeRate, err := q.GetMedian(ctx, req.Denom)
exchangeRate, err := q.HistoricMedian(ctx, req.Denom)
if err != nil {
return nil, err
}

medians = medians.Add(sdk.NewDecCoinFromDec(req.Denom, exchangeRate))
} else {
q.IterateAllMedianPrices(ctx, func(exchangeRateTuple types.ExchangeRateTuple) (stop bool) {
medians = medians.Add(sdk.NewDecCoinFromDec(exchangeRateTuple.Denom, exchangeRateTuple.ExchangeRate))
q.IterateAllMedianPrices(ctx, func(median types.HistoricPrice) (stop bool) {
medians = medians.Add(sdk.NewDecCoinFromDec(median.ExchangeRateTuple.Denom, median.ExchangeRateTuple.ExchangeRate))
return false
})
}
Expand All @@ -296,15 +296,18 @@ func (q querier) MedianDeviations(
var medians sdk.DecCoins

if len(req.Denom) > 0 {
exchangeRate, err := q.GetMedianDeviation(ctx, req.Denom)
exchangeRate, err := q.HistoricMedianDeviation(ctx, req.Denom)
if err != nil {
return nil, err
}

medians = medians.Add(sdk.NewDecCoinFromDec(req.Denom, exchangeRate))
} else {
q.IterateAllMedianDeviationPrices(ctx, func(exchangeRateTuple types.ExchangeRateTuple) (stop bool) {
medians = medians.Add(sdk.NewDecCoinFromDec(exchangeRateTuple.Denom, exchangeRateTuple.ExchangeRate))
q.IterateAllMedianDeviationPrices(ctx, func(medianDeviation types.HistoricPrice) (stop bool) {
medians = medians.Add(sdk.NewDecCoinFromDec(
medianDeviation.ExchangeRateTuple.Denom,
medianDeviation.ExchangeRateTuple.ExchangeRate,
))
return false
})
}
Expand Down
22 changes: 14 additions & 8 deletions x/oracle/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,33 +203,39 @@ func (s *IntegrationTestSuite) TestQuerier_AggregateVotesAppendVotes() {
}

func (s *IntegrationTestSuite) TestQuerier_Medians() {
app, ctx := s.app, s.ctx

atomMedian := sdk.DecCoin{Denom: "atom", Amount: sdk.MustNewDecFromStr("49.99")}
umeeMedian := sdk.DecCoin{Denom: "umee", Amount: sdk.MustNewDecFromStr("6541.48")}

s.app.OracleKeeper.SetMedian(s.ctx, atomMedian.Denom, atomMedian.Amount)
s.app.OracleKeeper.SetMedian(s.ctx, umeeMedian.Denom, umeeMedian.Amount)
app.OracleKeeper.SetMedianStampPeriod(ctx, 1)
rbajollari marked this conversation as resolved.
Show resolved Hide resolved
app.OracleKeeper.SetMedian(ctx, atomMedian.Denom, uint64(ctx.BlockHeight()-1), atomMedian.Amount)
app.OracleKeeper.SetMedian(ctx, umeeMedian.Denom, uint64(ctx.BlockHeight()-1), umeeMedian.Amount)

res, err := s.queryClient.Medians(s.ctx.Context(), &types.QueryMedians{})
res, err := s.queryClient.Medians(ctx.Context(), &types.QueryMedians{})
s.Require().NoError(err)
s.Require().Equal(res.Medians, sdk.NewDecCoins(atomMedian, umeeMedian))

res, err = s.queryClient.Medians(s.ctx.Context(), &types.QueryMedians{Denom: atomMedian.Denom})
res, err = s.queryClient.Medians(ctx.Context(), &types.QueryMedians{Denom: atomMedian.Denom})
s.Require().NoError(err)
s.Require().Equal(res.Medians, sdk.NewDecCoins(atomMedian))
}

func (s *IntegrationTestSuite) TestQuerier_MedianDeviations() {
app, ctx := s.app, s.ctx

atomMedianDeviation := sdk.DecCoin{Denom: "atom", Amount: sdk.MustNewDecFromStr("39.99")}
umeeMedianDeviation := sdk.DecCoin{Denom: "umee", Amount: sdk.MustNewDecFromStr("9541.48")}

s.app.OracleKeeper.SetMedianDeviation(s.ctx, atomMedianDeviation.Denom, atomMedianDeviation.Amount)
s.app.OracleKeeper.SetMedianDeviation(s.ctx, umeeMedianDeviation.Denom, umeeMedianDeviation.Amount)
app.OracleKeeper.SetMedianStampPeriod(ctx, 1)
app.OracleKeeper.SetMedianDeviation(ctx, atomMedianDeviation.Denom, uint64(ctx.BlockHeight()-1), atomMedianDeviation.Amount)
app.OracleKeeper.SetMedianDeviation(ctx, umeeMedianDeviation.Denom, uint64(ctx.BlockHeight()-1), umeeMedianDeviation.Amount)

res, err := s.queryClient.MedianDeviations(s.ctx.Context(), &types.QueryMedianDeviations{})
res, err := s.queryClient.MedianDeviations(ctx.Context(), &types.QueryMedianDeviations{})
s.Require().NoError(err)
s.Require().Equal(res.MedianDeviations, sdk.NewDecCoins(atomMedianDeviation, umeeMedianDeviation))

res, err = s.queryClient.MedianDeviations(s.ctx.Context(), &types.QueryMedianDeviations{Denom: atomMedianDeviation.Denom})
res, err = s.queryClient.MedianDeviations(ctx.Context(), &types.QueryMedianDeviations{Denom: atomMedianDeviation.Denom})
s.Require().NoError(err)
s.Require().Equal(res.MedianDeviations, sdk.NewDecCoins(atomMedianDeviation))
}
Expand Down
Loading