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

chore: upgrade v0.45.8 #133

Merged
merged 23 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3fc6728
fix: update x/mint parameter validation (backport #12384) (#12396)
mergify[bot] Jun 30, 2022
f90ddb3
chore: optimize get last completed upgrade (#12268)
robert-zaremba Jul 3, 2022
5712b41
fix: Simulation is not deterministic due to GenTx (backport #12374) (…
adu-web3 Jul 4, 2022
cf6fd4c
fix: use go install instead of go get in makefile (#12435)
julienrbrt Jul 4, 2022
315eaad
chore: fumpt sdk v45 series #12442
faddat Jul 5, 2022
e47a477
feat: Move AppModule.BeginBlock and AppModule.EndBlock to extension i…
mergify[bot] Jul 19, 2022
2144168
feat: add message index event attribute to authz message execution (b…
mergify[bot] Jul 22, 2022
ede5b72
chore(store): upgrade iavl to v0.19.0 (backport #12626) (#12697)
mergify[bot] Jul 23, 2022
3321e79
feat: Add `GetParamSetIfExists` to prevent panic on breaking param ch…
fedekunze Jul 26, 2022
7a92958
feat: Add convenience method for constructing key to access account's…
mergify[bot] Aug 2, 2022
96545d6
chore: bump tm in 0.45.x (#12784)
tac0turtle Aug 4, 2022
9eed4ed
chore: 0.45.7 changelog prep (#12821)
tac0turtle Aug 4, 2022
1af28df
docs(staking): typo in staking/state (backport #12834) (#12836)
mergify[bot] Aug 7, 2022
181c9f4
chore: fee payer event (backport #12850) (#12856)
mergify[bot] Aug 8, 2022
a7a3a02
chore: changelog update (backport #12859) (#12862)
mergify[bot] Aug 8, 2022
ca7cdc5
fix: Use fixed length hex for pointer at FwdCapabilityKey (backport #…
yihuang Aug 9, 2022
9a4d83c
feat: deterministic map iteration (backport #12781) (#12944)
mergify[bot] Aug 18, 2022
d2ba3c4
chore: bump tendermint to `0.34.21` and iavl to `0.19.1` (#12970)
julienrbrt Aug 19, 2022
ea4d9ed
perf: Amortize clearing unsorted cache entries (Juno genesis fix) (ba…
mergify[bot] Aug 19, 2022
3a792c0
fix: proper error when parsing telemetry configuration (backport #129…
mergify[bot] Aug 23, 2022
04ed5bb
ci: fix release notes not populated by goreleaser (#13019)
mergify[bot] Aug 24, 2022
4a98828
fix: missing return statement in BaseApp.Query (backport #13046) (#13…
mergify[bot] Aug 25, 2022
3fc8a80
chore: v0.45.8 release changelog (#13053)
julienrbrt Aug 25, 2022
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
Prev Previous commit
Next Next commit
fix: Simulation is not deterministic due to GenTx (backport #12374) (…
…#12437)
  • Loading branch information
adu-web3 authored and MissingNO57 committed Sep 16, 2022
commit 5712b41c221c34d59f73a1c8eb1df4f504ac08e4
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
### 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`.

## [v0.45.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.6) - 2022-06-28

Expand Down
5 changes: 1 addition & 4 deletions simapp/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package helpers

import (
"math/rand"
"time"

"github.com/cosmos/cosmos-sdk/client"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
Expand All @@ -19,12 +18,10 @@ const (
)

// 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) {
func GenTx(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))

// create a random length memo
r := rand.New(rand.NewSource(time.Now().UnixNano()))

memo := simulation.RandStringOfLength(r, simulation.RandIntBetween(r, 0, 100))

signMode := gen.SignModeHandler().DefaultMode()
Expand Down
3 changes: 3 additions & 0 deletions simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"math/rand"
"strconv"
"testing"
"time"
Expand Down Expand Up @@ -327,6 +328,7 @@ func SignCheckDeliver(
) (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)},
Expand Down Expand Up @@ -377,6 +379,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)},
Expand Down
7 changes: 7 additions & 0 deletions x/authz/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,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,
Expand Down Expand Up @@ -181,6 +182,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,
Expand Down Expand Up @@ -239,6 +241,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
Expand Down Expand Up @@ -271,6 +277,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,
Expand Down
10 changes: 10 additions & 0 deletions x/bank/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,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 {
Expand Down Expand Up @@ -94,6 +98,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 {
Expand Down Expand Up @@ -139,6 +147,7 @@ func sendMsgSend(
}
txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
r,
txGen,
[]sdk.Msg{msg},
fees,
Expand Down Expand Up @@ -355,6 +364,7 @@ func sendMsgMultiSend(

txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
r,
txGen,
[]sdk.Msg{msg},
fees,
Expand Down
1 change: 1 addition & 0 deletions x/distribution/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,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,
Expand Down
3 changes: 3 additions & 0 deletions x/genutil/gentx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -234,6 +236,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)},
Expand Down
2 changes: 2 additions & 0 deletions x/gov/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func SimulateMsgSubmitProposal(

txGen := simappparams.MakeTestEncodingConfig().TxConfig
tx, err := helpers.GenTx(
r,
txGen,
[]sdk.Msg{msg},
fees,
Expand Down Expand Up @@ -242,6 +243,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,
Expand Down
1 change: 1 addition & 0 deletions x/simulation/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions x/slashing/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,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,
Expand Down
2 changes: 2 additions & 0 deletions x/staking/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down