From 0d0170be898950a45d57fa643a099b2c0e5f8425 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Sat, 15 Oct 2022 23:55:36 +0200 Subject: [PATCH 1/8] chore: update 0.45 changelog --- CHANGELOG.md | 68 +++++++++++++++++++++++++----------------------- RELEASE_NOTES.md | 5 ++-- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4068c1c8195..44f0531d43c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,19 +41,14 @@ Ref: https://keepachangelog.com/en/1.0.0/ ATTENTION: -This is a security release for the -[Dragonberry security advisory](https://forum.cosmos.network/t/ibc-security-advisory-dragonberry/7702). +This is a security release for the [Dragonberry security advisory](https://forum.cosmos.network/t/ibc-security-advisory-dragonberry/7702). All users should upgrade immediately. -Users *must* add a replace directive in their go.mod for the -new `ics23` package in the SDK: - -``` -replace ( - github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23 -) +Users *must* add a replace directive in their go.mod for thenew `ics23` package in the SDK: +```go +replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23 v0.8.0 ``` ### Features @@ -66,7 +61,7 @@ replace ( * [#13323](https://github.com/cosmos/cosmos-sdk/pull/13323) Ensure `withdraw_rewards` rewards are emitted from all actions that result in rewards being withdrawn. * [#13321](https://github.com/cosmos/cosmos-sdk/pull/13321) Add flag to disable fast node migration and usage. * (store) [#13326](https://github.com/cosmos/cosmos-sdk/pull/13326) Implementation of ADR-038 file StreamingService, backport #8664. -* (store) [#13540](https://github.com/cosmos/cosmos-sdk/pull/13540) Default fastnode migration to false to prevent suprises. Operators must enable it, unless they have it enabled already. +* (store) [#13540](https://github.com/cosmos/cosmos-sdk/pull/13540) Default fastnode migration to false to prevent suprises. Operators must enable it, unless they have it enabled already. ### API Breaking Changes @@ -74,10 +69,14 @@ replace ( ### Bug Fixes -* [#...](https://github.com/cosmos/cosmos-sdk/pull/) Implement dragonberry security patch. - * For applying the patch please refer to the [RELEASE NOTES](./RELEASE_NOTES.md) +* Implement dragonberry security patch. + * For applying the patch please refer to the [RELEASE NOTES](./RELEASE_NOTES.md) * (store) [#13459](https://github.com/cosmos/cosmos-sdk/pull/13459) Don't let state listener observe the uncommitted writes. +### Notes + +Reverted #12437 due to API breaking changes. + ## v0.45.8 - 2022-08-25 ### Improvements @@ -112,6 +111,9 @@ replace ( ### Bug Fixes * (x/mint) [#12384](https://github.com/cosmos/cosmos-sdk/pull/12384) Ensure `GoalBonded` must be positive when performing `x/mint` parameter validation. +* (simapp) [#12437](https://github.com/cosmos/cosmos-sdk/pull/12437) fix the non-determinstic behavior in simulations caused by `GenTx` and check +empty coins slice before it is used to create `banktype.MsgSend`. +* (x/capability) [#12818](https://github.com/cosmos/cosmos-sdk/pull/12818) Use fixed length hex for pointer at FwdCapabilityKey. ## [v0.45.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.6) - 2022-06-28 @@ -278,7 +280,7 @@ replace ( ### Improvements -* (types) [\#10630](https://github.com/cosmos/cosmos-sdk/pull/10630) Add an `Events` field to the `TxResponse` type that captures _all_ events emitted by a transaction, unlike `Logs` which only contains events emitted during message execution. +* (types) [\#10630](https://github.com/cosmos/cosmos-sdk/pull/10630) Add an `Events` field to the `TxResponse` type that captures *all* events emitted by a transaction, unlike `Logs` which only contains events emitted during message execution. * (x/upgrade) [\#10532](https://github.com/cosmos/cosmos-sdk/pull/10532) Add `keeper.DumpUpgradeInfoWithInfoToDisk` to include `Plan.Info` in the upgrade-info file. * (store) [\#10544](https://github.com/cosmos/cosmos-sdk/pull/10544) Use the new IAVL iterator structure which significantly improves iterator performance. @@ -1288,7 +1290,7 @@ by the new key store: * `file`: use encrypted file-based store. * `kwallet`: use [KDE Wallet](https://utils.kde.org/projects/kwalletmanager/) service. * `pass`: use the [pass](https://www.passwordstore.org/) command line password manager. - * `test`: use password-less key store. _For testing purposes only. Use it at your own risk._ + * `test`: use password-less key store. *For testing purposes only. Use it at your own risk.* * (keys) [\#5097](https://github.com/cosmos/cosmos-sdk/pull/5097) New `keys migrate` command to assist users migrate their keys to the new keyring. * (keys) [\#5366](https://github.com/cosmos/cosmos-sdk/pull/5366) `keys list` now accepts a `--list-names` option to list key names only, whilst the `keys delete` @@ -2782,7 +2784,7 @@ BUG FIXES ## 0.25.0 -_October 24th, 2018_ +*October 24th, 2018* BREAKING CHANGES @@ -3029,7 +3031,7 @@ BUG FIXES ## 0.24.2 -_August 22nd, 2018_ +*August 22nd, 2018* BUG FIXES @@ -3038,7 +3040,7 @@ BUG FIXES ## 0.24.1 -_August 21st, 2018_ +*August 21st, 2018* BUG FIXES @@ -3047,7 +3049,7 @@ BUG FIXES ## 0.24.0 -_August 13th, 2018_ +*August 13th, 2018* BREAKING CHANGES @@ -3163,7 +3165,7 @@ BUG FIXES ## 0.23.1 -_July 27th, 2018_ +*July 27th, 2018* BUG FIXES @@ -3173,7 +3175,7 @@ BUG FIXES ## 0.23.0 -_July 25th, 2018_ +*July 25th, 2018* BREAKING CHANGES @@ -3196,7 +3198,7 @@ BUG FIXES ## 0.22.0 -_July 16th, 2018_ +*July 16th, 2018* BREAKING CHANGES @@ -3215,7 +3217,7 @@ BUG FIXES ## 0.21.1 -_July 14th, 2018_ +*July 14th, 2018* BUG FIXES @@ -3224,7 +3226,7 @@ BUG FIXES ## 0.21.0 -_July 13th, 2018_ +*July 13th, 2018* BREAKING CHANGES @@ -3255,7 +3257,7 @@ BUG FIXES ## 0.20.0 -_July 10th, 2018_ +*July 10th, 2018* BREAKING CHANGES @@ -3398,7 +3400,7 @@ BUG FIXES ## 0.19.0 -_June 13, 2018_ +*June 13, 2018* BREAKING CHANGES @@ -3438,7 +3440,7 @@ FEATURES ## 0.18.0 -_June 9, 2018_ +*June 9, 2018* BREAKING CHANGES @@ -3503,45 +3505,45 @@ BUG FIXES ## 0.17.5 -_June 5, 2018_ +*June 5, 2018* Update to Tendermint v0.19.9 (Fix evidence reactor, mempool deadlock, WAL panic, memory leak) ## 0.17.4 -_May 31, 2018_ +*May 31, 2018* Update to Tendermint v0.19.7 (WAL fixes and more) ## 0.17.3 -_May 29, 2018_ +*May 29, 2018* Update to Tendermint v0.19.6 (fix fast-sync halt) ## 0.17.5 -_June 5, 2018_ +*June 5, 2018* Update to Tendermint v0.19.9 (Fix evidence reactor, mempool deadlock, WAL panic, memory leak) ## 0.17.4 -_May 31, 2018_ +*May 31, 2018* Update to Tendermint v0.19.7 (WAL fixes and more) ## 0.17.3 -_May 29, 2018_ +*May 29, 2018* Update to Tendermint v0.19.6 (fix fast-sync halt) ## 0.17.2 -_May 20, 2018_ +*May 20, 2018* Update to Tendermint v0.19.5 (reduce WAL use, bound the mempool and some rpcs, improve logging) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9c3a549cb9de..82e020385414 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,7 +1,6 @@ # Cosmos SDK v0.45.9 Release Notes -This is a security release for the -[Dragonberry security advisory](https://forum.cosmos.network/t/ibc-security-advisory-dragonberry/7702). +This is a security release for the [Dragonberry security advisory](https://forum.cosmos.network/t/ibc-security-advisory-dragonberry/7702). Please upgrade ASAP. Next to this, we have also included a few minor bugfixes. @@ -9,7 +8,7 @@ Next to this, we have also included a few minor bugfixes. Chains must add the following to their go.mod for the application: ```go -replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23 +replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23 v0.8.0 ``` Bumping the SDK version should be smooth, however, feel free to tag core devs to review your upgrading PR: From 3c109f4ac5818c743545b99e4a34492624558a08 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Sun, 16 Oct 2022 00:09:46 +0200 Subject: [PATCH 2/8] add `GenSignedMockTx` --- CHANGELOG.md | 2 ++ simapp/helpers/test_helpers.go | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44f0531d43c6..9064b3902e67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +* [](https://github.com/cosmos/cosmos-sdk/pull/) - Add `GenSignedMockTx` (as it is in v0.46.0+). This can be used as workaround of the #12437 revertion. + ## v0.45.9 - 2022-10-14 ATTENTION: diff --git a/simapp/helpers/test_helpers.go b/simapp/helpers/test_helpers.go index 1eb496e57a71..f49e65a99985 100644 --- a/simapp/helpers/test_helpers.go +++ b/simapp/helpers/test_helpers.go @@ -19,11 +19,15 @@ const ( ) // GenTx generates a signed mock transaction. +// Deprecated - use GenSignedMockTx instead. func GenTx(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 r := rand.New(rand.NewSource(time.Now().UnixNano())) + return GenSignedMockTx(r, gen, msgs, feeAmt, gas, chainID, accNums, accSeqs, priv...) +} + +// GenSignedMockTx generates a signed mock transaction. +func GenSignedMockTx(r *rand.Rand, 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)) memo := simulation.RandStringOfLength(r, simulation.RandIntBetween(r, 0, 100)) From 686a5dd5bca44d7b648e390b8de0a4bd0a3ce9f3 Mon Sep 17 00:00:00 2001 From: Adu Date: Tue, 5 Jul 2022 03:18:30 +0800 Subject: [PATCH 3/8] fix: Simulation is not deterministic due to GenTx (backport #12374) (#12437) --- simapp/test_helpers.go | 3 +++ x/authz/simulation/operations.go | 7 +++++++ x/bank/simulation/operations.go | 10 ++++++++++ x/distribution/simulation/operations.go | 1 + x/genutil/gentx_test.go | 3 +++ x/gov/simulation/operations.go | 2 ++ x/simulation/util.go | 1 + x/slashing/simulation/operations.go | 1 + x/staking/simulation/operations.go | 2 ++ 9 files changed, 30 insertions(+) diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index 1e1bd249c116..ff641f2c689d 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -5,6 +5,7 @@ import ( "encoding/hex" "encoding/json" "fmt" + "math/rand" "strconv" "testing" "time" @@ -326,6 +327,7 @@ func SignCheckDeliver( chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error) { tx, err := helpers.GenTx( + rand.New(rand.NewSource(time.Now().UnixNano())), txCfg, msgs, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)}, @@ -376,6 +378,7 @@ func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, i var err error for i := 0; i < numToGenerate; i++ { txs[i], err = helpers.GenTx( + rand.New(rand.NewSource(time.Now().UnixNano())), txGen, msgs, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)}, diff --git a/x/authz/simulation/operations.go b/x/authz/simulation/operations.go index 3d57041fed61..44f92a8e87ad 100644 --- a/x/authz/simulation/operations.go +++ b/x/authz/simulation/operations.go @@ -117,6 +117,7 @@ func SimulateMsgGrant(ak authz.AccountKeeper, bk authz.BankKeeper, _ keeper.Keep } txCfg := simappparams.MakeTestEncodingConfig().TxConfig tx, err := helpers.GenTx( + r, txCfg, []sdk.Msg{msg}, fees, @@ -183,6 +184,7 @@ func SimulateMsgRevoke(ak authz.AccountKeeper, bk authz.BankKeeper, k keeper.Kee txCfg := simappparams.MakeTestEncodingConfig().TxConfig account := ak.GetAccount(ctx, granterAddr) tx, err := helpers.GenTx( + r, txCfg, []sdk.Msg{&msg}, fees, @@ -241,6 +243,10 @@ func SimulateMsgExec(ak authz.AccountKeeper, bk authz.BankKeeper, k keeper.Keepe granterspendableCoins := bk.SpendableCoins(ctx, granterAddr) coins := simtypes.RandSubsetCoins(r, granterspendableCoins) + // if coins slice is empty, we can not create valid banktype.MsgSend + if len(coins) == 0 { + return simtypes.NoOpMsg(authz.ModuleName, TypeMsgExec, "empty coins slice"), nil, nil + } // Check send_enabled status of each sent coin denom if err := bk.IsSendEnabledCoins(ctx, coins...); err != nil { return simtypes.NoOpMsg(authz.ModuleName, TypeMsgExec, err.Error()), nil, nil @@ -273,6 +279,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( + r, txCfg, []sdk.Msg{&msgExec}, fees, diff --git a/x/bank/simulation/operations.go b/x/bank/simulation/operations.go index aa12c0e0478a..b354fbfe9dfb 100644 --- a/x/bank/simulation/operations.go +++ b/x/bank/simulation/operations.go @@ -59,6 +59,10 @@ func SimulateMsgSend(ak types.AccountKeeper, bk keeper.Keeper) simtypes.Operatio accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { from, to, coins, skip := randomSendFields(r, ctx, accs, bk, ak) + // if coins slice is empty, we can not create valid types.MsgSend + if len(coins) == 0 { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgSend, "empty coins slice"), nil, nil + } // Check send_enabled status of each coin denom if err := bk.IsSendEnabledCoins(ctx, coins...); err != nil { @@ -93,6 +97,10 @@ func SimulateMsgSendToModuleAccount(ak types.AccountKeeper, bk keeper.Keeper, mo spendable := bk.SpendableCoins(ctx, from.Address) coins := simtypes.RandSubsetCoins(r, spendable) + // if coins slice is empty, we can not create valid types.MsgSend + if len(coins) == 0 { + return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgSend, "empty coins slice"), nil, nil + } // Check send_enabled status of each coin denom if err := bk.IsSendEnabledCoins(ctx, coins...); err != nil { @@ -137,6 +145,7 @@ func sendMsgSend( } txGen := simappparams.MakeTestEncodingConfig().TxConfig tx, err := helpers.GenTx( + r, txGen, []sdk.Msg{msg}, fees, @@ -350,6 +359,7 @@ func sendMsgMultiSend( txGen := simappparams.MakeTestEncodingConfig().TxConfig tx, err := helpers.GenTx( + r, txGen, []sdk.Msg{msg}, fees, diff --git a/x/distribution/simulation/operations.go b/x/distribution/simulation/operations.go index 89a667777f50..9d898d07f9c1 100644 --- a/x/distribution/simulation/operations.go +++ b/x/distribution/simulation/operations.go @@ -229,6 +229,7 @@ func SimulateMsgFundCommunityPool(ak types.AccountKeeper, bk types.BankKeeper, k msg := types.NewMsgFundCommunityPool(fundAmount, funder.Address) txCtx := simulation.OperationInput{ + R: r, App: app, TxGen: simappparams.MakeTestEncodingConfig().TxConfig, Cdc: nil, diff --git a/x/genutil/gentx_test.go b/x/genutil/gentx_test.go index a6e636f84f1c..bf0a6ff7c07f 100644 --- a/x/genutil/gentx_test.go +++ b/x/genutil/gentx_test.go @@ -3,7 +3,9 @@ package genutil_test import ( "encoding/json" "fmt" + "math/rand" "testing" + "time" "github.com/stretchr/testify/suite" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" @@ -233,6 +235,7 @@ func (suite *GenTxTestSuite) TestDeliverGenTxs() { msg := banktypes.NewMsgSend(addr1, addr2, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 1)}) tx, err := helpers.GenTx( + rand.New(rand.NewSource(time.Now().UnixNano())), suite.encodingConfig.TxConfig, []sdk.Msg{msg}, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 10)}, diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 25fc6d9b811a..d8aecd1e32fd 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -155,6 +155,7 @@ func SimulateMsgSubmitProposal( txGen := simappparams.MakeTestEncodingConfig().TxConfig tx, err := helpers.GenTx( + r, txGen, []sdk.Msg{msg}, fees, @@ -241,6 +242,7 @@ func SimulateMsgDeposit(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Ke } txCtx := simulation.OperationInput{ + R: r, App: app, TxGen: simappparams.MakeTestEncodingConfig().TxConfig, Cdc: nil, diff --git a/x/simulation/util.go b/x/simulation/util.go index beeb009d02b3..9ca1205411cf 100644 --- a/x/simulation/util.go +++ b/x/simulation/util.go @@ -101,6 +101,7 @@ func GenAndDeliverTxWithRandFees(txCtx OperationInput) (simtypes.OperationMsg, [ 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( + txCtx.R, txCtx.TxGen, []sdk.Msg{txCtx.Msg}, fees, diff --git a/x/slashing/simulation/operations.go b/x/slashing/simulation/operations.go index 788ae4f90eb0..a4bfd93d549a 100644 --- a/x/slashing/simulation/operations.go +++ b/x/slashing/simulation/operations.go @@ -88,6 +88,7 @@ func SimulateMsgUnjail(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Kee txGen := simappparams.MakeTestEncodingConfig().TxConfig tx, err := helpers.GenTx( + r, txGen, []sdk.Msg{msg}, fees, diff --git a/x/staking/simulation/operations.go b/x/staking/simulation/operations.go index 6bedbb5315b3..2a1c86d635c7 100644 --- a/x/staking/simulation/operations.go +++ b/x/staking/simulation/operations.go @@ -152,6 +152,7 @@ func SimulateMsgCreateValidator(ak types.AccountKeeper, bk types.BankKeeper, k k } txCtx := simulation.OperationInput{ + R: r, App: app, TxGen: simappparams.MakeTestEncodingConfig().TxConfig, Cdc: nil, @@ -276,6 +277,7 @@ func SimulateMsgDelegate(ak types.AccountKeeper, bk types.BankKeeper, k keeper.K msg := types.NewMsgDelegate(simAccount.Address, val.GetOperator(), bondAmt) txCtx := simulation.OperationInput{ + R: r, App: app, TxGen: simappparams.MakeTestEncodingConfig().TxConfig, Cdc: nil, From 71d9e4e3d4dcb8b3ecc7f750421776076602ccb1 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Sun, 16 Oct 2022 00:11:50 +0200 Subject: [PATCH 4/8] renaming --- simapp/test_helpers.go | 4 ++-- x/authz/simulation/operations.go | 6 +++--- x/bank/simulation/operations.go | 4 ++-- x/genutil/gentx_test.go | 2 +- x/gov/simulation/operations.go | 2 +- x/simulation/util.go | 2 +- x/slashing/simulation/operations.go | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index ff641f2c689d..c428fdb2e2bc 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -326,7 +326,7 @@ func SignCheckDeliver( t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg, chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error) { - tx, err := helpers.GenTx( + tx, err := helpers.GenSignedMockTx( rand.New(rand.NewSource(time.Now().UnixNano())), txCfg, msgs, @@ -377,7 +377,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( rand.New(rand.NewSource(time.Now().UnixNano())), txGen, msgs, diff --git a/x/authz/simulation/operations.go b/x/authz/simulation/operations.go index 44f92a8e87ad..2f06b48328e9 100644 --- a/x/authz/simulation/operations.go +++ b/x/authz/simulation/operations.go @@ -116,7 +116,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( r, txCfg, []sdk.Msg{msg}, @@ -183,7 +183,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( r, txCfg, []sdk.Msg{&msg}, @@ -278,7 +278,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( r, txCfg, []sdk.Msg{&msgExec}, diff --git a/x/bank/simulation/operations.go b/x/bank/simulation/operations.go index b354fbfe9dfb..e7eccf03f856 100644 --- a/x/bank/simulation/operations.go +++ b/x/bank/simulation/operations.go @@ -144,7 +144,7 @@ func sendMsgSend( } } txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := helpers.GenTx( + tx, err := helpers.GenSignedMockTx( r, txGen, []sdk.Msg{msg}, @@ -358,7 +358,7 @@ func sendMsgMultiSend( } txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := helpers.GenTx( + tx, err := helpers.GenSignedMockTx( r, txGen, []sdk.Msg{msg}, diff --git a/x/genutil/gentx_test.go b/x/genutil/gentx_test.go index bf0a6ff7c07f..1fc964afc36a 100644 --- a/x/genutil/gentx_test.go +++ b/x/genutil/gentx_test.go @@ -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( rand.New(rand.NewSource(time.Now().UnixNano())), suite.encodingConfig.TxConfig, []sdk.Msg{msg}, diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index d8aecd1e32fd..d25c9d5f3c71 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -154,7 +154,7 @@ func SimulateMsgSubmitProposal( } txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := helpers.GenTx( + tx, err := helpers.GenSignedMockTx( r, txGen, []sdk.Msg{msg}, diff --git a/x/simulation/util.go b/x/simulation/util.go index 9ca1205411cf..e2b31659b203 100644 --- a/x/simulation/util.go +++ b/x/simulation/util.go @@ -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.R, txCtx.TxGen, []sdk.Msg{txCtx.Msg}, diff --git a/x/slashing/simulation/operations.go b/x/slashing/simulation/operations.go index a4bfd93d549a..13ed2edd6987 100644 --- a/x/slashing/simulation/operations.go +++ b/x/slashing/simulation/operations.go @@ -87,7 +87,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( r, txGen, []sdk.Msg{msg}, From e15ec20accbfde6e9822839ed040003776007748 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Sun, 16 Oct 2022 00:15:46 +0200 Subject: [PATCH 5/8] changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9064b3902e67..72d6032a3a47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,9 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] -* [](https://github.com/cosmos/cosmos-sdk/pull/) - Add `GenSignedMockTx` (as it is in v0.46.0+). This can be used as workaround of the #12437 revertion. +### Features + +* [#13557](https://github.com/cosmos/cosmos-sdk/pull/#13557) - Add `GenSignedMockTx` as wrapper of `GenTx`. This can be used as workaround for #12437 revertion. `v0.46+` contains as well a `GenSignedMockTx` that behaves the same way. ## v0.45.9 - 2022-10-14 From 61ebc4be14100ae9040e401e1a081a4fecd4e865 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Sun, 16 Oct 2022 09:25:10 +0200 Subject: [PATCH 6/8] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72d6032a3a47..6ece1151afa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features -* [#13557](https://github.com/cosmos/cosmos-sdk/pull/#13557) - Add `GenSignedMockTx` as wrapper of `GenTx`. This can be used as workaround for #12437 revertion. `v0.46+` contains as well a `GenSignedMockTx` that behaves the same way. +* [#13557](https://github.com/cosmos/cosmos-sdk/pull/#13557) - Add `GenSignedMockTx`. This can be used as workaround for #12437 revertion. `v0.46+` contains as well a `GenSignedMockTx` that behaves the same way. ## v0.45.9 - 2022-10-14 From 6303b563771f4d855866db346cc2cb3c7b6370be Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Sun, 16 Oct 2022 09:49:18 +0200 Subject: [PATCH 7/8] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ece1151afa6..3e441e201c0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,7 @@ All users should upgrade immediately. Users *must* add a replace directive in their go.mod for thenew `ics23` package in the SDK: ```go -replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23 v0.8.0 +replace github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 ``` ### Features From 89b64b21549416feee1cf6634e3762172fe6b8b1 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Sun, 16 Oct 2022 11:11:02 +0200 Subject: [PATCH 8/8] Update simapp/helpers/test_helpers.go --- simapp/helpers/test_helpers.go | 1 - 1 file changed, 1 deletion(-) diff --git a/simapp/helpers/test_helpers.go b/simapp/helpers/test_helpers.go index f49e65a99985..adecafb7c8ab 100644 --- a/simapp/helpers/test_helpers.go +++ b/simapp/helpers/test_helpers.go @@ -19,7 +19,6 @@ const ( ) // GenTx generates a signed mock transaction. -// Deprecated - use GenSignedMockTx instead. func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error) { r := rand.New(rand.NewSource(time.Now().UnixNano())) return GenSignedMockTx(r, gen, msgs, feeAmt, gas, chainID, accNums, accSeqs, priv...)