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

feat: make PoolModuleI CalculateSpotPrice API return BigDec (backport #6487) #6495

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### API Breaks

* [#6487](https://github.com/osmosis-labs/osmosis/pull/6487) make PoolModuleI CalculateSpotPrice API return BigDec

## v19.1.0

### Features
Expand Down
8 changes: 4 additions & 4 deletions app/apptesting/gamm.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ func (s *KeeperTestHelper) PrepareBalancerPoolWithCoinsAndWeights(coins sdk.Coin
}

var zeroDec = osmomath.ZeroDec()
var oneThirdSpotPriceUnits = osmomath.NewDec(1).Quo(osmomath.NewDec(3)).
MulIntMut(gammtypes.SpotPriceSigFigs).RoundInt().ToLegacyDec().QuoInt(gammtypes.SpotPriceSigFigs)
var oneThirdSpotPriceUnits = osmomath.BigDecFromDec(osmomath.NewDec(1).Quo(osmomath.NewDec(3)).
MulIntMut(gammtypes.SpotPriceSigFigs).RoundInt().ToLegacyDec().QuoInt(gammtypes.SpotPriceSigFigs))

// PrepareBalancerPool returns a Balancer pool's pool-ID with pool params set in PrepareBalancerPoolWithPoolParams.
func (s *KeeperTestHelper) PrepareBalancerPool() uint64 {
Expand All @@ -99,10 +99,10 @@ func (s *KeeperTestHelper) PrepareBalancerPool() uint64 {

spotPrice, err := s.App.GAMMKeeper.CalculateSpotPrice(s.Ctx, poolId, FOO, BAR)
s.NoError(err)
s.Equal(osmomath.NewDec(2), spotPrice)
s.Equal(osmomath.NewBigDec(2), spotPrice)
spotPrice, err = s.App.GAMMKeeper.CalculateSpotPrice(s.Ctx, poolId, BAR, BAZ)
s.NoError(err)
s.Equal(osmomath.NewDecWithPrec(15, 1), spotPrice)
s.Equal(osmomath.NewBigDecWithPrec(15, 1), spotPrice)
spotPrice, err = s.App.GAMMKeeper.CalculateSpotPrice(s.Ctx, poolId, BAZ, FOO)
s.NoError(err)
s.Equal(oneThirdSpotPriceUnits, spotPrice)
Expand Down
2 changes: 1 addition & 1 deletion app/apptesting/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ func (s *KeeperTestHelper) SetupGammPoolsWithBondDenomMultiplier(multipliers []o

// SwapAndSetSpotPrice runs a swap to set Spot price of a pool using arbitrary values
// returns spot price after the arbitrary swap.
func (s *KeeperTestHelper) SwapAndSetSpotPrice(poolId uint64, fromAsset sdk.Coin, toAsset sdk.Coin) osmomath.Dec {
func (s *KeeperTestHelper) SwapAndSetSpotPrice(poolId uint64, fromAsset sdk.Coin, toAsset sdk.Coin) osmomath.BigDec {
// create a dummy account
acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes())

Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v16/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (suite *UpgradeTestSuite) TestUpgrade() {
suite.Require().Equal(v16.DAIIBCDenom, concentratedTypePool.GetToken1())

// Validate that the spot price of the CL pool is what we expect
suite.Require().Equal(0, multiplicativeTolerance.CompareBigDec(concentratedTypePool.GetCurrentSqrtPrice().PowerInteger(2), osmomath.BigDecFromDec(balancerSpotPrice)))
suite.Require().Equal(0, multiplicativeTolerance.CompareBigDec(concentratedTypePool.GetCurrentSqrtPrice().PowerInteger(2), balancerSpotPrice))

// Validate that link was created.
migrationInfo, err := suite.App.GAMMKeeper.GetAllMigrationInfo(suite.Ctx)
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v17/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (suite *UpgradeTestSuite) TestUpgrade() {
suite.Require().Equal(assetPair.QuoteAsset, concentratedTypePool.GetToken1())

// Validate that the spot price of the CL pool is what we expect
suite.Require().Equal(0, multiplicativeTolerance.CompareBigDec(concentratedTypePool.GetCurrentSqrtPrice().PowerInteger(2), osmomath.BigDecFromDec(balancerSpotPrice)))
suite.Require().Equal(0, multiplicativeTolerance.CompareBigDec(concentratedTypePool.GetCurrentSqrtPrice().PowerInteger(2), balancerSpotPrice))

// Validate that the link is correct.
migrationInfo, err := suite.App.GAMMKeeper.GetAllMigrationInfo(suite.Ctx)
Expand Down Expand Up @@ -463,7 +463,7 @@ func (suite *UpgradeTestSuite) TestUpgrade() {
suite.Require().Equal(quoteAsset, concentratedTypePool.GetToken1())

// Validate that the spot price of the CL pool is what we expect
suite.Require().Equal(0, multiplicativeTolerance.CompareBigDec(concentratedTypePool.GetCurrentSqrtPrice().PowerInteger(2), osmomath.BigDecFromDec(balancerSpotPrice)))
suite.Require().Equal(0, multiplicativeTolerance.CompareBigDec(concentratedTypePool.GetCurrentSqrtPrice().PowerInteger(2), balancerSpotPrice))

// Validate that the link is correct.
migrationInfo, err := suite.App.GAMMKeeper.GetAllMigrationInfo(suite.Ctx)
Expand Down
4 changes: 2 additions & 2 deletions tests/mocks/pool_module.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 8 additions & 10 deletions x/concentrated-liquidity/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,36 +144,34 @@ func (k Keeper) CalculateSpotPrice(
poolId uint64,
quoteAssetDenom string,
baseAssetDenom string,
) (spotPrice osmomath.Dec, err error) {
) (spotPrice osmomath.BigDec, err error) {
concentratedPool, err := k.getPoolById(ctx, poolId)
if err != nil {
return osmomath.Dec{}, err
return osmomath.BigDec{}, err
}

hasPositions, err := k.HasAnyPositionForPool(ctx, poolId)
if err != nil {
return osmomath.Dec{}, err
return osmomath.BigDec{}, err
}

if !hasPositions {
return osmomath.Dec{}, types.NoSpotPriceWhenNoLiquidityError{PoolId: poolId}
return osmomath.BigDec{}, types.NoSpotPriceWhenNoLiquidityError{PoolId: poolId}
}

price, err := concentratedPool.SpotPrice(ctx, quoteAssetDenom, baseAssetDenom)
if err != nil {
return osmomath.Dec{}, err
return osmomath.BigDec{}, err
}

if price.IsZero() {
return osmomath.Dec{}, types.PriceBoundError{ProvidedPrice: price, MinSpotPrice: types.MinSpotPriceV2, MaxSpotPrice: types.MaxSpotPrice}
return osmomath.BigDec{}, types.PriceBoundError{ProvidedPrice: price, MinSpotPrice: types.MinSpotPriceV2, MaxSpotPrice: types.MaxSpotPrice}
}
if price.GT(types.MaxSpotPriceBigDec) || price.LT(types.MinSpotPriceBigDec) {
return osmomath.Dec{}, types.PriceBoundError{ProvidedPrice: price, MinSpotPrice: types.MinSpotPriceBigDec, MaxSpotPrice: types.MaxSpotPrice}
return osmomath.BigDec{}, types.PriceBoundError{ProvidedPrice: price, MinSpotPrice: types.MinSpotPriceBigDec, MaxSpotPrice: types.MaxSpotPrice}
}

// TODO: remove before https://github.com/osmosis-labs/osmosis/issues/5726 is complete.
// Acceptable for backwards compatibility with v19.x.
return price.Dec(), nil
return price, nil
}

// GetTotalPoolLiquidity returns the coins in the pool owned by all LPs
Expand Down
10 changes: 7 additions & 3 deletions x/concentrated-liquidity/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,20 +245,24 @@ func (s *KeeperTestSuite) TestCalculateSpotPrice() {
spotPrice, err := s.App.ConcentratedLiquidityKeeper.CalculateSpotPrice(s.Ctx, poolId, ETH, USDC)
s.Require().Error(err)
s.Require().ErrorAs(err, &types.NoSpotPriceWhenNoLiquidityError{PoolId: poolId})
s.Require().Equal(osmomath.Dec{}, spotPrice)
s.Require().Equal(osmomath.BigDec{}, spotPrice)

// set up default position to have proper spot price
s.SetupDefaultPosition(defaultPoolId)

// ETH is token0 so its price will be the DefaultCurrSqrtPrice squared
spotPriceBaseETH, err := s.App.ConcentratedLiquidityKeeper.CalculateSpotPrice(s.Ctx, poolId, USDC, ETH)
s.Require().NoError(err)
s.Require().Equal(spotPriceBaseETH, DefaultCurrSqrtPrice.PowerInteger(2).Dec())
// TODO: remove Dec truncation before https://github.com/osmosis-labs/osmosis/issues/5726 is complete
// Currently exists for state-compatibility with v19.x
s.Require().Equal(spotPriceBaseETH.Dec(), DefaultCurrSqrtPrice.PowerInteger(2).Dec())

// test that we have correct values for reversed quote asset and base asset
spotPriceBaseUSDC, err := s.App.ConcentratedLiquidityKeeper.CalculateSpotPrice(s.Ctx, poolId, ETH, USDC)
s.Require().NoError(err)
s.Require().Equal(spotPriceBaseUSDC, osmomath.OneBigDec().Quo(DefaultCurrSqrtPrice.PowerInteger(2)).Dec())
// TODO: remove Dec truncation before https://github.com/osmosis-labs/osmosis/issues/5726 is complete
// Currently exists for state-compatibility with v19.x
s.Require().Equal(spotPriceBaseUSDC.Dec(), osmomath.OneBigDec().Quo(DefaultCurrSqrtPrice.PowerInteger(2)).Dec())

// try getting spot price from a non-existent pool
spotPrice, err = s.App.ConcentratedLiquidityKeeper.CalculateSpotPrice(s.Ctx, poolId+1, USDC, ETH)
Expand Down
8 changes: 4 additions & 4 deletions x/cosmwasmpool/pool_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,19 @@ func (k Keeper) CalculateSpotPrice(
poolId uint64,
quoteAssetDenom string,
baseAssetDenom string,
) (price osmomath.Dec, err error) {
) (price osmomath.BigDec, err error) {
cosmwasmPool, err := k.GetPoolById(ctx, poolId)
if err != nil {
return osmomath.Dec{}, err
return osmomath.BigDec{}, err
}

spotPriceBigDec, err := cosmwasmPool.SpotPrice(ctx, quoteAssetDenom, baseAssetDenom)
if err != nil {
return osmomath.Dec{}, err
return osmomath.BigDec{}, err
}
// Truncation is acceptable here since the only reason cosmwasmPool returns a BigDec
// is to maintain compatibility with the `PoolI.SpotPrice` API.
return spotPriceBigDec.Dec(), nil
return spotPriceBigDec, nil
}

// SwapExactAmountIn performs a swap operation with a specified input amount in a CosmWasm-based liquidity pool.
Expand Down
8 changes: 6 additions & 2 deletions x/gamm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,9 @@ func (q Querier) SpotPrice(ctx context.Context, req *types.QuerySpotPriceRequest
}

return &types.QuerySpotPriceResponse{
SpotPrice: sp.String(),
// Note: truncation exists here to maintain backwards compatibility.
// This query has historically had 18 decimals in response.
SpotPrice: sp.Dec().String(),
}, nil
}

Expand Down Expand Up @@ -412,7 +414,9 @@ func (q QuerierV2) SpotPrice(ctx context.Context, req *v2types.QuerySpotPriceReq
// Deeprecated: use alternate in x/poolmanager
// nolint: staticcheck
return &v2types.QuerySpotPriceResponse{
SpotPrice: sp.String(),
// Note: truncation exists here to maintain backwards compatibility.
// This query has historically had 18 decimals in response.
SpotPrice: sp.Dec().String(),
}, nil
}

Expand Down
16 changes: 8 additions & 8 deletions x/gamm/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,12 +897,12 @@ func (s *KeeperTestSuite) TestQueryStableswapPoolSpotPrice() {
} else {
s.Require().NoError(err, "unexpected error")
// We allow for a small geometric error due to our spot price being an approximation
expectedSpotPrice := osmomath.MustNewDecFromStr(tc.result)
actualSpotPrice := osmomath.MustNewDecFromStr(result.SpotPrice)
expectedSpotPrice := osmomath.MustNewBigDecFromStr(tc.result)
actualSpotPrice := osmomath.MustNewBigDecFromStr(result.SpotPrice)
diff := (expectedSpotPrice.Sub(actualSpotPrice)).Abs()
errTerm := diff.Quo(osmomath.MinDec(expectedSpotPrice, actualSpotPrice))
errTerm := diff.Quo(osmomath.MinBigDec(expectedSpotPrice, actualSpotPrice))

s.Require().True(errTerm.LT(osmomath.NewDecWithPrec(1, 3)), "Expected: %d, Actual: %d", expectedSpotPrice, actualSpotPrice)
s.Require().True(errTerm.LT(osmomath.NewBigDecWithPrec(1, 3)), "Expected: %d, Actual: %d", expectedSpotPrice, actualSpotPrice)
}
})
}
Expand Down Expand Up @@ -980,12 +980,12 @@ func (s *KeeperTestSuite) TestV2QueryStableswapPoolSpotPrice() {
s.Require().NoError(err, "unexpected error")

// We allow for a small geometric error due to our spot price being an approximation
expectedSpotPrice := osmomath.MustNewDecFromStr(tc.result)
actualSpotPrice := osmomath.MustNewDecFromStr(result.SpotPrice)
expectedSpotPrice := osmomath.MustNewBigDecFromStr(tc.result)
actualSpotPrice := osmomath.MustNewBigDecFromStr(result.SpotPrice)
diff := (expectedSpotPrice.Sub(actualSpotPrice)).Abs()
errTerm := diff.Quo(osmomath.MinDec(expectedSpotPrice, actualSpotPrice))
errTerm := diff.Quo(osmomath.MinBigDec(expectedSpotPrice, actualSpotPrice))

s.Require().True(errTerm.LT(osmomath.NewDecWithPrec(1, 3)), "Expected: %d, Actual: %d", expectedSpotPrice, actualSpotPrice)
s.Require().True(errTerm.LT(osmomath.NewBigDecWithPrec(1, 3)), "Expected: %d, Actual: %d", expectedSpotPrice, actualSpotPrice)
}
})
}
Expand Down
28 changes: 15 additions & 13 deletions x/gamm/keeper/pool_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,41 @@ func (k Keeper) CalculateSpotPrice(
poolID uint64,
quoteAssetDenom string,
baseAssetDenom string,
) (spotPrice osmomath.Dec, err error) {
) (spotPrice osmomath.BigDec, err error) {
pool, err := k.GetPoolAndPoke(ctx, poolID)
if err != nil {
return osmomath.Dec{}, err
return osmomath.BigDec{}, err
}

// defer to catch panics, in case something internal overflows.
defer func() {
if r := recover(); r != nil {
spotPrice = osmomath.Dec{}
spotPrice = osmomath.BigDec{}
err = types.ErrSpotPriceInternal
}
}()

spotPriceBigDec, err := pool.SpotPrice(ctx, quoteAssetDenom, baseAssetDenom)
spotPrice, err = pool.SpotPrice(ctx, quoteAssetDenom, baseAssetDenom)
if err != nil {
return osmomath.Dec{}, err
return osmomath.BigDec{}, err
}

// Truncation is acceptable here because both stableswap and balancer
// only support 18 decimal places and wrap around the 36 BigDec for
// compatibility with the `PoolI.SpotPrice` API
spotPrice = spotPriceBigDec.Dec()
// TODO: this is done to maintain state-compatibility with v19.x
// Remove after https://github.com/osmosis-labs/osmosis/issues/6064 is complete.
spotPrice.ChopPrecisionMut(osmomath.PrecisionDec)

// if spotPrice greater than max spot price, return an error
if spotPrice.GT(types.MaxSpotPrice) {
return types.MaxSpotPrice, types.ErrSpotPriceOverflow
if spotPrice.GT(types.MaxSpotPriceBigDec) {
return types.MaxSpotPriceBigDec, types.ErrSpotPriceOverflow
} else if !spotPrice.IsPositive() {
return osmomath.Dec{}, types.ErrSpotPriceInternal
return osmomath.BigDec{}, types.ErrSpotPriceInternal
}

// we want to round this to `SpotPriceSigFigs` of precision
spotPrice = osmomath.SigFigRound(spotPrice, types.SpotPriceSigFigs)
// Truncation is acceptable here because both stableswap and balancer
// only support 18 decimal places and wrap around the 36 BigDec for
// compatibility with the `PoolI.SpotPrice` API
spotPrice = osmomath.BigDecFromDec(osmomath.SigFigRound(spotPrice.Dec(), types.SpotPriceSigFigs))
return spotPrice, err
}

Expand Down
4 changes: 2 additions & 2 deletions x/gamm/keeper/pool_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,11 @@ func (s *KeeperTestSuite) TestSpotPriceOverflow() {
s.Require().NoError(poolErr)
s.Require().ErrorIs(keeperErr, types.ErrSpotPriceOverflow)
s.Require().Error(keeperErr)
s.Require().Equal(types.MaxSpotPrice, keeperSpotPrice)
s.Require().Equal(types.MaxSpotPriceBigDec, keeperSpotPrice)
} else if tc.panics {
s.Require().ErrorIs(keeperErr, types.ErrSpotPriceInternal)
s.Require().Error(keeperErr)
s.Require().Equal(osmomath.Dec{}, keeperSpotPrice)
s.Require().Equal(osmomath.BigDec{}, keeperSpotPrice)
} else {
s.Require().NoError(poolErr)
s.Require().NoError(keeperErr)
Expand Down
4 changes: 2 additions & 2 deletions x/gamm/keeper/swap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (s *KeeperTestSuite) TestBalancerPoolSimpleSwapExactAmountIn() {
}

// Ratio of the token out should be between the before spot price and after spot price.
tradeAvgPrice := test.param.tokenIn.Amount.ToLegacyDec().Quo(tokenOutAmount.ToLegacyDec())
tradeAvgPrice := osmomath.BigDecFromDec(test.param.tokenIn.Amount.ToLegacyDec().Quo(tokenOutAmount.ToLegacyDec()))
s.True(tradeAvgPrice.GT(spotPriceBefore) && tradeAvgPrice.LT(spotPriceAfter), "test: %v", test.name)
} else {
_, err := keeper.SwapExactAmountIn(ctx, s.TestAccs[0], pool, test.param.tokenIn, test.param.tokenOutDenom, test.param.tokenOutMinAmount, spreadFactor)
Expand Down Expand Up @@ -413,7 +413,7 @@ func (s *KeeperTestSuite) TestBalancerPoolSimpleSwapExactAmountOut() {
s.NoError(err, "test: %v", test.name)

// Ratio of the token out should be between the before spot price and after spot price.
tradeAvgPrice := tokenInAmount.ToLegacyDec().Quo(test.param.tokenOut.Amount.ToLegacyDec())
tradeAvgPrice := osmomath.BigDecFromDec(tokenInAmount.ToLegacyDec().Quo(test.param.tokenOut.Amount.ToLegacyDec()))
s.True(tradeAvgPrice.GT(spotPriceBefore) && tradeAvgPrice.LT(spotPriceAfter), "test: %v", test.name)
} else {
_, err := keeper.SwapExactAmountOut(s.Ctx, s.TestAccs[0], pool, test.param.tokenInDenom, test.param.tokenInMaxAmount, test.param.tokenOut, spreadFactor)
Expand Down
16 changes: 8 additions & 8 deletions x/gamm/pool-models/balancer/pool_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,49 +638,49 @@ func (s *KeeperTestSuite) TestBalancerSpotPrice() {
baseDenomPoolInput sdk.Coin
quoteDenomPoolInput sdk.Coin
expectError bool
expectedOutput osmomath.Dec
expectedOutput osmomath.BigDec
}{
{
name: "equal value",
baseDenomPoolInput: sdk.NewInt64Coin(baseDenom, 100),
quoteDenomPoolInput: sdk.NewInt64Coin(quoteDenom, 100),
expectError: false,
expectedOutput: osmomath.MustNewDecFromStr("1"),
expectedOutput: osmomath.MustNewBigDecFromStr("1"),
},
{
name: "1:2 ratio",
baseDenomPoolInput: sdk.NewInt64Coin(baseDenom, 100),
quoteDenomPoolInput: sdk.NewInt64Coin(quoteDenom, 200),
expectError: false,
expectedOutput: osmomath.MustNewDecFromStr("0.500000000000000000"),
expectedOutput: osmomath.MustNewBigDecFromStr("0.500000000000000000"),
},
{
name: "2:1 ratio",
baseDenomPoolInput: sdk.NewInt64Coin(baseDenom, 200),
quoteDenomPoolInput: sdk.NewInt64Coin(quoteDenom, 100),
expectError: false,
expectedOutput: osmomath.MustNewDecFromStr("2.000000000000000000"),
expectedOutput: osmomath.MustNewBigDecFromStr("2.000000000000000000"),
},
{
name: "rounding after sigfig ratio",
baseDenomPoolInput: sdk.NewInt64Coin(baseDenom, 220),
quoteDenomPoolInput: sdk.NewInt64Coin(quoteDenom, 115),
expectError: false,
expectedOutput: osmomath.MustNewDecFromStr("1.913043480000000000"), // ans is 1.913043478260869565, rounded is 1.91304348
expectedOutput: osmomath.MustNewBigDecFromStr("1.913043480000000000"), // ans is 1.913043478260869565, rounded is 1.91304348
},
{
name: "check number of sig figs",
baseDenomPoolInput: sdk.NewInt64Coin(baseDenom, 100),
quoteDenomPoolInput: sdk.NewInt64Coin(quoteDenom, 300),
expectError: false,
expectedOutput: osmomath.MustNewDecFromStr("0.333333330000000000"),
expectedOutput: osmomath.MustNewBigDecFromStr("0.333333330000000000"),
},
{
name: "check number of sig figs high sizes",
baseDenomPoolInput: sdk.NewInt64Coin(baseDenom, 343569192534),
quoteDenomPoolInput: sdk.NewCoin(quoteDenom, osmomath.MustNewDecFromStr("186633424395479094888742").TruncateInt()),
expectError: false,
expectedOutput: osmomath.MustNewDecFromStr("0.000000000001840877"),
expectedOutput: osmomath.MustNewBigDecFromStr("0.000000000001840877"),
},
}

Expand Down Expand Up @@ -819,7 +819,7 @@ func (s *KeeperTestSuite) TestBalancerSpotPriceBounds() {
s.Require().Error(err, "test: %s", tc.name)
} else {
s.Require().NoError(err, "test: %s", tc.name)
s.Require().True(spotPrice.Equal(tc.expectedOutput),
s.Require().True(spotPrice.Equal(osmomath.BigDecFromDec(tc.expectedOutput)),
"test: %s\nSpot price wrong, got %s, expected %s\n", tc.name,
spotPrice, tc.expectedOutput)
}
Expand Down
Loading