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: use the TxConfig from simState instead create a new one #4327

Merged
merged 5 commits into from
Aug 30, 2024
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
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- [#4113](https://github.com/ignite/cli/pull/4113) Generate chain config documentation automatically
- [#4131](https://github.com/ignite/cli/pull/4131) Support `bytes` as data type in the `scaffold` commands
- [#4300](https://github.com/ignite/cli/pull/4300) Only panics the module in the most top function level
- [#4327](https://github.com/ignite/cli/pull/4327) Use the TxConfig from simState instead create a new one
- [#4326](https://github.com/ignite/cli/pull/4326) fAdd `buf.build` version to `ignite version` command

### Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func SimulateMsg<%= MsgName.UpperCamel %>(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
txGen client.TxConfig,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
txGen client.TxConfig,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand All @@ -28,7 +29,7 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>(
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig,
TxGen: txGen,
Cdc: nil,
Msg: msg,
Context: ctx,
Expand All @@ -46,6 +47,7 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
txGen client.TxConfig,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand Down Expand Up @@ -81,7 +83,7 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>(
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig,
TxGen: txGen,
Cdc: nil,
Msg: msg,
Context: ctx,
Expand All @@ -99,6 +101,7 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
txGen client.TxConfig,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand Down Expand Up @@ -134,7 +137,7 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>(
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig,
TxGen: txGen,
Cdc: nil,
Msg: msg,
Context: ctx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
txGen client.TxConfig,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand All @@ -39,7 +40,7 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>(
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig,
TxGen: txGen,
Cdc: nil,
Msg: msg,
Context: ctx,
Expand All @@ -57,6 +58,7 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
txGen client.TxConfig,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand Down Expand Up @@ -92,7 +94,7 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>(
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig,
TxGen: txGen,
Cdc: nil,
Msg: msg,
Context: ctx,
Expand All @@ -110,6 +112,7 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
txGen client.TxConfig,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand Down Expand Up @@ -145,7 +148,7 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>(
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig,
TxGen: txGen,
Cdc: nil,
Msg: msg,
Context: ctx,
Expand Down
4 changes: 2 additions & 2 deletions ignite/templates/typed/simapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func ModuleSimulationMsgModify(
)
operations = append(operations, simulation.NewWeightedOperation(
weightMsg%[2]v%[3]v,
%[4]vsimulation.SimulateMsg%[2]v%[3]v(am.accountKeeper, am.bankKeeper, am.keeper),
%[4]vsimulation.SimulateMsg%[2]v%[3]v(am.accountKeeper, am.bankKeeper, am.keeper, simState.TxConfig),
))

%[1]v`
Expand All @@ -49,7 +49,7 @@ func ModuleSimulationMsgModify(
opWeightMsg%[2]v%[3]v,
defaultWeightMsg%[2]v%[3]v,
func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg {
%[4]vsimulation.SimulateMsg%[2]v%[3]v(am.accountKeeper, am.bankKeeper, am.keeper)
%[4]vsimulation.SimulateMsg%[2]v%[3]v(am.accountKeeper, am.bankKeeper, am.keeper, simState.TxConfig)
return nil
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
txGen client.TxConfig,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand All @@ -35,7 +36,7 @@ func SimulateMsgCreate<%= TypeName.UpperCamel %>(
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig,
TxGen: txGen,
Cdc: nil,
Msg: msg,
Context: ctx,
Expand All @@ -53,6 +54,7 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
txGen client.TxConfig,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand All @@ -73,7 +75,7 @@ func SimulateMsgUpdate<%= TypeName.UpperCamel %>(
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig,
TxGen: txGen,
Cdc: nil,
Msg: msg,
Context: ctx,
Expand All @@ -91,6 +93,7 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>(
ak types.AccountKeeper,
bk types.BankKeeper,
k keeper.Keeper,
txGen client.TxConfig,
) simtypes.Operation {
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand All @@ -111,7 +114,7 @@ func SimulateMsgDelete<%= TypeName.UpperCamel %>(
txCtx := simulation.OperationInput{
R: r,
App: app,
TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig,
TxGen: txGen,
Cdc: nil,
Msg: msg,
Context: ctx,
Expand Down
Loading