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(x/mint, x/gamm errors): move errors in mint and gamm keeper to errors.go (backport #2067) #2130

Merged
merged 1 commit into from
Jul 20, 2022
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
4 changes: 2 additions & 2 deletions x/gamm/pool-models/balancer/amm.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func getPoolAssetsByDenom(poolAssets []PoolAsset) (map[string]PoolAsset, error)
for _, poolAsset := range poolAssets {
_, ok := poolAssetsByDenom[poolAsset.Token.Denom]
if ok {
return nil, fmt.Errorf(errMsgFormatRepeatingPoolAssetsNotAllowed, poolAsset.Token.Denom)
return nil, fmt.Errorf(formatRepeatingPoolAssetsNotAllowedErrFormat, poolAsset.Token.Denom)
}

poolAssetsByDenom[poolAsset.Token.Denom] = poolAsset
Expand All @@ -174,7 +174,7 @@ func updateIntermediaryPoolAssetsLiquidity(liquidity sdk.Coins, poolAssetsByDeno
for _, coin := range liquidity {
poolAsset, ok := poolAssetsByDenom[coin.Denom]
if !ok {
return fmt.Errorf(errMsgFormatFailedInterimLiquidityUpdate, coin.Denom)
return fmt.Errorf(failedInterimLiquidityUpdateErrFormat, coin.Denom)
}

poolAsset.Token.Amount = poolAssetsByDenom[coin.Denom].Token.Amount.Add(coin.Amount)
Expand Down
6 changes: 3 additions & 3 deletions x/gamm/pool-models/balancer/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package balancer
import sdk "github.com/cosmos/cosmos-sdk/types"

const (
ErrMsgFormatRepeatingPoolAssetsNotAllowed = errMsgFormatRepeatingPoolAssetsNotAllowed
ErrMsgFormatNoPoolAssetFound = errMsgFormatNoPoolAssetFound
ErrMsgFormatRepeatingPoolAssetsNotAllowed = formatRepeatingPoolAssetsNotAllowedErrFormat
ErrMsgFormatNoPoolAssetFound = formatNoPoolAssetFoundErrFormat
)

var (
ErrMsgFormatFailedInterimLiquidityUpdate = errMsgFormatFailedInterimLiquidityUpdate
ErrMsgFormatFailedInterimLiquidityUpdate = failedInterimLiquidityUpdateErrFormat

CalcPoolSharesOutGivenSingleAssetIn = calcPoolSharesOutGivenSingleAssetIn
CalcSingleAssetInGivenPoolSharesOut = calcSingleAssetInGivenPoolSharesOut
Expand Down
29 changes: 15 additions & 14 deletions x/gamm/pool-models/balancer/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ import (
)

const (
errMsgFormatSharesAmountNotPositive = "shares amount must be positive, was %d"
errMsgFormatTokenAmountNotPositive = "token amount must be positive, was %d"
errMsgFormatTokensLargerThanMax = "%d resulted tokens is larger than the max amount of %d"
errMsgFormatSharesLargerThanMax = "%d resulted shares is larger than the max amount of %d"
errMsgFormatFailedInterimLiquidityUpdate = "failed to update interim liquidity - pool asset %s does not exist"
errMsgFormatRepeatingPoolAssetsNotAllowed = "repeating pool assets not allowed, found %s"
errMsgFormatNoPoolAssetFound = "can't find the PoolAsset (%s)"
nonPostiveSharesAmountErrFormat = "shares amount must be positive, was %d"
nonPostiveTokenAmountErrFormat = "token amount must be positive, was %d"
sharesLargerThanMaxErrFormat = "%d resulted shares is larger than the max amount of %d"
invalidInputDenomsErrFormat = "input denoms must already exist in the pool (%s)"

failedInterimLiquidityUpdateErrFormat = "failed to update interim liquidity - pool asset %s does not exist"
formatRepeatingPoolAssetsNotAllowedErrFormat = "repeating pool assets not allowed, found %s"
formatNoPoolAssetFoundErrFormat = "can't find the PoolAsset (%s)"

v10Fork = 4713065
)
Expand Down Expand Up @@ -223,7 +224,7 @@ func (pa Pool) getPoolAssetAndIndex(denom string) (int, PoolAsset, error) {
}

if len(pa.PoolAssets) == 0 {
return -1, PoolAsset{}, sdkerrors.Wrapf(types.ErrDenomNotFoundInPool, fmt.Sprintf(errMsgFormatNoPoolAssetFound, denom))
return -1, PoolAsset{}, sdkerrors.Wrapf(types.ErrDenomNotFoundInPool, fmt.Sprintf(formatNoPoolAssetFoundErrFormat, denom))
}

i := sort.Search(len(pa.PoolAssets), func(i int) bool {
Expand All @@ -234,11 +235,11 @@ func (pa Pool) getPoolAssetAndIndex(denom string) (int, PoolAsset, error) {
})

if i < 0 || i >= len(pa.PoolAssets) {
return -1, PoolAsset{}, sdkerrors.Wrapf(types.ErrDenomNotFoundInPool, fmt.Sprintf(errMsgFormatNoPoolAssetFound, denom))
return -1, PoolAsset{}, sdkerrors.Wrapf(types.ErrDenomNotFoundInPool, fmt.Sprintf(formatNoPoolAssetFoundErrFormat, denom))
}

if pa.PoolAssets[i].Token.Denom != denom {
return -1, PoolAsset{}, sdkerrors.Wrapf(types.ErrDenomNotFoundInPool, fmt.Sprintf(errMsgFormatNoPoolAssetFound, denom))
return -1, PoolAsset{}, sdkerrors.Wrapf(types.ErrDenomNotFoundInPool, fmt.Sprintf(formatNoPoolAssetFoundErrFormat, denom))
}

return i, pa.PoolAssets[i], nil
Expand Down Expand Up @@ -875,7 +876,7 @@ func (p *Pool) CalcTokenInShareAmountOut(
).Ceil().TruncateInt()

if !tokenInAmount.IsPositive() {
return sdk.Int{}, sdkerrors.Wrapf(types.ErrInvalidMathApprox, errMsgFormatTokenAmountNotPositive, tokenInAmount.Int64())
return sdk.Int{}, sdkerrors.Wrapf(types.ErrNotPositiveRequireAmount, nonPostiveTokenAmountErrFormat, tokenInAmount.Int64())
}

return tokenInAmount, nil
Expand All @@ -902,7 +903,7 @@ func (p *Pool) JoinPoolTokenInMaxShareAmountOut(
).TruncateInt()

if !tokenInAmount.IsPositive() {
return sdk.Int{}, sdkerrors.Wrapf(types.ErrInvalidMathApprox, errMsgFormatTokenAmountNotPositive, tokenInAmount.Int64())
return sdk.Int{}, sdkerrors.Wrapf(types.ErrNotPositiveRequireAmount, nonPostiveTokenAmountErrFormat, tokenInAmount.Int64())
}

poolAssetIn.Token.Amount = poolAssetIn.Token.Amount.Add(tokenInAmount)
Expand Down Expand Up @@ -934,11 +935,11 @@ func (p *Pool) ExitSwapExactAmountOut(
).TruncateInt()

if !sharesIn.IsPositive() {
return sdk.Int{}, sdkerrors.Wrapf(types.ErrInvalidMathApprox, errMsgFormatSharesAmountNotPositive, sharesIn.Int64())
return sdk.Int{}, sdkerrors.Wrapf(types.ErrNotPositiveRequireAmount, nonPostiveSharesAmountErrFormat, sharesIn.Int64())
}

if sharesIn.GT(shareInMaxAmount) {
return sdk.Int{}, sdkerrors.Wrapf(types.ErrLimitMaxAmount, errMsgFormatSharesLargerThanMax, sharesIn.Int64(), shareInMaxAmount.Uint64())
return sdk.Int{}, sdkerrors.Wrapf(types.ErrLimitMaxAmount, sharesLargerThanMaxErrFormat, sharesIn.Int64(), shareInMaxAmount.Uint64())
}

if err := p.exitPool(ctx, sdk.NewCoins(tokenOut), sharesIn); err != nil {
Expand Down
1 change: 1 addition & 0 deletions x/gamm/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var (
ErrAlreadyInvalidPool = sdkerrors.Register(ModuleName, 9, "destruction on already invalid pool")
ErrInvalidPool = sdkerrors.Register(ModuleName, 10, "attempting to create an invalid pool")
ErrDenomNotFoundInPool = sdkerrors.Register(ModuleName, 11, "denom does not exist in pool")
ErrDenomAlreadyInPool = sdkerrors.Register(ModuleName, 12, "denom already exists in the pool")

ErrEmptyRoutes = sdkerrors.Register(ModuleName, 21, "routes not defined")
ErrEmptyPoolAssets = sdkerrors.Register(ModuleName, 22, "PoolAssets not defined")
Expand Down
4 changes: 0 additions & 4 deletions x/mint/keeper/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ const (
)

var (
ErrAmountCannotBeNilOrZero = errAmountCannotBeNilOrZero
ErrDevVestingModuleAccountAlreadyCreated = errDevVestingModuleAccountAlreadyCreated
ErrDevVestingModuleAccountNotCreated = errDevVestingModuleAccountNotCreated

GetProportions = getProportions
)

Expand Down
16 changes: 8 additions & 8 deletions x/mint/keeper/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (suite *KeeperTestSuite) TestEndOfEpochMintedCoinDistribution() {

mintParams = app.MintKeeper.GetParams(ctx)
mintedCoin := app.MintKeeper.GetMinter(ctx).EpochProvision(mintParams)
expectedRewardsCoin, err := keeper.GetProportions(mintedCoin, mintParams.DistributionProportions.Staking)
expectedRewardsCoin, err := keeper.GetProportions(ctx, mintedCoin, mintParams.DistributionProportions.Staking)
suite.NoError(err)
expectedRewards := sdk.NewDecCoin("stake", expectedRewardsCoin.Amount)

Expand All @@ -71,7 +71,7 @@ func (suite *KeeperTestSuite) TestEndOfEpochMintedCoinDistribution() {

// test that the dev rewards module account balance decreased by the correct amount
devRewardsModuleAfter := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress())
expectedDevRewards, err := keeper.GetProportions(mintedCoin, mintParams.DistributionProportions.DeveloperRewards)
expectedDevRewards, err := keeper.GetProportions(ctx, mintedCoin, mintParams.DistributionProportions.DeveloperRewards)
suite.NoError(err)
suite.Equal(devRewardsModuleAfter.Add(expectedDevRewards), devRewardsModuleOrigin, expectedRewards.String())
}
Expand All @@ -92,7 +92,7 @@ func (suite *KeeperTestSuite) TestEndOfEpochMintedCoinDistribution() {

mintParams = app.MintKeeper.GetParams(ctx)
mintedCoin := app.MintKeeper.GetMinter(ctx).EpochProvision(mintParams)
expectedRewardsCoin, err := keeper.GetProportions(mintedCoin, mintParams.DistributionProportions.Staking)
expectedRewardsCoin, err := keeper.GetProportions(ctx, mintedCoin, mintParams.DistributionProportions.Staking)
suite.NoError(err)
expectedRewards := sdk.NewDecCoin("stake", expectedRewardsCoin.Amount)

Expand All @@ -102,7 +102,7 @@ func (suite *KeeperTestSuite) TestEndOfEpochMintedCoinDistribution() {

// test that the balance decreased by the correct amount
devRewardsModuleAfter := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress())
expectedDevRewardsCoin, err := keeper.GetProportions(mintedCoin, mintParams.DistributionProportions.DeveloperRewards)
expectedDevRewardsCoin, err := keeper.GetProportions(ctx, mintedCoin, mintParams.DistributionProportions.DeveloperRewards)
suite.NoError(err)
suite.Equal(devRewardsModuleAfter.Add(expectedDevRewardsCoin), devRewardsModuleOrigin, expectedRewards.String())
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func (suite *KeeperTestSuite) TestMintedCoinDistributionWhenDevRewardsAddressEmp

mintParams := app.MintKeeper.GetParams(ctx)
mintedCoin := app.MintKeeper.GetMinter(ctx).EpochProvision(mintParams)
expectedRewardsCoin, err := keeper.GetProportions(mintedCoin, mintParams.DistributionProportions.Staking.Add(mintParams.DistributionProportions.DeveloperRewards))
expectedRewardsCoin, err := keeper.GetProportions(ctx, mintedCoin, mintParams.DistributionProportions.Staking.Add(mintParams.DistributionProportions.DeveloperRewards))
suite.NoError(err)
expectedRewards := sdk.NewDecCoin("stake", expectedRewardsCoin.Amount)

Expand All @@ -142,7 +142,7 @@ func (suite *KeeperTestSuite) TestMintedCoinDistributionWhenDevRewardsAddressEmp

// test that the dev rewards module account balance decreased by the correct amount
devRewardsModuleAfter := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress())
expectedDevRewardsCoin, err := keeper.GetProportions(mintedCoin, mintParams.DistributionProportions.DeveloperRewards)
expectedDevRewardsCoin, err := keeper.GetProportions(ctx, mintedCoin, mintParams.DistributionProportions.DeveloperRewards)
suite.NoError(err)
suite.Equal(devRewardsModuleAfter.Add(expectedDevRewardsCoin), devRewardsModuleOrigin, expectedRewards.String())
}
Expand All @@ -163,7 +163,7 @@ func (suite *KeeperTestSuite) TestMintedCoinDistributionWhenDevRewardsAddressEmp

mintParams := app.MintKeeper.GetParams(ctx)
mintedCoin := app.MintKeeper.GetMinter(ctx).EpochProvision(mintParams)
expectedRewardsCoin, err := keeper.GetProportions(mintedCoin, mintParams.DistributionProportions.Staking.Add(mintParams.DistributionProportions.DeveloperRewards))
expectedRewardsCoin, err := keeper.GetProportions(ctx, mintedCoin, mintParams.DistributionProportions.Staking.Add(mintParams.DistributionProportions.DeveloperRewards))
suite.NoError(err)
expectedRewards := sdk.NewDecCoin("stake", expectedRewardsCoin.Amount)

Expand All @@ -173,7 +173,7 @@ func (suite *KeeperTestSuite) TestMintedCoinDistributionWhenDevRewardsAddressEmp

// test that the dev rewards module account balance decreased by the correct amount
devRewardsModuleAfter := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress())
expectedDevRewardsCoin, err := keeper.GetProportions(mintedCoin, mintParams.DistributionProportions.DeveloperRewards)
expectedDevRewardsCoin, err := keeper.GetProportions(ctx, mintedCoin, mintParams.DistributionProportions.DeveloperRewards)
suite.NoError(err)
suite.Equal(devRewardsModuleAfter.Add(expectedDevRewardsCoin), devRewardsModuleOrigin, expectedRewards.String())
}
Expand Down
22 changes: 8 additions & 14 deletions x/mint/keeper/keeper.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package keeper

import (
"errors"
"fmt"

"github.com/tendermint/tendermint/libs/log"
Expand All @@ -11,6 +10,7 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
)
Expand All @@ -36,12 +36,6 @@ func (e invalidRatioError) Error() string {
return fmt.Sprintf("mint allocation ratio (%s) is greater than 1", e.ActualRatio)
}

var (
errAmountCannotBeNilOrZero = errors.New("amount cannot be nil or zero")
errDevVestingModuleAccountAlreadyCreated = fmt.Errorf("%s module account already exists", types.DeveloperVestingModuleAcctName)
errDevVestingModuleAccountNotCreated = fmt.Errorf("%s module account does not exist", types.DeveloperVestingModuleAcctName)
)

// NewKeeper creates a new mint Keeper instance.
func NewKeeper(
cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace,
Expand Down Expand Up @@ -79,7 +73,7 @@ func NewKeeper(
// queries. The method returns an error if current height in ctx is greater than the v7 upgrade height.
func (k Keeper) SetInitialSupplyOffsetDuringMigration(ctx sdk.Context) error {
if !k.accountKeeper.HasAccount(ctx, k.accountKeeper.GetModuleAddress(types.DeveloperVestingModuleAcctName)) {
return errDevVestingModuleAccountNotCreated
return sdkerrors.Wrapf(types.ErrModuleDoesnotExist, "%s vesting module account doesnot exist", types.DeveloperVestingModuleAcctName)
}

moduleAccBalance := k.bankKeeper.GetBalance(ctx, k.accountKeeper.GetModuleAddress(types.DeveloperVestingModuleAcctName), k.GetParams(ctx).MintDenom)
Expand All @@ -96,10 +90,10 @@ func (k Keeper) SetInitialSupplyOffsetDuringMigration(ctx sdk.Context) error {
// - developer vesting module account is already created prior to calling this method.
func (k Keeper) CreateDeveloperVestingModuleAccount(ctx sdk.Context, amount sdk.Coin) error {
if amount.IsNil() || amount.Amount.IsZero() {
return errAmountCannotBeNilOrZero
return sdkerrors.Wrap(types.ErrAmountNilOrZero, "amount cannot be nil or zero")
}
if k.accountKeeper.HasAccount(ctx, k.accountKeeper.GetModuleAddress(types.DeveloperVestingModuleAcctName)) {
return errDevVestingModuleAccountAlreadyCreated
return sdkerrors.Wrapf(types.ErrModuleAccountAlreadyExist, "%s vesting module account already exist", types.DeveloperVestingModuleAcctName)
}

moduleAcc := authtypes.NewEmptyModuleAccount(
Expand Down Expand Up @@ -231,7 +225,7 @@ func (k Keeper) DistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) error

// distributeToModule distributes mintedCoin multiplied by proportion to the recepientModule account.
func (k Keeper) distributeToModule(ctx sdk.Context, recipientModule string, mintedCoin sdk.Coin, proportion sdk.Dec) (sdk.Int, error) {
distributionCoin, err := getProportions(mintedCoin, proportion)
distributionCoin, err := getProportions(ctx, mintedCoin, proportion)
if err != nil {
return sdk.Int{}, err
}
Expand All @@ -257,7 +251,7 @@ func (k Keeper) distributeToModule(ctx sdk.Context, recipientModule string, mint
// - weights in developerRewardsReceivers add up to 1.
// - addresses in developerRewardsReceivers are valid.
func (k Keeper) distributeDeveloperRewards(ctx sdk.Context, totalMintedCoin sdk.Coin, developerRewardsProportion sdk.Dec, developerRewardsReceivers []types.WeightedAddress) (sdk.Int, error) {
devRewardCoin, err := getProportions(totalMintedCoin, developerRewardsProportion)
devRewardCoin, err := getProportions(ctx, totalMintedCoin, developerRewardsProportion)
if err != nil {
return sdk.Int{}, err
}
Expand All @@ -281,7 +275,7 @@ func (k Keeper) distributeDeveloperRewards(ctx sdk.Context, totalMintedCoin sdk.
} else {
// allocate developer rewards to addresses by weight
for _, w := range developerRewardsReceivers {
devPortionCoin, err := getProportions(devRewardCoin, w.Weight)
devPortionCoin, err := getProportions(ctx, devRewardCoin, w.Weight)
if err != nil {
return sdk.Int{}, err
}
Expand Down Expand Up @@ -318,7 +312,7 @@ func (k Keeper) distributeDeveloperRewards(ctx sdk.Context, totalMintedCoin sdk.
// allocation ratio. Returns error if ratio is greater than 1.
// TODO: this currently rounds down and is the cause of rounding discrepancies.
// To be fixed in: https://github.com/osmosis-labs/osmosis/issues/1917
func getProportions(mintedCoin sdk.Coin, ratio sdk.Dec) (sdk.Coin, error) {
func getProportions(ctx sdk.Context, mintedCoin sdk.Coin, ratio sdk.Dec) (sdk.Coin, error) {
if ratio.GT(sdk.OneDec()) {
return sdk.Coin{}, invalidRatioError{ratio}
}
Expand Down
22 changes: 12 additions & 10 deletions x/mint/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (suite *KeeperTestSuite) TestGetProportions() {

for _, tc := range tests {
suite.Run(tc.name, func() {
coin, err := keeper.GetProportions(tc.mintedCoin, tc.ratio)
coin, err := keeper.GetProportions(suite.Ctx, tc.mintedCoin, tc.ratio)

if tc.expectedError != nil {
suite.Require().Equal(tc.expectedError, err)
Expand Down Expand Up @@ -168,7 +168,8 @@ func (suite *KeeperTestSuite) TestDistributeMintedCoin_ToDeveloperRewardsAddr()
{
Address: testAddressOne.String(),
Weight: sdk.NewDec(1),
}},
},
},
mintCoin: sdk.NewCoin("stake", sdk.NewInt(10000)),
},
{
Expand All @@ -181,7 +182,8 @@ func (suite *KeeperTestSuite) TestDistributeMintedCoin_ToDeveloperRewardsAddr()
{
Address: testAddressFour.String(),
Weight: sdk.NewDecWithPrec(4, 1),
}},
},
},
mintCoin: sdk.NewCoin("stake", sdk.NewInt(100000)),
},
{
Expand Down Expand Up @@ -236,7 +238,7 @@ func (suite *KeeperTestSuite) TestDistributeMintedCoin_ToDeveloperRewardsAddr()
feePool.CommunityPool.AmountOf("stake"))
} else {
suite.Equal(
//distribution go to community pool because nil dev reward addresses.
// distribution go to community pool because nil dev reward addresses.
tc.mintCoin.Amount.ToDec().Mul((params.DistributionProportions.DeveloperRewards).Add(params.DistributionProportions.CommunityPool)),
feePool.CommunityPool.AmountOf("stake"))
}
Expand Down Expand Up @@ -313,18 +315,18 @@ func (suite *KeeperTestSuite) TestCreateDeveloperVestingModuleAccount() {
},
"nil amount": {
blockHeight: 0,
expectedError: keeper.ErrAmountCannotBeNilOrZero,
expectedError: sdkerrors.Wrap(types.ErrAmountNilOrZero, "amount cannot be nil or zero"),
},
"zero amount": {
blockHeight: 0,
amount: sdk.NewCoin("stake", sdk.NewInt(0)),
expectedError: keeper.ErrAmountCannotBeNilOrZero,
expectedError: sdkerrors.Wrap(types.ErrAmountNilOrZero, "amount cannot be nil or zero"),
},
"module account is already created": {
blockHeight: 0,
amount: sdk.NewCoin("stake", sdk.NewInt(keeper.DeveloperVestingAmount)),
isDeveloperModuleAccountCreated: true,
expectedError: keeper.ErrDevVestingModuleAccountAlreadyCreated,
expectedError: sdkerrors.Wrapf(types.ErrModuleAccountAlreadyExist, "%s vesting module account already exist", types.DeveloperVestingModuleAcctName),
},
}

Expand All @@ -338,7 +340,7 @@ func (suite *KeeperTestSuite) TestCreateDeveloperVestingModuleAccount() {

if tc.expectedError != nil {
suite.Error(actualError)
suite.Equal(actualError, tc.expectedError)
suite.ErrorIs(actualError, tc.expectedError)
return
}
suite.NoError(actualError)
Expand All @@ -359,7 +361,7 @@ func (suite *KeeperTestSuite) TestSetInitialSupplyOffsetDuringMigration() {
},
"dev vesting module account does not exist": {
blockHeight: 1,
expectedError: keeper.ErrDevVestingModuleAccountNotCreated,
expectedError: sdkerrors.Wrapf(types.ErrModuleDoesnotExist, "%s vesting module account doesnot exist", types.DeveloperVestingModuleAcctName),
},
}

Expand All @@ -378,7 +380,7 @@ func (suite *KeeperTestSuite) TestSetInitialSupplyOffsetDuringMigration() {

if tc.expectedError != nil {
suite.Error(actualError)
suite.Equal(actualError, tc.expectedError)
suite.ErrorIs(actualError, tc.expectedError)

suite.Equal(supplyWithOffsetBefore.Amount, bankKeeper.GetSupplyWithOffset(ctx, sdk.DefaultBondDenom).Amount)
suite.Equal(supplyOffsetBefore, bankKeeper.GetSupplyOffset(ctx, sdk.DefaultBondDenom))
Expand Down
Loading