diff --git a/CHANGELOG.md b/CHANGELOG.md index bbadf4a2756..987aff34855 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* [#14529](https://github.com/cosmos/cosmos-sdk/pull/14529) Add new property `BondDenom` to `SimulationState` struct. * (x/group, x/gov) [#14483](https://github.com/cosmos/cosmos-sdk/pull/14483) Add support for `[]string` and `[]int` in `draft-proposal` prompt. * (protobuf) [#14476](https://github.com/cosmos/cosmos-sdk/pull/14476) Clean up protobuf annotations `{accepts,implements}_interface`. * (module) [#14415](https://github.com/cosmos/cosmos-sdk/pull/14415) Loosen assertions in SetOrderBeginBlockers() and SetOrderEndBlockers() @@ -116,10 +117,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#13881](https://github.com/cosmos/cosmos-sdk/pull/13881) Optimize iteration on nested cached KV stores and other operations in general. * (x/gov) [#14347](https://github.com/cosmos/cosmos-sdk/pull/14347) Support `v1.Proposal` message in `v1beta1.Proposal.Content`. * (x/gov) [#14390](https://github.com/cosmos/cosmos-sdk/pull/14390) Add title, proposer and summary to proposal struct -* (baseapp) [#14417](https://github.com/cosmos/cosmos-sdk/pull/14417) `SetStreamingService` accepts appOptions, AppCodec and Storekeys needed to set streamers. - * Store pacakge no longer has a dependency on baseapp. -* (store) [#14438](https://github.com/cosmos/cosmos-sdk/pull/14438) Pass logger from baseapp to store. -* (store) [#14439](https://github.com/cosmos/cosmos-sdk/pull/14439) Remove global metric gatherer from store. +* (baseapp) [#14417](https://github.com/cosmos/cosmos-sdk/pull/14417) `SetStreamingService` accepts appOptions, AppCodec and Storekeys needed to set streamers. + * Store pacakge no longer has a dependency on baseapp. +* (store) [#14438](https://github.com/cosmos/cosmos-sdk/pull/14438) Pass logger from baseapp to store. +* (store) [#14439](https://github.com/cosmos/cosmos-sdk/pull/14439) Remove global metric gatherer from store. * By default store has a no op metric gatherer, the application developer must set another metric gatherer or us the provided one in `store/metrics`. ### State Machine Breaking @@ -199,13 +200,13 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (types) [#13430](https://github.com/cosmos/cosmos-sdk/pull/13430) Remove unused code `ResponseCheckTx` and `ResponseDeliverTx` * (store) [#13529](https://github.com/cosmos/cosmos-sdk/pull/13529) Add method `LatestVersion` to `MultiStore` interface, add method `SetQueryMultiStore` to baesapp to support alternative `MultiStore` implementation for query service. * (pruning) [#13609](https://github.com/cosmos/cosmos-sdk/pull/13609) Move pruning package to be under store package -* [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) Most methods on `types/module.AppModule` have been moved to -extension interfaces. `module.Manager.Modules` is now of type `map[string]interface{}` to support in parallel the new +* [#13794](https://github.com/cosmos/cosmos-sdk/pull/13794) Most methods on `types/module.AppModule` have been moved to +extension interfaces. `module.Manager.Modules` is now of type `map[string]interface{}` to support in parallel the new `cosmossdk.io/core/appmodule.AppModule` API. * (signing) [#13701](https://github.com/cosmos/cosmos-sdk/pull/) Add `context.Context` as an argument `x/auth/signing.VerifySignature`. * (x/group) [#13876](https://github.com/cosmos/cosmos-sdk/pull/13876) Add `GetMinExecutionPeriod` method on DecisionPolicy interface. * (x/auth)[#13780](https://github.com/cosmos/cosmos-sdk/pull/13780) Querying with `id` (type of int64) in `AccountAddressByID` grpc query now throws error, use account-id(type of uint64) instead. -* (snapshots) [14048](https://github.com/cosmos/cosmos-sdk/pull/14048) Move the Snapshot package to the store package. This is done in an effort group all storage related logic under one package. +* (snapshots) [14048](https://github.com/cosmos/cosmos-sdk/pull/14048) Move the Snapshot package to the store package. This is done in an effort group all storage related logic under one package. * (baseapp) [#14050](https://github.com/cosmos/cosmos-sdk/pull/14050) refactor `ABCIListener` interface to accept go contexts ### CLI Breaking Changes @@ -220,7 +221,7 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf * (server) [#14441](https://github.com/cosmos/cosmos-sdk/pull/14441) Fix `--log_format` flag not working. * (x/upgrade) [#13936](https://github.com/cosmos/cosmos-sdk/pull/13936) Make downgrade verification work again * (x/group) [#13742](https://github.com/cosmos/cosmos-sdk/pull/13742) Fix `validate-genesis` when group policy accounts exist. -* (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` when pubkey is set on a `BaseAccount`. +* (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` when pubkey is set on a `BaseAccount`. * (rosetta) [#13583](https://github.com/cosmos/cosmos-sdk/pull/13583) Misc fixes for cosmos-rosetta. * (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) Fix evidence query API to decode the hash properly. * (bank) [#13691](https://github.com/cosmos/cosmos-sdk/issues/13691) Fix unhandled error for vesting account transfers, when total vesting amount exceeds total balance. @@ -260,7 +261,7 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf * (deps) Bump Tendermint version to [v0.34.24](https://github.com/tendermint/tendermint/releases/tag/v0.34.24). * [#13651](https://github.com/cosmos/cosmos-sdk/pull/13651) Update `server/config/config.GetConfig` function. -* [#14175](https://github.com/cosmos/cosmos-sdk/pull/14175) Add `server.DefaultBaseappOptions(appopts)` function to reduce boiler plate in root.go. +* [#14175](https://github.com/cosmos/cosmos-sdk/pull/14175) Add `server.DefaultBaseappOptions(appopts)` function to reduce boiler plate in root.go. ### State Machine Breaking diff --git a/simapp/state.go b/simapp/state.go index 51fd1d007fc..e4b300dd204 100644 --- a/simapp/state.go +++ b/simapp/state.go @@ -183,6 +183,7 @@ func AppStateRandomizedFn( Accounts: accs, InitialStake: initialStake, NumBonded: numInitiallyBonded, + BondDenom: sdk.DefaultBondDenom, GenTimestamp: genesisTimestamp, } diff --git a/testutil/sims/simulation_helpers.go b/testutil/sims/simulation_helpers.go index 570eb483bd5..65c7eeec312 100644 --- a/testutil/sims/simulation_helpers.go +++ b/testutil/sims/simulation_helpers.go @@ -49,6 +49,7 @@ func SimulationOperations(app runtime.AppI, cdc codec.JSONCodec, config simtypes simState := module.SimulationState{ AppParams: make(simtypes.AppParams), Cdc: cdc, + BondDenom: sdk.DefaultBondDenom, } if config.ParamsFile != "" { diff --git a/types/module/simulation.go b/types/module/simulation.go index e7acb7e0cd8..a8d69af129b 100644 --- a/types/module/simulation.go +++ b/types/module/simulation.go @@ -124,6 +124,7 @@ type SimulationState struct { Accounts []simulation.Account // simulation accounts InitialStake sdkmath.Int // initial coins per account NumBonded int64 // number of initially bonded accounts + BondDenom string // denom to be used as default GenTimestamp time.Time // genesis timestamp UnbondTime time.Duration // staking unbond time stored to use it as the slashing maximum evidence duration ParamChanges []simulation.ParamChange // simulated parameter changes from modules diff --git a/x/auth/simulation/genesis.go b/x/auth/simulation/genesis.go index 4b31bf7d49e..550064c07bd 100644 --- a/x/auth/simulation/genesis.go +++ b/x/auth/simulation/genesis.go @@ -35,7 +35,7 @@ func RandomGenesisAccounts(simState *module.SimulationState) types.GenesisAccoun continue } - initialVesting := sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, simState.Rand.Int63n(simState.InitialStake.Int64()))) + initialVesting := sdk.NewCoins(sdk.NewInt64Coin(simState.BondDenom, simState.Rand.Int63n(simState.InitialStake.Int64()))) var endTime int64 startTime := simState.GenTimestamp.Unix() diff --git a/x/bank/simulation/genesis.go b/x/bank/simulation/genesis.go index 8547b918469..11e65457a82 100644 --- a/x/bank/simulation/genesis.go +++ b/x/bank/simulation/genesis.go @@ -17,13 +17,13 @@ func RandomGenesisDefaultSendEnabledParam(r *rand.Rand) bool { } // RandomGenesisSendEnabled creates randomized values for the SendEnabled slice. -func RandomGenesisSendEnabled(r *rand.Rand) []types.SendEnabled { +func RandomGenesisSendEnabled(r *rand.Rand, bondDenom string) []types.SendEnabled { rv := make([]types.SendEnabled, 0, 2) // 60% of the time, add a denom specific record. if r.Int63n(100) < 60 { // 75% of the those times, set send enabled to true. bondEnabled := r.Int63n(100) < 75 - rv = append(rv, types.SendEnabled{Denom: sdk.DefaultBondDenom, Enabled: bondEnabled}) + rv = append(rv, types.SendEnabled{Denom: bondDenom, Enabled: bondEnabled}) } // Probabilities: // P(a) = 60.0% = There's SendEnable entry for the bond denom = .600 @@ -53,14 +53,14 @@ func RandomGenesisSendEnabled(r *rand.Rand) []types.SendEnabled { } // RandomGenesisBalances returns a slice of account balances. Each account has -// a balance of simState.InitialStake for sdk.DefaultBondDenom. +// a balance of simState.InitialStake for simState.BondDenom. func RandomGenesisBalances(simState *module.SimulationState) []types.Balance { genesisBalances := []types.Balance{} for _, acc := range simState.Accounts { genesisBalances = append(genesisBalances, types.Balance{ Address: acc.Address.String(), - Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, simState.InitialStake)), + Coins: sdk.NewCoins(sdk.NewCoin(simState.BondDenom, simState.InitialStake)), }) } @@ -75,11 +75,11 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { defaultSendEnabledParam = RandomGenesisDefaultSendEnabledParam(r) }, ) - sendEnabled := RandomGenesisSendEnabled(simState.Rand) + sendEnabled := RandomGenesisSendEnabled(simState.Rand, simState.BondDenom) numAccs := int64(len(simState.Accounts)) totalSupply := simState.InitialStake.Mul(sdk.NewInt((numAccs + simState.NumBonded))) - supply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, totalSupply)) + supply := sdk.NewCoins(sdk.NewCoin(simState.BondDenom, totalSupply)) bankGenesis := types.GenesisState{ Params: types.NewParams(defaultSendEnabledParam), diff --git a/x/bank/simulation/genesis_test.go b/x/bank/simulation/genesis_test.go index 55d19f80497..76be7256f84 100644 --- a/x/bank/simulation/genesis_test.go +++ b/x/bank/simulation/genesis_test.go @@ -11,6 +11,7 @@ import ( sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/bank/simulation" @@ -30,6 +31,7 @@ func TestRandomizedGenState(t *testing.T) { Cdc: cdc, Rand: r, NumBonded: 3, + BondDenom: sdk.DefaultBondDenom, Accounts: simtypes.RandomAccounts(r, 3), InitialStake: sdkmath.NewInt(1000), GenState: make(map[string]json.RawMessage), diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 1be0651f50b..5d276b1cade 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -32,8 +32,8 @@ func GenDepositParamsDepositPeriod(r *rand.Rand) time.Duration { } // GenDepositParamsMinDeposit returns randomized DepositParamsMinDeposit -func GenDepositParamsMinDeposit(r *rand.Rand) sdk.Coins { - return sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, int64(simulation.RandIntBetween(r, 1, 1e3)))) +func GenDepositParamsMinDeposit(r *rand.Rand, bondDenom string) sdk.Coins { + return sdk.NewCoins(sdk.NewInt64Coin(bondDenom, int64(simulation.RandIntBetween(r, 1, 1e3)))) } // GenDepositMinInitialRatio returns randomized DepositMinInitialRatio @@ -68,7 +68,7 @@ func RandomizedGenState(simState *module.SimulationState) { var minDeposit sdk.Coins simState.AppParams.GetOrGenerate( simState.Cdc, DepositParamsMinDeposit, &minDeposit, simState.Rand, - func(r *rand.Rand) { minDeposit = GenDepositParamsMinDeposit(r) }, + func(r *rand.Rand) { minDeposit = GenDepositParamsMinDeposit(r, simState.BondDenom) }, ) var depositPeriod time.Duration diff --git a/x/gov/simulation/genesis_test.go b/x/gov/simulation/genesis_test.go index f7bd89cbb69..70a74742bbd 100644 --- a/x/gov/simulation/genesis_test.go +++ b/x/gov/simulation/genesis_test.go @@ -10,6 +10,7 @@ import ( sdkmath "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/gov/simulation" @@ -31,6 +32,7 @@ func TestRandomizedGenState(t *testing.T) { Cdc: cdc, Rand: r, NumBonded: 3, + BondDenom: sdk.DefaultBondDenom, Accounts: simtypes.RandomAccounts(r, 3), InitialStake: sdkmath.NewInt(1000), GenState: make(map[string]json.RawMessage), diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index f0965c05be8..5de00c5c89f 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -79,7 +79,7 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { goalBonded = GenGoalBonded(r) }, ) - mintDenom := sdk.DefaultBondDenom + mintDenom := simState.BondDenom blocksPerYear := uint64(60 * 60 * 8766 / 5) params := types.NewParams(mintDenom, inflationRateChange, inflationMax, inflationMin, goalBonded, blocksPerYear) diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index 8f1d270c4fc..c1bd6141ade 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -30,6 +30,7 @@ func TestRandomizedGenState(t *testing.T) { Cdc: encCfg.Codec, Rand: r, NumBonded: 3, + BondDenom: sdk.DefaultBondDenom, Accounts: simtypes.RandomAccounts(r, 3), InitialStake: math.NewInt(1000), GenState: make(map[string]json.RawMessage), diff --git a/x/staking/simulation/genesis.go b/x/staking/simulation/genesis.go index 74fb20e2c70..c23cbb1135d 100644 --- a/x/staking/simulation/genesis.go +++ b/x/staking/simulation/genesis.go @@ -62,7 +62,7 @@ func RandomizedGenState(simState *module.SimulationState) { // NOTE: the slashing module need to be defined after the staking module on the // NewSimulationManager constructor for this to work simState.UnbondTime = unbondTime - params := types.NewParams(simState.UnbondTime, maxVals, 7, histEntries, sdk.DefaultBondDenom, minCommissionRate) + params := types.NewParams(simState.UnbondTime, maxVals, 7, histEntries, simState.BondDenom, minCommissionRate) // validators & delegations var ( diff --git a/x/staking/simulation/genesis_test.go b/x/staking/simulation/genesis_test.go index dd60652a87b..c0c8835a78e 100644 --- a/x/staking/simulation/genesis_test.go +++ b/x/staking/simulation/genesis_test.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/staking/simulation" @@ -32,6 +33,7 @@ func TestRandomizedGenState(t *testing.T) { Cdc: cdc, Rand: r, NumBonded: 3, + BondDenom: sdk.DefaultBondDenom, Accounts: simtypes.RandomAccounts(r, 3), InitialStake: sdkmath.NewInt(1000), GenState: make(map[string]json.RawMessage),