refactor: rename `GenTx` to `GenSignedMockTx` to avoid confusion with genutil/GenTx (#11696)

This commit is contained in:
Anil Kumar Kammari 2022-04-20 20:57:19 +05:30 committed by GitHub
parent df61142036
commit 1a9654f8f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 29 additions and 28 deletions

View File

@ -176,6 +176,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Improvements
* [\#11696](https://github.com/cosmos/cosmos-sdk/pull/11696) Rename `helpers.GenTx` to `GenSignedMockTx` to avoid confusion with genutil's `GenTxCmd`.
* (x/auth/vesting) [\#11652](https://github.com/cosmos/cosmos-sdk/pull/11652) Add util functions for `Period(s)`
* [\#11630](https://github.com/cosmos/cosmos-sdk/pull/11630) Add SafeSub method to sdk.Coin.
* [\#11511](https://github.com/cosmos/cosmos-sdk/pull/11511) Add api server flags to start command.

View File

@ -18,8 +18,8 @@ const (
SimAppChainID = "simulation-app"
)
// GenTx generates a signed mock transaction.
func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error) {
// GenSignedMockTx generates a signed mock transaction.
func GenSignedMockTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error) {
sigs := make([]signing.SignatureV2, len(priv))
// create a random length memo

View File

@ -412,7 +412,7 @@ func SignCheckDeliver(
chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey,
) (sdk.GasInfo, *sdk.Result, error) {
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txCfg,
msgs,
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)},
@ -462,7 +462,7 @@ func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, i
txs := make([]sdk.Tx, numToGenerate)
var err error
for i := 0; i < numToGenerate; i++ {
txs[i], err = helpers.GenTx(
txs[i], err = helpers.GenSignedMockTx(
txGen,
msgs,
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)},

View File

@ -117,7 +117,7 @@ func SimulateMsgGrant(ak authz.AccountKeeper, bk authz.BankKeeper, _ keeper.Keep
return simtypes.NoOpMsg(authz.ModuleName, TypeMsgGrant, err.Error()), nil, err
}
txCfg := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txCfg,
[]sdk.Msg{msg},
fees,
@ -187,7 +187,7 @@ func SimulateMsgRevoke(ak authz.AccountKeeper, bk authz.BankKeeper, k keeper.Kee
msg := authz.NewMsgRevoke(granterAddr, granteeAddr, a.MsgTypeURL())
txCfg := simappparams.MakeTestEncodingConfig().TxConfig
account := ak.GetAccount(ctx, granterAddr)
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txCfg,
[]sdk.Msg{&msg},
fees,
@ -276,7 +276,7 @@ func SimulateMsgExec(ak authz.AccountKeeper, bk authz.BankKeeper, k keeper.Keepe
txCfg := simappparams.MakeTestEncodingConfig().TxConfig
granteeAcc := ak.GetAccount(ctx, granteeAddr)
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txCfg,
[]sdk.Msg{&msgExec},
fees,

View File

@ -138,7 +138,7 @@ func sendMsgSend(
}
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{msg},
fees,
@ -360,7 +360,7 @@ func sendMsgMultiSend(
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{msg},
fees,

View File

@ -234,7 +234,7 @@ func (suite *GenTxTestSuite) TestDeliverGenTxs() {
_ = suite.setAccountBalance(addr2, 1)
msg := banktypes.NewMsgSend(addr1, addr2, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 1)})
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
suite.encodingConfig.TxConfig,
[]sdk.Msg{msg},
sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10)},

View File

@ -170,7 +170,7 @@ func SimulateMsgSubmitProposal(
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{msg},
fees,

View File

@ -258,7 +258,7 @@ func SimulateMsgCreateGroup(ak group.AccountKeeper, bk group.BankKeeper) simtype
msg := &group.MsgCreateGroup{Admin: accAddr, Members: members, Metadata: simtypes.RandStringOfLength(r, 10)}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{msg},
fees,
@ -316,7 +316,7 @@ func SimulateMsgCreateGroupWithPolicy(ak group.AccountKeeper, bk group.BankKeepe
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{msg},
fees,
@ -374,7 +374,7 @@ func SimulateMsgCreateGroupPolicy(ak group.AccountKeeper, bk group.BankKeeper, k
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{msg},
fees,
@ -448,7 +448,7 @@ func SimulateMsgSubmitProposal(ak group.AccountKeeper, bk group.BankKeeper, k ke
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{&msg},
fees,
@ -506,7 +506,7 @@ func SimulateMsgUpdateGroupAdmin(ak group.AccountKeeper, bk group.BankKeeper, k
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{&msg},
fees,
@ -555,7 +555,7 @@ func SimulateMsgUpdateGroupMetadata(ak group.AccountKeeper, bk group.BankKeeper,
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{&msg},
fees,
@ -632,7 +632,7 @@ func SimulateMsgUpdateGroupMembers(ak group.AccountKeeper,
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{&msg},
fees,
@ -690,7 +690,7 @@ func SimulateMsgUpdateGroupPolicyAdmin(ak group.AccountKeeper, bk group.BankKeep
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{&msg},
fees,
@ -749,7 +749,7 @@ func SimulateMsgUpdateGroupPolicyDecisionPolicy(ak group.AccountKeeper,
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{msg},
fees,
@ -798,7 +798,7 @@ func SimulateMsgUpdateGroupPolicyMetadata(ak group.AccountKeeper,
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{&msg},
fees,
@ -898,7 +898,7 @@ func SimulateMsgWithdrawProposal(ak group.AccountKeeper,
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{&msg},
fees,
@ -1002,7 +1002,7 @@ func SimulateMsgVote(ak group.AccountKeeper,
Metadata: simtypes.RandStringOfLength(r, 10),
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{&msg},
fees,
@ -1078,7 +1078,7 @@ func SimulateMsgExec(ak group.AccountKeeper,
Executor: acc.Address.String(),
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{&msg},
fees,
@ -1140,7 +1140,7 @@ func SimulateMsgLeaveGroup(k keeper.Keeper, ak group.AccountKeeper, bk group.Ban
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{msg},
fees,

View File

@ -99,7 +99,7 @@ func SimulateMsgSend(
}
txCfg := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txCfg,
[]sdk.Msg{msg},
fees,

View File

@ -100,7 +100,7 @@ func GenAndDeliverTxWithRandFees(txCtx OperationInput) (simtypes.OperationMsg, [
// GenAndDeliverTx generates a transactions and delivers it.
func GenAndDeliverTx(txCtx OperationInput, fees sdk.Coins) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
account := txCtx.AccountKeeper.GetAccount(txCtx.Context, txCtx.SimAccount.Address)
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txCtx.TxGen,
[]sdk.Msg{txCtx.Msg},
fees,

View File

@ -89,7 +89,7 @@ func SimulateMsgUnjail(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Kee
msg := types.NewMsgUnjail(validator.GetOperator())
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
txGen,
[]sdk.Msg{msg},
fees,