From ead3eb0b9fb8fec8386da9321a4405f8e4a84f44 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Thu, 1 Sep 2022 17:29:28 -0400 Subject: [PATCH 1/6] feat: emit cached context events (#13063) (cherry picked from commit 9948fb6c7c93e15d3bd1b43c1437e17e03d1ad14) # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 44 ++++++++++++++++++++++++++++++++++++ types/context.go | 11 +++++++-- types/context_test.go | 5 ++++ x/gov/abci.go | 6 ----- x/group/keeper/msg_server.go | 8 +------ 5 files changed, 59 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e2b0ba368f8..0447f6d7701b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,16 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +<<<<<<< HEAD * (x/auth) [#13612](https://github.com/cosmos/cosmos-sdk/pull/13612) Add `Query/ModuleAccountByName` endpoint for accessing the module account info by module name. +======= +* (x/authz) [#12648](https://github.com/cosmos/cosmos-sdk/pull/12648) Add an allow list, an optional list of addresses allowed to receive bank assets via authz MsgSend grant. +* (sdk.Coins) [#12627](https://github.com/cosmos/cosmos-sdk/pull/12627) Make a Denoms method on sdk.Coins. +* (testutil) [#12973](https://github.com/cosmos/cosmos-sdk/pull/12973) Add generic `testutil.RandSliceElem` function which selects a random element from the list. +* (client) [#12936](https://github.com/cosmos/cosmos-sdk/pull/12936) Add capability to preprocess transactions before broadcasting from a higher level chain. +* (x/authz) [#13047](https://github.com/cosmos/cosmos-sdk/pull/13047) Add a GetAuthorization function to the keeper. +* (cli) [#12742](https://github.com/cosmos/cosmos-sdk/pull/12742) Add the `prune` CLI cmd to manually prune app store history versions based on the pruning options. +>>>>>>> 9948fb6c7 (feat: emit cached context events (#13063)) ### Improvements @@ -54,7 +63,42 @@ Ref: https://keepachangelog.com/en/1.0.0/ ATTENTION: +<<<<<<< HEAD This is a security release for the [Dragonberry security advisory](https://forum.cosmos.network/t/ibc-security-advisory-dragonberry/7702). +======= +* (context) [#13063](https://github.com/cosmos/cosmos-sdk/pull/13063) Update `Context#CacheContext` to automatically emit all events on the parent context's `EventManager`. +* (x/bank) [#12706](https://github.com/cosmos/cosmos-sdk/pull/12706) Removed the `testutil` package from the `x/bank/client` package. +* (simapp) [#12747](https://github.com/cosmos/cosmos-sdk/pull/12747) Remove `simapp.MakeTestEncodingConfig`. Please use `moduletestutil.MakeTestEncodingConfig` (`types/module/testutil`) in tests instead. +* (x/bank) [#12648](https://github.com/cosmos/cosmos-sdk/pull/12648) `NewSendAuthorization` takes a new argument of an optional list of addresses allowed to receive bank assests via authz MsgSend grant. You can pass `nil` for the same behavior as before, i.e. any recipient is allowed. +* (x/bank) [#12593](https://github.com/cosmos/cosmos-sdk/pull/12593) Add `SpendableCoin` method to `BaseViewKeeper` +* (x/slashing) [#12581](https://github.com/cosmos/cosmos-sdk/pull/12581) Remove `x/slashing` legacy querier. +* (types) [#12355](https://github.com/cosmos/cosmos-sdk/pull/12355) Remove the compile-time `types.DBbackend` variable. Removes usage of the same in server/util.go +* (x/gov) [#12368](https://github.com/cosmos/cosmos-sdk/pull/12369) Gov keeper is now passed by reference instead of copy to make post-construction mutation of Hooks and Proposal Handlers possible at a framework level. +* (simapp) [#12270](https://github.com/cosmos/cosmos-sdk/pull/12270) Remove `invCheckPeriod uint` attribute from `SimApp` struct as per migration of `x/crisis` to app wiring +* (simapp) [#12334](https://github.com/cosmos/cosmos-sdk/pull/12334) Move `simapp.ConvertAddrsToValAddrs` and `simapp.CreateTestPubKeys ` to respectively `simtestutil.ConvertAddrsToValAddrs` and `simtestutil.CreateTestPubKeys` (`testutil/sims`) +* (simapp) [#12312](https://github.com/cosmos/cosmos-sdk/pull/12312) Move `simapp.EmptyAppOptions` to `simtestutil.EmptyAppOptions` (`testutil/sims`) +* (simapp) [#12312](https://github.com/cosmos/cosmos-sdk/pull/12312) Remove `skipUpgradeHeights map[int64]bool` and `homePath string` from `NewSimApp` constructor as per migration of `x/upgrade` to app-wiring. +* (testutil) [#12278](https://github.com/cosmos/cosmos-sdk/pull/12278) Move all functions from `simapp/helpers` to `testutil/sims` +* (testutil) [#12233](https://github.com/cosmos/cosmos-sdk/pull/12233) Move `simapp.TestAddr` to `simtestutil.TestAddr` (`testutil/sims`) +* (x/staking) [#12102](https://github.com/cosmos/cosmos-sdk/pull/12102) Staking keeper now is passed by reference instead of copy. Keeper's SetHooks no longer returns keeper. It updates the keeper in place instead. +* (linting) [#12141](https://github.com/cosmos/cosmos-sdk/pull/12141) Fix usability related linting for database. This means removing the infix Prefix from `prefix.NewPrefixWriter` and such so that it is `prefix.NewWriter` and making `db.DBConnection` and such into `db.Connection` +* (x/distribution) [#12434](https://github.com/cosmos/cosmos-sdk/pull/12434) `x/distribution` module `SetParams` keeper method definition is now updated to return `error`. +* (x/staking) [#12409](https://github.com/cosmos/cosmos-sdk/pull/12409) `x/staking` module `SetParams` keeper method definition is now updated to return `error`. +* (x/crisis) [#12445](https://github.com/cosmos/cosmos-sdk/pull/12445) `x/crisis` module `SetConstantFee` keeper method definition is now updated to return `error`. +* (x/gov) [#12631](https://github.com/cosmos/cosmos-sdk/pull/12631) `x/gov` module refactored to use `Params` as single struct instead of `DepositParams`, `TallyParams` & `VotingParams`. +* (x/gov) [#12631](https://github.com/cosmos/cosmos-sdk/pull/12631) Migrate `x/gov` to self-managed parameters and deprecate it's usage of `x/params`. +* (x/bank) [#12630](https://github.com/cosmos/cosmos-sdk/pull/12630) `x/bank` module `SetParams` keeper method definition is now updated to return `error`. +* (x/bank) [#11859](https://github.com/cosmos/cosmos-sdk/pull/11859) Move the SendEnabled information out of the Params and into the state store directly. + The information can now be accessed using the BankKeeper. + Setting can be done using MsgSetSendEnabled as a governance proposal. + A SendEnabled query has been added to both GRPC and CLI. +* (appModule) Remove `Route`, `QuerierRoute` and `LegacyQuerierHandler` from AppModule Interface. +* (x/modules) Remove all LegacyQueries and related code from modules +* (store) [#11825](https://github.com/cosmos/cosmos-sdk/pull/11825) Make extension snapshotter interface safer to use, renamed the util function `WriteExtensionItem` to `WriteExtensionPayload`. +* (x/genutil)[#12956](https://github.com/cosmos/cosmos-sdk/pull/12956) `genutil.AppModuleBasic` has a new attribute: genesis transaction validation function. The existing validation logic is implemented in `genutiltypes.DefaultMessageValidator`. Use `genutil.NewAppModuleBasic` to create a new genutil Module Basic. +* (codec) [#12964](https://github.com/cosmos/cosmos-sdk/pull/12964) `ProtoCodec.MarshalInterface` now returns an error when serializing unregistered types and a subsequent `ProtoCodec.UnmarshalInterface` would fail. +* (x/staking) [#12973](https://github.com/cosmos/cosmos-sdk/pull/12973) Removed `stakingkeeper.RandomValidator`. Use `testutil.RandSliceElem(r, sk.GetAllValidators(ctx))` instead. +>>>>>>> 9948fb6c7 (feat: emit cached context events (#13063)) All users should upgrade immediately. diff --git a/types/context.go b/types/context.go index d4bca9cec645..8a050a1b0803 100644 --- a/types/context.go +++ b/types/context.go @@ -268,11 +268,18 @@ func (c Context) TransientStore(key storetypes.StoreKey) KVStore { // CacheContext returns a new Context with the multi-store cached and a new // EventManager. The cached context is written to the context when writeCache -// is called. +// is called. Note, events are automatically emitted on the parent context's +// EventManager when the caller executes the write. func (c Context) CacheContext() (cc Context, writeCache func()) { cms := c.MultiStore().CacheMultiStore() cc = c.WithMultiStore(cms).WithEventManager(NewEventManager()) - return cc, cms.Write + + writeCache = func() { + c.EventManager().EmitEvents(cc.EventManager().Events()) + cms.Write() + } + + return cc, writeCache } var _ context.Context = Context{} diff --git a/types/context_test.go b/types/context_test.go index 95406f55c8a9..f5c7cadeb541 100644 --- a/types/context_test.go +++ b/types/context_test.go @@ -42,6 +42,10 @@ func (s *contextTestSuite) TestCacheContext() { s.Require().Equal(v1, cstore.Get(k1)) s.Require().Nil(cstore.Get(k2)) + // emit some events + cctx.EventManager().EmitEvent(types.NewEvent("foo", types.NewAttribute("key", "value"))) + cctx.EventManager().EmitEvent(types.NewEvent("bar", types.NewAttribute("key", "value"))) + cstore.Set(k2, v2) s.Require().Equal(v2, cstore.Get(k2)) s.Require().Nil(store.Get(k2)) @@ -49,6 +53,7 @@ func (s *contextTestSuite) TestCacheContext() { write() s.Require().Equal(v2, store.Get(k2)) + s.Require().Len(ctx.EventManager().Events(), 2) } func (s *contextTestSuite) TestLogContext() { diff --git a/x/gov/abci.go b/x/gov/abci.go index 9f97cba47b4d..cde12c34a80c 100644 --- a/x/gov/abci.go +++ b/x/gov/abci.go @@ -84,12 +84,6 @@ func EndBlocker(ctx sdk.Context, keeper keeper.Keeper) { tagValue = types.AttributeValueProposalPassed logMsg = "passed" - // The cached context is created with a new EventManager. However, since - // the proposal handler execution was successful, we want to track/keep - // any events emitted, so we re-emit to "merge" the events into the - // original Context's EventManager. - ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) - // write state to the underlying multi-store writeCache() } else { diff --git a/x/group/keeper/msg_server.go b/x/group/keeper/msg_server.go index fb1ab258901c..6f6cee539f93 100644 --- a/x/group/keeper/msg_server.go +++ b/x/group/keeper/msg_server.go @@ -754,19 +754,13 @@ func (k Keeper) Exec(goCtx context.Context, req *group.MsgExec) (*group.MsgExecR return nil, err } - results, err := k.doExecuteMsgs(cacheCtx, k.router, proposal, addr) - if err != nil { + if _, err := k.doExecuteMsgs(cacheCtx, k.router, proposal, addr); err != nil { proposal.ExecutorResult = group.PROPOSAL_EXECUTOR_RESULT_FAILURE logs = fmt.Sprintf("proposal execution failed on proposal %d, because of error %s", id, err.Error()) k.Logger(ctx).Info("proposal execution failed", "cause", err, "proposalID", id) } else { proposal.ExecutorResult = group.PROPOSAL_EXECUTOR_RESULT_SUCCESS flush() - - for _, res := range results { - // NOTE: The sdk msg handler creates a new EventManager, so events must be correctly propagated back to the current context - ctx.EventManager().EmitEvents(res.GetEvents()) - } } } From c16c7d88e25205262ee95db724e3dda5f44d0066 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 31 Oct 2022 13:09:38 +0100 Subject: [PATCH 2/6] fix changelog --- CHANGELOG.md | 48 ++++-------------------------------------------- 1 file changed, 4 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0447f6d7701b..5d34c0e703d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,16 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features -<<<<<<< HEAD * (x/auth) [#13612](https://github.com/cosmos/cosmos-sdk/pull/13612) Add `Query/ModuleAccountByName` endpoint for accessing the module account info by module name. -======= -* (x/authz) [#12648](https://github.com/cosmos/cosmos-sdk/pull/12648) Add an allow list, an optional list of addresses allowed to receive bank assets via authz MsgSend grant. -* (sdk.Coins) [#12627](https://github.com/cosmos/cosmos-sdk/pull/12627) Make a Denoms method on sdk.Coins. -* (testutil) [#12973](https://github.com/cosmos/cosmos-sdk/pull/12973) Add generic `testutil.RandSliceElem` function which selects a random element from the list. -* (client) [#12936](https://github.com/cosmos/cosmos-sdk/pull/12936) Add capability to preprocess transactions before broadcasting from a higher level chain. -* (x/authz) [#13047](https://github.com/cosmos/cosmos-sdk/pull/13047) Add a GetAuthorization function to the keeper. -* (cli) [#12742](https://github.com/cosmos/cosmos-sdk/pull/12742) Add the `prune` CLI cmd to manually prune app store history versions based on the pruning options. ->>>>>>> 9948fb6c7 (feat: emit cached context events (#13063)) ### Improvements @@ -59,46 +50,15 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/auth/tx) [#12474](https://github.com/cosmos/cosmos-sdk/pull/12474) Remove condition in GetTxsEvent that disallowed multiple equal signs, which would break event queries with base64 strings (i.e. query by signature). * (store) [#13530](https://github.com/cosmos/cosmos-sdk/pull/13530) Fix app-hash mismatch if upgrade migration commit is interrupted. +## API Breaking Changes + +* (context) [#13063](https://github.com/cosmos/cosmos-sdk/pull/13063) Update `Context#CacheContext` to automatically emit all events on the parent context's `EventManager`. + ## [v0.46.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.3) - 2022-10-20 ATTENTION: -<<<<<<< HEAD This is a security release for the [Dragonberry security advisory](https://forum.cosmos.network/t/ibc-security-advisory-dragonberry/7702). -======= -* (context) [#13063](https://github.com/cosmos/cosmos-sdk/pull/13063) Update `Context#CacheContext` to automatically emit all events on the parent context's `EventManager`. -* (x/bank) [#12706](https://github.com/cosmos/cosmos-sdk/pull/12706) Removed the `testutil` package from the `x/bank/client` package. -* (simapp) [#12747](https://github.com/cosmos/cosmos-sdk/pull/12747) Remove `simapp.MakeTestEncodingConfig`. Please use `moduletestutil.MakeTestEncodingConfig` (`types/module/testutil`) in tests instead. -* (x/bank) [#12648](https://github.com/cosmos/cosmos-sdk/pull/12648) `NewSendAuthorization` takes a new argument of an optional list of addresses allowed to receive bank assests via authz MsgSend grant. You can pass `nil` for the same behavior as before, i.e. any recipient is allowed. -* (x/bank) [#12593](https://github.com/cosmos/cosmos-sdk/pull/12593) Add `SpendableCoin` method to `BaseViewKeeper` -* (x/slashing) [#12581](https://github.com/cosmos/cosmos-sdk/pull/12581) Remove `x/slashing` legacy querier. -* (types) [#12355](https://github.com/cosmos/cosmos-sdk/pull/12355) Remove the compile-time `types.DBbackend` variable. Removes usage of the same in server/util.go -* (x/gov) [#12368](https://github.com/cosmos/cosmos-sdk/pull/12369) Gov keeper is now passed by reference instead of copy to make post-construction mutation of Hooks and Proposal Handlers possible at a framework level. -* (simapp) [#12270](https://github.com/cosmos/cosmos-sdk/pull/12270) Remove `invCheckPeriod uint` attribute from `SimApp` struct as per migration of `x/crisis` to app wiring -* (simapp) [#12334](https://github.com/cosmos/cosmos-sdk/pull/12334) Move `simapp.ConvertAddrsToValAddrs` and `simapp.CreateTestPubKeys ` to respectively `simtestutil.ConvertAddrsToValAddrs` and `simtestutil.CreateTestPubKeys` (`testutil/sims`) -* (simapp) [#12312](https://github.com/cosmos/cosmos-sdk/pull/12312) Move `simapp.EmptyAppOptions` to `simtestutil.EmptyAppOptions` (`testutil/sims`) -* (simapp) [#12312](https://github.com/cosmos/cosmos-sdk/pull/12312) Remove `skipUpgradeHeights map[int64]bool` and `homePath string` from `NewSimApp` constructor as per migration of `x/upgrade` to app-wiring. -* (testutil) [#12278](https://github.com/cosmos/cosmos-sdk/pull/12278) Move all functions from `simapp/helpers` to `testutil/sims` -* (testutil) [#12233](https://github.com/cosmos/cosmos-sdk/pull/12233) Move `simapp.TestAddr` to `simtestutil.TestAddr` (`testutil/sims`) -* (x/staking) [#12102](https://github.com/cosmos/cosmos-sdk/pull/12102) Staking keeper now is passed by reference instead of copy. Keeper's SetHooks no longer returns keeper. It updates the keeper in place instead. -* (linting) [#12141](https://github.com/cosmos/cosmos-sdk/pull/12141) Fix usability related linting for database. This means removing the infix Prefix from `prefix.NewPrefixWriter` and such so that it is `prefix.NewWriter` and making `db.DBConnection` and such into `db.Connection` -* (x/distribution) [#12434](https://github.com/cosmos/cosmos-sdk/pull/12434) `x/distribution` module `SetParams` keeper method definition is now updated to return `error`. -* (x/staking) [#12409](https://github.com/cosmos/cosmos-sdk/pull/12409) `x/staking` module `SetParams` keeper method definition is now updated to return `error`. -* (x/crisis) [#12445](https://github.com/cosmos/cosmos-sdk/pull/12445) `x/crisis` module `SetConstantFee` keeper method definition is now updated to return `error`. -* (x/gov) [#12631](https://github.com/cosmos/cosmos-sdk/pull/12631) `x/gov` module refactored to use `Params` as single struct instead of `DepositParams`, `TallyParams` & `VotingParams`. -* (x/gov) [#12631](https://github.com/cosmos/cosmos-sdk/pull/12631) Migrate `x/gov` to self-managed parameters and deprecate it's usage of `x/params`. -* (x/bank) [#12630](https://github.com/cosmos/cosmos-sdk/pull/12630) `x/bank` module `SetParams` keeper method definition is now updated to return `error`. -* (x/bank) [#11859](https://github.com/cosmos/cosmos-sdk/pull/11859) Move the SendEnabled information out of the Params and into the state store directly. - The information can now be accessed using the BankKeeper. - Setting can be done using MsgSetSendEnabled as a governance proposal. - A SendEnabled query has been added to both GRPC and CLI. -* (appModule) Remove `Route`, `QuerierRoute` and `LegacyQuerierHandler` from AppModule Interface. -* (x/modules) Remove all LegacyQueries and related code from modules -* (store) [#11825](https://github.com/cosmos/cosmos-sdk/pull/11825) Make extension snapshotter interface safer to use, renamed the util function `WriteExtensionItem` to `WriteExtensionPayload`. -* (x/genutil)[#12956](https://github.com/cosmos/cosmos-sdk/pull/12956) `genutil.AppModuleBasic` has a new attribute: genesis transaction validation function. The existing validation logic is implemented in `genutiltypes.DefaultMessageValidator`. Use `genutil.NewAppModuleBasic` to create a new genutil Module Basic. -* (codec) [#12964](https://github.com/cosmos/cosmos-sdk/pull/12964) `ProtoCodec.MarshalInterface` now returns an error when serializing unregistered types and a subsequent `ProtoCodec.UnmarshalInterface` would fail. -* (x/staking) [#12973](https://github.com/cosmos/cosmos-sdk/pull/12973) Removed `stakingkeeper.RandomValidator`. Use `testutil.RandSliceElem(r, sk.GetAllValidators(ctx))` instead. ->>>>>>> 9948fb6c7 (feat: emit cached context events (#13063)) All users should upgrade immediately. From 0742ce813a8272fa4badc983f9681049c539c2fa Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 31 Oct 2022 14:32:30 +0100 Subject: [PATCH 3/6] fixes --- CHANGELOG.md | 2 +- types/context.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d34c0e703d2..badfbe1cf933 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## API Breaking Changes -* (context) [#13063](https://github.com/cosmos/cosmos-sdk/pull/13063) Update `Context#CacheContext` to automatically emit all events on the parent context's `EventManager`. +* (context) [#13063](https://github.com/cosmos/cosmos-sdk/pull/13063) Update `Context#CacheContext` to automatically emit all events on the parent context's `EventManager`. Use `Context#CacheContextNoEmitEvent` for keeping the old (yet incorrect) behavior. ## [v0.46.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.3) - 2022-10-20 diff --git a/types/context.go b/types/context.go index 8a050a1b0803..efa44816a308 100644 --- a/types/context.go +++ b/types/context.go @@ -282,6 +282,15 @@ func (c Context) CacheContext() (cc Context, writeCache func()) { return cc, writeCache } +// CacheContextNoEmitEvent preserve the old behavior of CacheContext, before #13063 +// This function will only be present on v0.46 for that need to preserve the old behavior +// As the previous behavior was a bug, this function will be removed on v0.47 +func (c Context) CacheContextNoEmitEvent() (cc Context, writeCache func()) { + cms := c.MultiStore().CacheMultiStore() + cc = c.WithMultiStore(cms).WithEventManager(NewEventManager()) + return cc, cms.Write +} + var _ context.Context = Context{} // ContextKey defines a type alias for a stdlib Context key. From f30abb2110bfb31b615df4f9ee68e98c31e1a400 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 31 Oct 2022 15:19:47 +0100 Subject: [PATCH 4/6] typo --- types/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/context.go b/types/context.go index efa44816a308..25f25bd0188b 100644 --- a/types/context.go +++ b/types/context.go @@ -283,7 +283,7 @@ func (c Context) CacheContext() (cc Context, writeCache func()) { } // CacheContextNoEmitEvent preserve the old behavior of CacheContext, before #13063 -// This function will only be present on v0.46 for that need to preserve the old behavior +// This function will only be present on v0.46 for those who need to preserve the old behavior // As the previous behavior was a bug, this function will be removed on v0.47 func (c Context) CacheContextNoEmitEvent() (cc Context, writeCache func()) { cms := c.MultiStore().CacheMultiStore() From 3bca33fd635861931d71d4672450622e050e81ab Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 31 Oct 2022 17:43:26 +0100 Subject: [PATCH 5/6] revert --- types/context.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/types/context.go b/types/context.go index 25f25bd0188b..8a050a1b0803 100644 --- a/types/context.go +++ b/types/context.go @@ -282,15 +282,6 @@ func (c Context) CacheContext() (cc Context, writeCache func()) { return cc, writeCache } -// CacheContextNoEmitEvent preserve the old behavior of CacheContext, before #13063 -// This function will only be present on v0.46 for those who need to preserve the old behavior -// As the previous behavior was a bug, this function will be removed on v0.47 -func (c Context) CacheContextNoEmitEvent() (cc Context, writeCache func()) { - cms := c.MultiStore().CacheMultiStore() - cc = c.WithMultiStore(cms).WithEventManager(NewEventManager()) - return cc, cms.Write -} - var _ context.Context = Context{} // ContextKey defines a type alias for a stdlib Context key. From 41b20c5c97da3ea9a3cfa7d081d90708d8d20828 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 31 Oct 2022 17:46:09 +0100 Subject: [PATCH 6/6] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index badfbe1cf933..5d34c0e703d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## API Breaking Changes -* (context) [#13063](https://github.com/cosmos/cosmos-sdk/pull/13063) Update `Context#CacheContext` to automatically emit all events on the parent context's `EventManager`. Use `Context#CacheContextNoEmitEvent` for keeping the old (yet incorrect) behavior. +* (context) [#13063](https://github.com/cosmos/cosmos-sdk/pull/13063) Update `Context#CacheContext` to automatically emit all events on the parent context's `EventManager`. ## [v0.46.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.3) - 2022-10-20