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: Replace deprecated simapp.MakeTestEncodingConfig with moduletestutil.MakeTestEncodingConfig #55

Merged
merged 1 commit into from
Jul 11, 2024
Merged
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
8 changes: 4 additions & 4 deletions x/coinswap/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (

errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
simappparams "cosmossdk.io/simapp/params"
"github.com/Canto-Network/Canto/v7/x/coinswap/keeper"
"github.com/Canto-Network/Canto/v7/x/coinswap/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
)
Expand Down Expand Up @@ -174,7 +174,7 @@ func SimulateMsgAddLiquidity(k keeper.Keeper, ak types.AccountKeeper, bk types.B
}
}

txGen := simappparams.MakeTestEncodingConfig().TxConfig
txGen := moduletestutil.MakeTestEncodingConfig().TxConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have there been any issues arising from the TestEncodingConfig not registering the interfaces of custom modules like coinswap? Please check if there are any problems, and if so, it would be good to refactor this code to use the same encoding config for tests and simulations as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using TestEncodingConfig, even if we do not pass modules, the msg will be recognized and reach the msg server.
gogoProtoRegistry.FindDescriptorByName(name) already contains the custom module's proto. descriptor.


tx, err := simtestutil.GenSignedMockTx(
r,
Expand Down Expand Up @@ -329,7 +329,7 @@ func SimulateMsgSwapOrder(k keeper.Keeper, ak types.AccountKeeper, bk types.Bank
}
}

txGen := simappparams.MakeTestEncodingConfig().TxConfig
txGen := moduletestutil.MakeTestEncodingConfig().TxConfig
tx, err := simtestutil.GenSignedMockTx(
r,
txGen,
Expand Down Expand Up @@ -437,7 +437,7 @@ func SimulateMsgRemoveLiquidity(k keeper.Keeper, ak types.AccountKeeper, bk type
}
}

txGen := simappparams.MakeTestEncodingConfig().TxConfig
txGen := moduletestutil.MakeTestEncodingConfig().TxConfig

tx, err := simtestutil.GenSignedMockTx(
r,
Expand Down
Loading