Skip to content

Commit

Permalink
feat: use the TxConfig from simState instead create a new one (#4327)
Browse files Browse the repository at this point in the history
* use the TxConfig from simState instead create a new one

* add changelog

* add missing method parameters
  • Loading branch information
Pantani authored Aug 30, 2024
1 parent 7ff4b5d commit 997bdc7
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
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

0 comments on commit 997bdc7

Please sign in to comment.