Skip to content

Commit b493b8c

Browse files
SpicyLemonrobert-zarembajulienrbrtmergify[bot]gsk967
authored
Bring in v0.46.7 updates. (#402)
* docs: add ApplicationQueryService release notes (cosmos#13587) * docs: add ApplicationQueryService release notes * updates Co-authored-by: Julien Robert <julien@rbrt.fr> * feat(cli): add module-account cli cmd and grpc get api (backport cosmos#13612) (cosmos#13616) * feat(cli): add module-account cli cmd and grpc get api (cosmos#13612) (cherry picked from commit ddf5cf0) # Conflicts: # CHANGELOG.md # api/cosmos/auth/v1beta1/query.pulsar.go # api/cosmos/auth/v1beta1/query_grpc.pb.go # x/auth/client/testutil/suite.go # x/auth/types/query.pb.go * fix conflicts * updates * updates Co-authored-by: Sai Kumar <17549398+gsk967@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr> * fix(x/auth): allow multiple = signs in `GetTxsEvent` (backport cosmos#12474) (cosmos#13598) * fix(x/auth): allow multiple = signs in `GetTxsEvent` (cosmos#12474) (cherry picked from commit 18da0e9) # Conflicts: # CHANGELOG.md * fix changelog * changelog * fix: flakey test Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr> * fix: app-hash mismatch if upgrade migration commit is interrupted (backport cosmos#13530) (cosmos#13627) * feat(cli): Add iavl-disable-fastnode cmd flag with proper description (cosmos#13656) (cosmos#13659) (cherry picked from commit c833190) Co-authored-by: William Chong <6198816+williamchong@users.noreply.github.com> * build(deps): Bump github.com/cosmos/iavl from 0.19.3 to 0.19.4 (cosmos#13680) * feat: emit cached context events (backport cosmos#13063) (cosmos#13702) * chore: prepare 0.46.4 changelog (cosmos#13716) * chore: prepare 0.46.4 changelog * wording * updates * updates * ci: notify for 0.46.x releases (cosmos#13719) * feat: notify for 0.46.x releases * updates changelog * docs: fix algolia on 0.46 (cosmos#13730) * ci: modifying docs in 0.46 should not redeploy docs (cosmos#13732) * ci: modifying docs in 0.46 should not redeploy docs * updates * fix: propagate msg events correctly in x/gov (backport cosmos#13728) (cosmos#13748) * refactor: add error log when iavl set failed (backport cosmos#13803) (cosmos#13804) * refactor: add error log when iavl set failed (cosmos#13803) * add error log when iavl set failed Ref: cosmos#12012 * Update CHANGELOG.md * play safe (cherry picked from commit 22f3261) # Conflicts: # CHANGELOG.md * fix conflicts Co-authored-by: yihuang <huang@crypto.com> * chore: bump tendermint to `0.34.23` (cosmos#13814) * fix: propagate events in x/group through sdk.Results (backport cosmos#13808) (cosmos#13809) * docs: update algolia index (cosmos#13823) * fix: bank store migration (backport cosmos#13821) (cosmos#13829) * fix: bank store migration (cosmos#13821) (cherry picked from commit d314a12) # Conflicts: # x/bank/migrations/v3/store.go # x/bank/migrations/v3/store_test.go * updates Co-authored-by: billy rennekamp <billy.rennekamp@gmail.com> Co-authored-by: Julien Robert <julien@rbrt.fr> * feat(types): set custom GasConfig on Context for GasKVStore (backport cosmos#13826) (cosmos#13833) * feat(types): set custom GasConfig on Context for GasKVStore (cosmos#13826) (cherry picked from commit f001b46) # Conflicts: # CHANGELOG.md # types/context.go # types/context_test.go * fix conflicts * updates Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr> * chore: prepare 0.46.5 release (cosmos#13816) * fix: Allow underscores in EventRegex (backport cosmos#13861) (cosmos#13864) * fix: Allow underscores in EventRegex (cosmos#13861) (cherry picked from commit 14c582f) # Conflicts: # CHANGELOG.md # tests/e2e/tx/service_test.go * updates * updates Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr> * fix(group): add group members weight checks (backport cosmos#13869) (cosmos#13880) * fix(group): add group members weight checks (cosmos#13869) (cherry picked from commit 3423442) # Conflicts: # CHANGELOG.md # api/cosmos/tx/v1beta1/service.pulsar.go # types/tx/service.pb.go # x/group/keeper/keeper.go * fix conflicts * updates * updates Co-authored-by: Julien Robert <julien@rbrt.fr> * fix(group)!: Fix group min execution period (backport cosmos#13876) (cosmos#13885) * fix(group)!: Fix group min execution period (cosmos#13876) * fix: don't check MinExecutionPeriod in `Allow` * Check MinExecutionPeriod on doExecuteMsgs * Fix TestExec * Fix TestExec * test exec pruned * Fix submitproposal * Add changelog * typo * revert some changes * add minExecutionPeriod * Add docs and specs (cherry picked from commit 7661f62) # Conflicts: # CHANGELOG.md # x/group/README.md # x/group/keeper/keeper_test.go * fix docs * fix other conflicts * fix test Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr> * feat(bank): Add helper for v0.46 denom migration (cosmos#13891) * feat(bank): Add helper for v0.46 denom migration * CL * Clearer name * Update x/bank/migrations/v046/store.go Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com> * rename Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com> * chore: impove 0.46.5 release notes (cosmos#13898) * chore: impove 0.46.5 release notes * update changelog * refactor: State Streaming Docs + Explicit Config Support (backport cosmos#13894) (cosmos#13909) * chore: remove typo (cosmos#13914) (cosmos#13917) (cherry picked from commit 34dcca7) Co-authored-by: Julien Robert <julien@rbrt.fr> * fix: correctly propagate msg errors in gov (backport cosmos#13918) (cosmos#13928) * fix: correctly propagate msg errors in gov (cosmos#13918) * fix: correctly propagate msg errors in gov * chore: update changelog * fix: correctly check proposal status in tests * chore: delete unused var (cherry picked from commit 5581f7f) # Conflicts: # CHANGELOG.md # x/gov/abci_test.go * fix conflicts * updates Co-authored-by: John Letey <j@letey.de> Co-authored-by: Julien Robert <julien@rbrt.fr> * feat(bank): enable 0.46.5 bank migration fix through migrator keeper (cosmos#13929) * chore: bump tendermint to 0.34.24 (cosmos#13972) * chore: add group and gov/v1 in swagger (backport cosmos#13984) (cosmos#13996) * chore: add group and gov/v1 in swagger (cosmos#13984) Co-authored-by: Marko <marbar3778@yahoo.com> (cherry picked from commit cfa224c) # Conflicts: # client/docs/config.json # client/docs/swagger-ui/swagger.yaml * updates Co-authored-by: Julien Robert <julien@rbrt.fr> * fix(baseapp): fix snapshot interval bug (backport cosmos#14049) (cosmos#14053) * refactor: use viper unmarshal in `config.GetConfig` function (backport cosmos#13651) (cosmos#14082) * fix(group)!: Don't re-tally proposals after VP end (backport cosmos#14071) (cosmos#14091) * fix(group)!: Don't re-tally proposals after VP end (cosmos#14071) (cherry picked from commit 4ebe3aa) # Conflicts: # CHANGELOG.md * fix changelog and test Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr> * fix: do not shadow clientCtx in start.go (backport cosmos#14086) (cosmos#14101) * fix: do not shadow clientCtx in start.go (cosmos#14086) (cherry picked from commit f96072d) # Conflicts: # server/start.go * updates Co-authored-by: Julien Robert <julien@rbrt.fr> * chore: Test for Server Config Read cosmos#14125 (cosmos#14127) (cherry picked from commit 9f46665) Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * fix: remove duplicate ante events (backport cosmos#13983) (cosmos#14142) * fix: remove duplicate ante events (cosmos#13983) ## Description After enabling the post-handler on our chain, we realised something odd with our transaction events. The ordering was `[ANTE, MSGS, ANTE, POST]`. After doing some digging, we realised that the context used inside the post-handler still contains the events from the ante-handler. This should be backported to v0.46.x and v0.47.x 😄 Happy to make it compatible with cosmos#13940 when that gets merged! cc @mbreithecker --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) (cherry picked from commit 25449b5) # Conflicts: # CHANGELOG.md * fix changelog Co-authored-by: John Letey <john@kyve.network> Co-authored-by: Julien Robert <julien@rbrt.fr> * feat: support alternative query multistore (backport cosmos#13529) (cosmos#14169) * feat: support alternative query multistore (cosmos#13529) * support customize query multistore * Update CHANGELOG.md * fix test * Update baseapp/abci.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Update baseapp/baseapp.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Update baseapp/options.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Marko <marbar3778@yahoo.com> Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> (cherry picked from commit 15accd7) # Conflicts: # CHANGELOG.md # baseapp/baseapp.go # baseapp/options.go * fix conflicts Co-authored-by: yihuang <huang@crypto.com> * fix: state listener observe writes at wrong time (backport cosmos#13516) (cosmos#14138) * fix: state listener observe writes at wrong time (cosmos#13516) * fix: state listener observe writes at wrong time Closes: cosmos#13457 Currently state listener is notified when the cache store write, which happens in commit event only, which breaks the current design. The solution (as discussed in the issue) is to listen state writes on rootmulti store only. It also changes the file streamer to output single data file for the writes in the whole block, since we can't distinguish writes from different stage of abci events. It adds new config items for file streamer: - streamers.file.output-metadata - streamers.file.stop-node-on-error - streamers.file.fsync * synchronous abci call, and format doc * fix comment * update file streamer readme and fix typos * typo * fix: state listener observe writes at wrong time Closes: cosmos#13457 Currently state listener is notified when the cache store write, which happens in commit event only, which breaks the current design. The solution (as discussed in the issue) is to listen state writes on rootmulti store only. It also changes the file streamer to output single data file for the writes in the whole block, since we can't distinguish writes from different stage of abci events. It adds new config items for file streamer: - streamers.file.output-metadata - streamers.file.stop-node-on-error - streamers.file.fsync synchronous abci call, and format doc fix comment update file streamer readme and fix typos typo * improve UX of file streamer, make it immediately usable after enabled - set default value to write_dir. - make write_dir based on home directory by default. - auto-create the directory if not exists. * get homePage from opts Co-authored-by: Marko <marbar3778@yahoo.com> (cherry picked from commit 1f91ee2) # Conflicts: # CHANGELOG.md # api/cosmos/base/store/v1beta1/listening.pulsar.go # baseapp/streaming.go # docs/architecture/adr-038-state-listening.md # server/config/toml.go # simapp/app_v2.go # store/cachemulti/store.go # store/iavl/store.go # store/mem/store.go # store/streaming/constructor.go # store/streaming/file/service.go # store/streaming/file/service_test.go # store/types/listening.pb.go # store/types/store.go * `make proto-gen`, update changelog, delete uncessary files * fix conflicts * fix conflicts * revert api breaking change * fix build * fix unit test Co-authored-by: yihuang <huang@crypto.com> Co-authored-by: Julien Robert <julien@rbrt.fr> Co-authored-by: Marko <marbar3778@yahoo.com> * refactor: provide a helper for baseapp options (backport cosmos#14175) (cosmos#14178) * refactor: provide a helper for baseapp options (cosmos#14175) * provide a helper for baseapp options * rename * changelog entry * fix spelling (cherry picked from commit 1b6192f) # Conflicts: # CHANGELOG.md # server/mock/app_test.go # simapp/simd/cmd/root.go * conflicts * lint Co-authored-by: Marko <marbar3778@yahoo.com> * feat: add --grpc client option (backport cosmos#14051) (cosmos#14192) Co-authored-by: Aaron Craelius <aaron@regen.network> Co-authored-by: Julien Robert <julien@rbrt.fr> * refactor: cleanup store/streaming/constructor.go (backport cosmos#14044) (cosmos#14236) * chore: audit store/streaming/file/service.go (backport cosmos#14234) (cosmos#14241) Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr> * fix: fix grpc flag conflict (backport cosmos#14244) (cosmos#14248) * chore: prepare 0.46.7 release (cosmos#14103) * fix(gov): Fix v3 votes migrations (backport cosmos#14214) (cosmos#14277) Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr> * Add changelog entry for bringing in v0.46.7 changes. * Fix the changelog. The merge duplicated several SDK sections. * Fix the TestFileStreamingService. Co-authored-by: Robert Zaremba <robert@zaremba.ch> Co-authored-by: Julien Robert <julien@rbrt.fr> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Sai Kumar <17549398+gsk967@users.noreply.github.com> Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com> Co-authored-by: William Chong <6198816+williamchong@users.noreply.github.com> Co-authored-by: yihuang <huang@crypto.com> Co-authored-by: billy rennekamp <billy.rennekamp@gmail.com> Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> Co-authored-by: Likhita Polavarapu <78951027+likhita-809@users.noreply.github.com> Co-authored-by: John Letey <j@letey.de> Co-authored-by: John Letey <john@kyve.network> Co-authored-by: Marko <marbar3778@yahoo.com> Co-authored-by: Aaron Craelius <aaron@regen.network>
1 parent 6e3f814 commit b493b8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+38177
-27812
lines changed

CHANGELOG.md

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
3939

4040
## Unreleased
4141

42-
* nothing
42+
### Improvements
43+
44+
* Bring in Cosmos-SDK [v0.46.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.7) changes [#402](https://github.com/provenance-io/cosmos-sdk/pull/402).
4345

4446
---
4547

@@ -197,18 +199,52 @@ It also contains the Provenance Blockchain customizations that were part of [v0.
197199

198200
# Cosmos-SDK releases
199201

202+
## [v0.46.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.7) - 2022-12-13
203+
204+
### Features
205+
206+
* (client) [#14051](https://github.com/cosmos/cosmos-sdk/pull/14051) Add `--grpc` client option.
207+
208+
### Improvements
209+
210+
* (deps) Bump Tendermint version to [v0.34.24](https://github.com/tendermint/tendermint/releases/tag/v0.34.24).
211+
* [#13651](https://github.com/cosmos/cosmos-sdk/pull/13651) Update `server/config/config.GetConfig` function.
212+
* [#13781](https://github.com/cosmos/cosmos-sdk/pull/13781) Remove `client/keys.KeysCdc`.
213+
* [#14175](https://github.com/cosmos/cosmos-sdk/pull/14175) Add `server.DefaultBaseappOptions(appopts)` function to reduce boiler plate in root.go.
214+
215+
### State Machine Breaking
216+
217+
* (x/gov) [#14214](https://github.com/cosmos/cosmos-sdk/pull/14214) Fix gov v0.46 migration to v1 votes.
218+
* Also provide a helper function `govv046.Migrate_V0466_To_V0467` for migrating a chain already on v0.46 with versions <=v0.46.6 to the latest v0.46.7 correct state.
219+
* (x/group) [#14071](https://github.com/cosmos/cosmos-sdk/pull/14071) Don't re-tally proposal after voting period end if they have been marked as ACCEPTED or REJECTED.
220+
221+
### API Breaking Changes
222+
223+
* (store) [#13516](https://github.com/cosmos/cosmos-sdk/pull/13516) Update State Streaming APIs:
224+
* Add method `ListenCommit` to `ABCIListener`
225+
* Move `ListeningEnabled` and `AddListener` methods to `CommitMultiStore`
226+
* Remove `CacheWrapWithListeners` from `CacheWrap` and `CacheWrapper` interfaces
227+
* Remove listening APIs from the caching layer (it should only listen to the `rootmulti.Store`)
228+
* Add three new options to file streaming service constructor.
229+
* Modify `ABCIListener` such that any error from any method will always halt the app via `panic`
230+
* (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.
231+
232+
### Bug Fixes
233+
234+
* (baseapp) [#13983](https://github.com/cosmos/cosmos-sdk/pull/13983) Don't emit duplicate ante-handler events when a post-handler is defined.
235+
* (baseapp) [#14049](https://github.com/cosmos/cosmos-sdk/pull/14049) Fix state sync when interval is zero.
236+
* (store) [#13516](https://github.com/cosmos/cosmos-sdk/pull/13516) Fix state listener that was observing writes at wrong time.
237+
200238
## [v0.46.6](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.6) - 2022-11-18
201239

202240
### Improvements
203241

204242
* (config) [#13894](https://github.com/cosmos/cosmos-sdk/pull/13894) Support state streaming configuration in `app.toml` template and default configuration.
205243

206-
## Bug Fixes
244+
### Bug Fixes
207245

208246
* (x/gov) [#13918](https://github.com/cosmos/cosmos-sdk/pull/13918) Fix propagation of message errors when executing a proposal.
209247

210-
---
211-
212248
## [v0.46.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.5) - 2022-11-17
213249

214250
### Features
@@ -237,8 +273,6 @@ It also contains the Provenance Blockchain customizations that were part of [v0.
237273
* (store) [#13803](https://github.com/cosmos/cosmos-sdk/pull/13803) Add an error log if IAVL set operation failed.
238274
* [#13861](https://github.com/cosmos/cosmos-sdk/pull/13861) Allow `_` characters in tx event queries, i.e. `GetTxsEvent`.
239275

240-
---
241-
242276
## [v0.46.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.4) - 2022-11-01
243277

244278
### Features
@@ -262,8 +296,6 @@ It also contains the Provenance Blockchain customizations that were part of [v0.
262296

263297
* (context) [#13063](https://github.com/cosmos/cosmos-sdk/pull/13063) Update `Context#CacheContext` to automatically emit all events on the parent context's `EventManager`.
264298

265-
---
266-
267299
## [v0.46.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.3) - 2022-10-20
268300

269301
ATTENTION:

baseapp/abci.go

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg
189189
// call the hooks with the BeginBlock messages
190190
for _, streamingListener := range app.abciListeners {
191191
if err := streamingListener.ListenBeginBlock(app.deliverState.ctx, req, res); err != nil {
192-
app.logger.Error("BeginBlock listening hook failed", "height", req.Header.Height, "err", err)
192+
panic(fmt.Errorf("BeginBlock listening hook failed, height: %d, err: %w", req.Header.Height, err))
193193
}
194194
}
195195

@@ -216,7 +216,7 @@ func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBloc
216216
// call the streaming service hooks with the EndBlock messages
217217
for _, streamingListener := range app.abciListeners {
218218
if err := streamingListener.ListenEndBlock(app.deliverState.ctx, req, res); err != nil {
219-
app.logger.Error("EndBlock listening hook failed", "height", req.Height, "err", err)
219+
panic(fmt.Errorf("EndBlock listening hook failed, height: %d, err: %w", req.Height, err))
220220
}
221221
}
222222

@@ -270,7 +270,7 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliv
270270
defer func() {
271271
for _, streamingListener := range app.abciListeners {
272272
if err := streamingListener.ListenDeliverTx(app.deliverState.ctx, req, res); err != nil {
273-
app.logger.Error("DeliverTx listening hook failed", "err", err)
273+
panic(fmt.Errorf("DeliverTx listening hook failed: %w", err))
274274
}
275275
}
276276
}()
@@ -304,7 +304,7 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliv
304304
// defined in config, Commit will execute a deferred function call to check
305305
// against that height and gracefully halt if it matches the latest committed
306306
// height.
307-
func (app *BaseApp) Commit() (res abci.ResponseCommit) {
307+
func (app *BaseApp) Commit() abci.ResponseCommit {
308308
header := app.deliverState.ctx.BlockHeader()
309309
retainHeight := app.GetBlockRetentionHeight(header.Height)
310310

@@ -313,6 +313,19 @@ func (app *BaseApp) Commit() (res abci.ResponseCommit) {
313313
// MultiStore (app.cms) so when Commit() is called is persists those values.
314314
app.deliverState.ms.Write()
315315
commitID := app.cms.Commit()
316+
317+
res := abci.ResponseCommit{
318+
Data: commitID.Hash,
319+
RetainHeight: retainHeight,
320+
}
321+
322+
// call the hooks with the Commit message
323+
for _, streamingListener := range app.abciListeners {
324+
if err := streamingListener.ListenCommit(app.deliverState.ctx, res); err != nil {
325+
panic(fmt.Errorf("Commit listening hook failed, height: %d, err: %w", header.Height, err))
326+
}
327+
}
328+
316329
app.logger.Info("commit synced", "commit", fmt.Sprintf("%X", commitID))
317330

318331
// Reset the Check state to the latest committed.
@@ -344,10 +357,7 @@ func (app *BaseApp) Commit() (res abci.ResponseCommit) {
344357

345358
go app.snapshotManager.SnapshotIfApplicable(header.Height)
346359

347-
return abci.ResponseCommit{
348-
Data: commitID.Hash,
349-
RetainHeight: retainHeight,
350-
}
360+
return res
351361
}
352362

353363
// halt attempts to gracefully shutdown the node via SIGINT and SIGTERM falling
@@ -599,7 +609,13 @@ func (app *BaseApp) createQueryContext(height int64, prove bool) (sdk.Context, e
599609
return sdk.Context{}, err
600610
}
601611

602-
lastBlockHeight := app.LastBlockHeight()
612+
// use custom query multistore if provided
613+
qms := app.qms
614+
if qms == nil {
615+
qms = sdk.MultiStore(app.cms)
616+
}
617+
618+
lastBlockHeight := qms.LatestVersion()
603619
if height > lastBlockHeight {
604620
return sdk.Context{},
605621
sdkerrors.Wrap(
@@ -621,7 +637,7 @@ func (app *BaseApp) createQueryContext(height int64, prove bool) (sdk.Context, e
621637
)
622638
}
623639

624-
cacheMS, err := app.cms.CacheMultiStoreWithVersion(height)
640+
cacheMS, err := qms.CacheMultiStoreWithVersion(height)
625641
if err != nil {
626642
return sdk.Context{},
627643
sdkerrors.Wrapf(

baseapp/baseapp.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ type BaseApp struct { // nolint: maligned
119119
type appStore struct {
120120
db dbm.DB // common DB backend
121121
cms sdk.CommitMultiStore // Main (uncached) state
122+
qms sdk.MultiStore // Optional alternative state provider for query service
122123
storeLoader StoreLoader // function to handle store loading, may be overridden with SetStoreLoader()
123124

124125
// an inter-block write-through cache provided to the context during deliverState
@@ -725,7 +726,12 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte) (gInfo sdk.GasInfo, re
725726
//
726727
// Note: If the postHandler fails, we also revert the runMsgs state.
727728
if app.postHandler != nil {
728-
newCtx, err := app.postHandler(runMsgCtx, tx, mode == runTxModeSimulate)
729+
// The runMsgCtx context currently contains events emitted by the ante handler.
730+
// We clear this to correctly order events without duplicates.
731+
// Note that the state is still preserved.
732+
postCtx := runMsgCtx.WithEventManager(sdk.NewEventManager())
733+
734+
newCtx, err := app.postHandler(postCtx, tx, mode == runTxModeSimulate)
729735
if err != nil {
730736
return gInfo, nil, nil, priority, ctx, err
731737
}

baseapp/options.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func (app *BaseApp) SetSnapshot(snapshotStore *snapshots.Store, opts snapshottyp
219219
if app.sealed {
220220
panic("SetSnapshot() on sealed BaseApp")
221221
}
222-
if snapshotStore == nil || opts.Interval == snapshottypes.SnapshotIntervalOff {
222+
if snapshotStore == nil {
223223
app.snapshotManager = nil
224224
return
225225
}
@@ -245,6 +245,16 @@ func (app *BaseApp) SetStreamingService(s StreamingService) {
245245
app.abciListeners = append(app.abciListeners, s)
246246
}
247247

248+
// SetQueryMultiStore set a alternative MultiStore implementation to support grpc query service.
249+
//
250+
// Ref: https://github.com/cosmos/cosmos-sdk/issues/13317
251+
func (app *BaseApp) SetQueryMultiStore(ms sdk.MultiStore) {
252+
if app.sealed {
253+
panic("SetQueryMultiStore() on sealed BaseApp")
254+
}
255+
app.qms = ms
256+
}
257+
248258
// SetFeeHandler sets the FeeHandler which if set will change the behavior of fee handling
249259
func (app *BaseApp) SetFeeHandler(feeHandler sdk.FeeHandler) {
250260
if app.sealed {

baseapp/streaming.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
package baseapp
22

33
import (
4+
"context"
45
"io"
56
"sync"
67

78
abci "github.com/tendermint/tendermint/abci/types"
89

910
store "github.com/cosmos/cosmos-sdk/store/types"
10-
"github.com/cosmos/cosmos-sdk/types"
1111
)
1212

13-
// ABCIListener interface used to hook into the ABCI message processing of the BaseApp
13+
// ABCIListener interface used to hook into the ABCI message processing of the BaseApp.
14+
// the error results are propagated to consensus state machine,
15+
// if you don't want to affect consensus, handle the errors internally and always return `nil` in these APIs.
1416
type ABCIListener interface {
1517
// ListenBeginBlock updates the streaming service with the latest BeginBlock messages
16-
ListenBeginBlock(ctx types.Context, req abci.RequestBeginBlock, res abci.ResponseBeginBlock) error
18+
ListenBeginBlock(ctx context.Context, req abci.RequestBeginBlock, res abci.ResponseBeginBlock) error
1719
// ListenEndBlock updates the steaming service with the latest EndBlock messages
18-
ListenEndBlock(ctx types.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock) error
20+
ListenEndBlock(ctx context.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock) error
1921
// ListenDeliverTx updates the steaming service with the latest DeliverTx messages
20-
ListenDeliverTx(ctx types.Context, req abci.RequestDeliverTx, res abci.ResponseDeliverTx) error
22+
ListenDeliverTx(ctx context.Context, req abci.RequestDeliverTx, res abci.ResponseDeliverTx) error
23+
// ListenCommit updates the steaming service with the latest Commit event
24+
ListenCommit(ctx context.Context, res abci.ResponseCommit) error
2125
}
2226

2327
// StreamingService interface for registering WriteListeners with the BaseApp and updating the service with the ABCI messages using the hooks

client/cmd.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package client
22

33
import (
4+
"crypto/tls"
45
"fmt"
56
"strings"
67

78
"github.com/pkg/errors"
89
"github.com/spf13/cobra"
910
"github.com/spf13/pflag"
1011
"github.com/tendermint/tendermint/libs/cli"
12+
"google.golang.org/grpc"
13+
"google.golang.org/grpc/credentials"
14+
"google.golang.org/grpc/credentials/insecure"
1115

1216
"github.com/cosmos/cosmos-sdk/client/flags"
1317
"github.com/cosmos/cosmos-sdk/crypto/keyring"
@@ -147,6 +151,28 @@ func ReadPersistentCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Cont
147151
}
148152
}
149153

154+
if clientCtx.GRPCClient == nil || flagSet.Changed(flags.FlagGRPC) {
155+
grpcURI, _ := flagSet.GetString(flags.FlagGRPC)
156+
if grpcURI != "" {
157+
var dialOpts []grpc.DialOption
158+
159+
useInsecure, _ := flagSet.GetBool(flags.FlagGRPCInsecure)
160+
if useInsecure {
161+
dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials()))
162+
} else {
163+
dialOpts = append(dialOpts, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{
164+
MinVersion: tls.VersionTLS12,
165+
})))
166+
}
167+
168+
grpcClient, err := grpc.Dial(grpcURI, dialOpts...)
169+
if err != nil {
170+
return Context{}, err
171+
}
172+
clientCtx = clientCtx.WithGRPCClient(grpcClient)
173+
}
174+
}
175+
150176
return clientCtx, nil
151177
}
152178

client/docs/config.json

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@
5454
}
5555
}
5656
},
57+
{
58+
"url": "./tmp-swagger-gen/cosmos/gov/v1/query.swagger.json",
59+
"operationIds": {
60+
"rename": {
61+
"Params": "GovV1Params",
62+
"Proposal": "GovV1Proposal",
63+
"Proposals": "GovV1Proposal",
64+
"Vote": "GovV1Vote",
65+
"Votes": "GovV1Votes",
66+
"Deposit": "GovV1Deposit",
67+
"Deposits": "GovV1Deposit",
68+
"TallyResult": "GovV1TallyResult"
69+
}
70+
}
71+
},
5772
{
5873
"url": "./tmp-swagger-gen/cosmos/mint/v1beta1/query.swagger.json",
5974
"operationIds": {
@@ -116,6 +131,25 @@
116131
"Params": "FeegrantParams"
117132
}
118133
}
134+
},
135+
{
136+
"url": "./tmp-swagger-gen/cosmos/nft/v1beta1/query.swagger.json",
137+
"operationIds": {
138+
"rename": {
139+
"Params": "NftParams",
140+
"Balance": "NftBalance"
141+
}
142+
}
143+
},
144+
{
145+
"url": "./tmp-swagger-gen/cosmos/group/v1/query.swagger.json",
146+
"operationIds": {
147+
"rename": {
148+
"Params": "GroupParams",
149+
"Proposal": "GroupProposal",
150+
"TallyResult": "GroupTallyResult"
151+
}
152+
}
119153
}
120154
]
121-
}
155+
}

client/docs/statik/statik.go

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)