Skip to content

Commit

Permalink
use the TxConfig from simState instead create a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Aug 28, 2024
1 parent 16a40f0 commit b71c596
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
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 b71c596

Please sign in to comment.