Bump sdk v50#5
Conversation
| string denom = 1; | ||
| string amount = 2 [ | ||
| (cosmos_proto.scalar) = "cosmos.Int", | ||
| (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", |
There was a problem hiding this comment.
move to 50, we replace sdk.Int with math.Int
| string denom = 1; | ||
| string bond_weight = 2 [ | ||
| (cosmos_proto.scalar) = "cosmos.Dec", | ||
| (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", |
There was a problem hiding this comment.
sdk.Dec becomes math.LegacyDec
| auth.AppModuleBasic{}, | ||
| genutil.AppModuleBasic{}, | ||
| bank.AppModuleBasic{}, | ||
| capability.AppModuleBasic{}, |
There was a problem hiding this comment.
(cosmos/cosmos-sdk#15344) Capability module was removed
| legacyAmino *codec.LegacyAmino | ||
| appCodec codec.Codec | ||
| interfaceRegistry types.InterfaceRegistry | ||
| txConfig client.TxConfig |
There was a problem hiding this comment.
add txConfig and BasicModuleManager base to cosmos simapp
| ) | ||
| tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) | ||
| memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) | ||
| tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) |
There was a problem hiding this comment.
References to types/store.go which contained aliases for store types have been remapped to point to appropriate store/types
| app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( | ||
| appCodec, | ||
| keys[consensusparamtypes.StoreKey], | ||
| runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), |
There was a problem hiding this comment.
use the runtime.NewKVStoreService method to create a KVStoreService from a StoreKey
| logger, | ||
| ) | ||
|
|
||
| enabledSignModes := append(tx.DefaultSignModes, sigtypes.SignMode_SIGN_MODE_TEXTUAL) |
There was a problem hiding this comment.
must be added after setting the app's bank keeper when using (legacy) application wiring
|
|
||
| ) | ||
|
|
||
| app.BasicModuleManager = module.NewBasicManagerFromManager( |
|
|
||
| app.SetAnteHandler(anteHandler) | ||
| app.SetInitChainer(app.InitChainer) | ||
| app.SetPreBlocker(app.PreBlocker) |
There was a problem hiding this comment.
set a pre-blocker function for the app
| } | ||
|
|
||
| // BeginBlocker application updates every begin block | ||
| func (app *SimApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { |
There was a problem hiding this comment.
BeginBlock and EndBlock have changed their signature
| var genesisState GenesisState | ||
| if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { | ||
| if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { | ||
| panic(err) |
| func (app *SimApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { | ||
| clientCtx := apiSvr.ClientCtx | ||
| // Register new tx routes from grpc-gateway. | ||
| authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) |
| // application gRPC query router. | ||
| func (app *SimApp) RegisterNodeService(clientCtx client.Context) { | ||
| node.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) | ||
| func (app *SimApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) { |
There was a problem hiding this comment.
(cosmos/cosmos-sdk#15597) RegisterNodeService now requires a config parameter
| modulesToExport []string, | ||
| ) (servertypes.ExportedApp, error) { | ||
| // as if they could withdraw from the start of the next block | ||
| ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) |
There was a problem hiding this comment.
(cosmos/cosmos-sdk#16342) NewContext was renamed to NewContextLegacy
| app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) | ||
| } | ||
|
|
||
| genState := app.mm.ExportGenesis(ctx, app.appCodec) |
There was a problem hiding this comment.
ExportGenesis was changed to ExportGenesisForModules
| ctx = ctx.WithBlockHeight(0) | ||
|
|
||
| // reinitialize all validators | ||
| app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { |
| // number of bonded accounts | ||
| var initialStake, numInitiallyBonded int64 | ||
| appParams.GetOrGenerate( | ||
| cdc, sims.StakePerAccount, &initialStake, r, |
There was a problem hiding this comment.
(cosmos/cosmos-sdk#16062) GetOrGenerate no longer requires a codec argument
| ) | ||
|
|
||
| // Setup initializes a new SimApp. A Nop logger is set in SimApp. | ||
| func Setup(isCheckTx bool) *SimApp { |
There was a problem hiding this comment.
Remove isCheckTx as it is not being used
| panic(err) | ||
| } | ||
|
|
||
| // commit genesis changes |
There was a problem hiding this comment.
(Baseapp) BeginBlock and EndBlock are now internal to baseapp. For testing, user must call FinalizeBlock
| // the simulation tests. If `FlagEnabledValue` is false it skips the current test. | ||
| // Returns error on an invalid db intantiation or temp dir creation. | ||
| func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, log.Logger, bool, error) { | ||
| if !FlagEnabledValue { |
| } | ||
|
|
||
| // need a way to better name this func | ||
| func GetUnbondingHeightsAndUnbondedAmounts(ctx sdk.Context, unbondingDelegation stakingtypes.UnbondingDelegation) map[int64]math.Int { |
There was a problem hiding this comment.
cosmos/cosmos-sdk#16324) NewKeeper now takes a KVStoreService instead of a StoreKey, and methods in the Keeper now take a context.Context instead of a sdk.Context
| }, | ||
| ) | ||
|
|
||
| emptyApp.Commit() |
There was a problem hiding this comment.
finalizeBlock 2 apps to fix the test export
| editMsg := stakingtypes.NewMsgEditValidator(valAddr, stakingtypes.Description{ | ||
| newRate := math.LegacyMustNewDecFromStr("0.03") | ||
| newMinSelfDelegation := math.NewInt(300) | ||
| editMsg := stakingtypes.NewMsgEditValidator(valAddr.String(), stakingtypes.Description{ |
There was a problem hiding this comment.
(cosmos/cosmos-sdk#17098) NewMsgCreateValidator, NewValidator, NewMsgCancelUnbondingDelegation, NewMsgUndelegate, NewMsgBeginRedelegate, NewMsgDelegate and NewMsgEditValidator takes a string instead of sdk.ValAddress or sdk.AccAddress
| return sdkCtx.Logger().With("module", "x/"+types.ModuleName) | ||
| } | ||
|
|
||
| func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []stakingtypes.DVPair) { |
There was a problem hiding this comment.
cosmos/cosmos-sdk#16324) NewKeeper now takes a KVStoreService instead of a StoreKey, and methods in the Keeper now take a context.Context instead of a sdk.Context
| suite.Require().Equal(tc.expRate[0], lockRecord1.GetBondWeight()) | ||
| suite.Require().Equal(tc.expLock[0], lockRecord1.LockedCoin.Amount) | ||
|
|
||
| delegation1, found := suite.app.StakingKeeper.GetDelegation(suite.ctx, delAddr, valAddr1) |
There was a problem hiding this comment.
now returns an error instead of a found bool
| func (AppModule) ConsensusVersion() uint64 { return 2 } | ||
| func (AppModule) ConsensusVersion() uint64 { return 3 } | ||
|
|
||
| // IsAppModule implements the appmodule.AppModule interface. |
| ) | ||
|
|
||
| // Simulation parameter constants | ||
| const ( |
There was a problem hiding this comment.
create RandomizedGenState for module multi-staking
| if err := cfg.RegisterMigration(multistakingtypes.ModuleName, 1, m.Migrate1to2); err != nil { | ||
| panic(fmt.Sprintf("failed to migrate x/%s from version 1 to 2: %v", stakingtypes.ModuleName, err)) | ||
| } | ||
| if err := cfg.RegisterMigration(multistakingtypes.ModuleName, 2, m.Migrate2to3); err != nil { |
| func (am AppModule) IsAppModule() {} | ||
|
|
||
| // IsOnePerModuleType implements the depinject.OnePerModuleType interface. | ||
| func (am AppModule) IsOnePerModuleType() {} |
| legacyAmino := encodingConfig.Amino | ||
| interfaceRegistry := encodingConfig.InterfaceRegistry | ||
| legacyAmino := codec.NewLegacyAmino() | ||
| interfaceRegistry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ |
| invCheckPeriod: invCheckPeriod, | ||
| keys: keys, | ||
| tkeys: tkeys, | ||
| memKeys: memKeys, |
| genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome, genutiltypes.DefaultMessageValidator), | ||
| genutilcli.MigrateGenesisCmd(), | ||
| genutilcli.GenTxCmd(simapp.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome), | ||
| genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome, genutiltypes.DefaultMessageValidator, addresscodec.NewBech32Codec("cosmos")), |
There was a problem hiding this comment.
(cosmos/cosmos-sdk#15567) CollectGenTxsCmd & GenTxCmd takes a address.Codec to be able to decode addresses.
| LegacyAmino() *codec.LegacyAmino | ||
|
|
||
| // Application updates every begin block. | ||
| BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock |
There was a problem hiding this comment.
BeginBlock and EndBlock have changed their signature
| moduleAccount := authtypes.NewModuleAddress(types.ModuleName) | ||
| escrowBalances := k.bankKeeper.GetAllBalances(ctx, moduleAccount) | ||
|
|
||
| broken := !escrowBalances.IsEqual(totalLockCoinAmount) |
There was a problem hiding this comment.
(cosmos/cosmos-sdk#14739) Deprecate the method Coin.IsEqual in favour of Coin.Equal.
|
|
||
| app.BeginBlock(abci.RequestBeginBlock{Header: newHeader}) | ||
|
|
||
| suite.ctx = app.NewContext(false, newHeader) |
| gov.NewAppModuleBasic( | ||
| []govclient.ProposalHandler{ | ||
| paramsclient.ProposalHandler, | ||
| upgradeclient.LegacyProposalHandler, |
There was a problem hiding this comment.
(cosmos/cosmos-sdk#14880) use gov v1 proposals in upgrade cli
921f404 to
c19b60f
Compare
No description provided.