diff --git a/CHANGELOG.md b/CHANGELOG.md index ae3e33069829..76910ed54a1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,28 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +<<<<<<< HEAD * (cli) [\#9717](https://github.com/cosmos/cosmos-sdk/pull/9717) Added CLI flag `--output json/text` to `tx` cli commands. +======= +* [\#9628](https://github.com/cosmos/cosmos-sdk/pull/9628) Rename `x/{mod}/legacy` to `x/{mod}/migrations`. +* [\#9571](https://github.com/cosmos/cosmos-sdk/pull/9571) Implemented error handling for staking hooks, which now return an error on failure. +* [\#9427](https://github.com/cosmos/cosmos-sdk/pull/9427) Move simapp `FundAccount` and `FundModuleAccount` to `x/bank/testutil` +* (client/tx) [\#9421](https://github.com/cosmos/cosmos-sdk/pull/9421/) `BuildUnsignedTx`, `BuildSimTx`, `PrintUnsignedStdTx` functions are moved to + the Tx Factory as methods. +* (client/keys) [\#9407](https://github.com/cosmos/cosmos-sdk/pull/9601) Added `keys rename` CLI command and `Keyring.Rename` interface method to rename a key in the keyring. +* (x/slashing) [\#9458](https://github.com/cosmos/cosmos-sdk/pull/9458) Coins burned from slashing is now returned from Slash function and included in Slash event. +* [\#9246](https://github.com/cosmos/cosmos-sdk/pull/9246) The `New` method for the network package now returns an error. +* [\#9519](https://github.com/cosmos/cosmos-sdk/pull/9519) `DeleteDeposits` renamed to `DeleteAndBurnDeposits`, `RefundDeposits` renamed to `RefundAndDeleteDeposits` +* (codec) [\#9521](https://github.com/cosmos/cosmos-sdk/pull/9521) Removed deprecated `clientCtx.JSONCodec` from `client.Context`. +* (codec) [\#9521](https://github.com/cosmos/cosmos-sdk/pull/9521) Rename `EncodingConfig.Marshaler` to `Codec`. +* [\#9418](https://github.com/cosmos/cosmos-sdk/pull/9418) `sdk.Msg`'s `GetSigners()` method updated to return `[]string`. +* [\#9594](https://github.com/cosmos/cosmos-sdk/pull/9594) `RESTHandlerFn` argument is removed from the `gov/NewProposalHandler`. +* [\#9594](https://github.com/cosmos/cosmos-sdk/pull/9594) `types/rest` package moved to `testutil/rest`. +* [\#9432](https://github.com/cosmos/cosmos-sdk/pull/9432) `ConsensusParamsKeyTable` moved from `params/keeper` to `params/types` +* [\#9576](https://github.com/cosmos/cosmos-sdk/pull/9576) Add debug error message to `sdkerrors.QueryResult` when enabled +* [\#9650](https://github.com/cosmos/cosmos-sdk/pull/9650) Removed deprecated message handler implementation from the SDK modules. +* (x/capability) [\#9836](https://github.com/cosmos/cosmos-sdk/pull/9836) Removed `InitializeAndSeal(ctx sdk.Context)` and replaced with `Seal()`. App must add x/capability to begin blockers which will assure that the x/capability keeper is properly initialized. The x/capability begin blocker must be run before any other module which uses x/capability. +>>>>>>> bdf5aee7a (style(capability)!: update go doc comments and remove BeginBlocker (#9845)) ### Bug Fixes diff --git a/x/capability/keeper/keeper.go b/x/capability/keeper/keeper.go index ead46dd1f4f9..604c59086724 100644 --- a/x/capability/keeper/keeper.go +++ b/x/capability/keeper/keeper.go @@ -106,6 +106,18 @@ func (k *Keeper) InitializeAndSeal(ctx sdk.Context) { panic("cannot initialize and seal an already sealed capability keeper") } +<<<<<<< HEAD +======= + k.sealed = true +} + +// InitMemStore will assure that the module store is a memory store (it will panic if it's not) +// and willl initialize it. The function is safe to be called multiple times. +// InitMemStore must be called every time the app starts before the keeper is used (so +// `BeginBlock` or `InitChain` - whichever is first). We need access to the store so we +// can't initialize it in a constructor. +func (k *Keeper) InitMemStore(ctx sdk.Context) { +>>>>>>> bdf5aee7a (style(capability)!: update go doc comments and remove BeginBlocker (#9845)) memStore := ctx.KVStore(k.memKey) memStoreType := memStore.GetStoreType() @@ -128,7 +140,14 @@ func (k *Keeper) InitializeAndSeal(ctx sdk.Context) { k.InitializeCapability(ctx, index, capOwners) } +<<<<<<< HEAD k.sealed = true +======= +// IsInitialized returns true if the keeper is properly initialized, and false otherwise. +func (k *Keeper) IsInitialized(ctx sdk.Context) bool { + memStore := ctx.KVStore(k.memKey) + return memStore.Get(types.KeyMemInitialized) != nil +>>>>>>> bdf5aee7a (style(capability)!: update go doc comments and remove BeginBlocker (#9845)) } // InitializeIndex sets the index to one (or greater) in InitChain according diff --git a/x/capability/module.go b/x/capability/module.go index d43d37761aa0..bbe0c93ae5e8 100644 --- a/x/capability/module.go +++ b/x/capability/module.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "math/rand" + "time" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -14,6 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -140,7 +142,17 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +<<<<<<< HEAD func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +======= +// BeginBlocker calls InitMemStore to assert that the memory store is initialized. +// It's safe to run multiple times. +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) + + am.keeper.InitMemStore(ctx) +} +>>>>>>> bdf5aee7a (style(capability)!: update go doc comments and remove BeginBlocker (#9845)) // EndBlock executes all ABCI EndBlock logic respective to the capability module. It // returns no validator updates.