Skip to content

Commit

Permalink
fix: apply fix from release branch (#428)
Browse files Browse the repository at this point in the history
* docs: release 0.44.0-rc0 (#420)

* Merge release 0.42.9 (#423)

* fixed broken links, typos (#8783) (#8823)

* fixed broken links, typos

* Update docs/ibc/overview.md

Co-authored-by: Amaury <[email protected]>

* Update docs/intro/sdk-app-architecture.md

Co-authored-by: Marko <[email protected]>

* Update docs/building-modules/simulator.md

Co-authored-by: Marko <[email protected]>

Co-authored-by: chrly <[email protected]>
Co-authored-by: Amaury <[email protected]>
Co-authored-by: Jonathan Gimeno <[email protected]>
Co-authored-by: Marko <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 24ed401c81e881ee85e629da824bd407fe0b6b6d)

Co-authored-by: Charly <[email protected]>

* add trust to macOS Keychain for calling apps by default (#8826) (#8835)

This commit automatically trusts the calling application with its data,
avoiding all the annoying keychain popups that appears when dealing with
keys (list, add...).

Co-authored-by: Alessio Treglia <[email protected]>
(cherry picked from commit d761f088ab7077c285fc198ad61e72b77e5aea0f)

Co-authored-by: Gianguido Sora <[email protected]>

* store/cachekv: use typed types/kv.List instead of container/list.List (#8811) (#8817)

Reduces CPU burn by using a typed List to avoid the expensive type
assertions from using an interface. This is the only option for now
until Go makes generics generally available.

The change brings time spent on the time assertion cummulatively to:
    580ms down from 6.88s

Explanation:
The type assertions were showing up heavily in profiles:
* Before this commit
```shell
Total: 42.18s
ROUTINE ======================== github.com/cosmos/cosmos-sdk/store/cachekv.newMemIterator
in /Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/store/cachekv/memiterator.go
    14.01s     18.87s (flat, cum) 44.74% of Total
         .          .     17:	items      []*kv.Pair
         .          .     18:	ascending  bool
         .          .     19:}
         .          .     20:
         .          .     21:func newMemIterator(start, end []byte, items *list.List, ascending bool) *memIterator {
         .      620ms     22:	itemsInDomain := make([]*kv.Pair, 0, items.Len())
         .          .     23:
         .          .     24:	var entered bool
         .          .     25:
     510ms      870ms     26:	for e := items.Front(); e != nil; e = e.Next() {
     6.85s      6.88s     27:		item := e.Value.(*kv.Pair)
     5.71s      8.19s     28:		if !dbm.IsKeyInDomain(item.Key, start, end) {
     120ms      120ms     29:			if entered {
         .          .     30:				break
         .          .     31:			}
         .          .     32:
         .          .     33:			continue
         .          .     34:		}
         .          .     35:
     820ms      980ms     36:		itemsInDomain = append(itemsInDomain, item)
         .          .     37:		entered = true
         .          .     38:	}
         .          .     39:
         .      1.21s     40:	return &memIterator{
         .          .     41:		start:     start,
         .          .     42:		end:       end,
         .          .     43:		items:     itemsInDomain,
         .          .     44:		ascending: ascending,
         .          .     45:	}
```

and given that the list only uses that type, it is only right to lift the
code from container/list.List, and only modify Element.Value's type.

For emphasis, the code is basically just a retrofit of
container/list/list.go but with a typing, and we'll keep it as is
until perhaps Go1.17 or Go1.18 or when everyone uses Go1.17+ after
generics have landed.

* After this commit
```shell
Total: 45.25s
ROUTINE ======================== github.com/cosmos/cosmos-sdk/store/cachekv.newMemIterator
in /Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/store/cachekv/memiterator.go
     4.84s      6.77s (flat, cum) 14.96% of Total
         .          .     16:	items      []*kv.Pair
         .          .     17:	ascending  bool
         .          .     18:}
         .          .     19:
         .          .     20:func newMemIterator(start, end []byte, items *kv.List, ascending bool) *memIterator {
         .      330ms     21:	itemsInDomain := make([]*kv.Pair, 0, items.Len())
         .          .     22:
         .          .     23:	var entered bool
         .          .     24:
      60ms      160ms     25:	for e := items.Front(); e != nil; e = e.Next() {
     580ms      580ms     26:		item := e.Value
     3.68s      4.78s     27:		if !dbm.IsKeyInDomain(item.Key, start, end) {
      80ms       80ms     28:			if entered {
         .          .     29:				break
         .          .     30:			}
         .          .     31:
         .          .     32:			continue
         .          .     33:		}
         .          .     34:
     440ms      580ms     35:		itemsInDomain = append(itemsInDomain, item)
         .          .     36:		entered = true
         .          .     37:	}
         .          .     38:
         .      260ms     39:	return &memIterator{
         .          .     40:		start:     start,
         .          .     41:		end:       end,
         .          .     42:		items:     itemsInDomain,
         .          .     43:		ascending: ascending,
         .          .     44:	}
```

Fixes #8810

(cherry picked from commit c2d5b24f58a6537d2a7205ca4f2960c8424c4bef)

Co-authored-by: Emmanuel T Odeke <[email protected]>

* fixes: permalinks for docs (#8838) (#8846)

* fixed broken links, typos

* Update docs/ibc/overview.md

Co-authored-by: Amaury <[email protected]>

* Update docs/intro/sdk-app-architecture.md

Co-authored-by: Marko <[email protected]>

* Update docs/building-modules/simulator.md

Co-authored-by: Marko <[email protected]>

* build(deps): bump JamesIves/github-pages-deploy-action from 4.0.0 to 4.1.0 (#8792)

Bumps [JamesIves/github-pages-deploy-action](https://github.com/JamesIves/github-pages-deploy-action) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/JamesIves/github-pages-deploy-action/releases)
- [Commits](https://github.com/JamesIves/github-pages-deploy-action/compare/4.0.0...3dbacc7e69578703f91f077118b3475862cb09b8)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix multisig account pubkeys migration (#8794)

closes: #8776

* Update mergify (#8784)

* Update mergify

Prep for the v0.42 release series.

* retire v0.41, the hub can upgrade to v0.42 smoothly

* perf change (#8796)

Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Supply by denom Migrations (#8780)

* Add back supply proto

* Add migration for supply

* Fix lint

* Update x/bank/spec/01_state.md

* Fix test

* Proto gen

* Update x/bank/spec/01_state.md

* Make proto gen

Co-authored-by: Jonathan Gimeno <[email protected]>

* fix make protoc error (#8799)

* reduce gas costs by 10x for transient store operations (#8790)

* reduce gas costs by 10x for transient store operations

* fix TestTransientGasConfig for ReadCostFlat

* added changelog entry

* fix changelog

* fix changelog

Co-authored-by: Alessio Treglia <[email protected]>

* x/gov: fix NormalizeProposalType() return values (#8808)

Closes: #8806

* store/cachekv: use typed types/kv.List instead of container/list.List (#8811)

Reduces CPU burn by using a typed List to avoid the expensive type
assertions from using an interface. This is the only option for now
until Go makes generics generally available.

The change brings time spent on the time assertion cummulatively to:
    580ms down from 6.88s

Explanation:
The type assertions were showing up heavily in profiles:
* Before this commit
```shell
Total: 42.18s
ROUTINE ======================== github.com/cosmos/cosmos-sdk/store/cachekv.newMemIterator
in /Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/store/cachekv/memiterator.go
    14.01s     18.87s (flat, cum) 44.74% of Total
         .          .     17:	items      []*kv.Pair
         .          .     18:	ascending  bool
         .          .     19:}
         .          .     20:
         .          .     21:func newMemIterator(start, end []byte, items *list.List, ascending bool) *memIterator {
         .      620ms     22:	itemsInDomain := make([]*kv.Pair, 0, items.Len())
         .          .     23:
         .          .     24:	var entered bool
         .          .     25:
     510ms      870ms     26:	for e := items.Front(); e != nil; e = e.Next() {
     6.85s      6.88s     27:		item := e.Value.(*kv.Pair)
     5.71s      8.19s     28:		if !dbm.IsKeyInDomain(item.Key, start, end) {
     120ms      120ms     29:			if entered {
         .          .     30:				break
         .          .     31:			}
         .          .     32:
         .          .     33:			continue
         .          .     34:		}
         .          .     35:
     820ms      980ms     36:		itemsInDomain = append(itemsInDomain, item)
         .          .     37:		entered = true
         .          .     38:	}
         .          .     39:
         .      1.21s     40:	return &memIterator{
         .          .     41:		start:     start,
         .          .     42:		end:       end,
         .          .     43:		items:     itemsInDomain,
         .          .     44:		ascending: ascending,
         .          .     45:	}
```

and given that the list only uses that type, it is only right to lift the
code from container/list.List, and only modify Element.Value's type.

For emphasis, the code is basically just a retrofit of
container/list/list.go but with a typing, and we'll keep it as is
until perhaps Go1.17 or Go1.18 or when everyone uses Go1.17+ after
generics have landed.

* After this commit
```shell
Total: 45.25s
ROUTINE ======================== github.com/cosmos/cosmos-sdk/store/cachekv.newMemIterator
in /Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/store/cachekv/memiterator.go
     4.84s      6.77s (flat, cum) 14.96% of Total
         .          .     16:	items      []*kv.Pair
         .          .     17:	ascending  bool
         .          .     18:}
         .          .     19:
         .          .     20:func newMemIterator(start, end []byte, items *kv.List, ascending bool) *memIterator {
         .      330ms     21:	itemsInDomain := make([]*kv.Pair, 0, items.Len())
         .          .     22:
         .          .     23:	var entered bool
         .          .     24:
      60ms      160ms     25:	for e := items.Front(); e != nil; e = e.Next() {
     580ms      580ms     26:		item := e.Value
     3.68s      4.78s     27:		if !dbm.IsKeyInDomain(item.Key, start, end) {
      80ms       80ms     28:			if entered {
         .          .     29:				break
         .          .     30:			}
         .          .     31:
         .          .     32:			continue
         .          .     33:		}
         .          .     34:
     440ms      580ms     35:		itemsInDomain = append(itemsInDomain, item)
         .          .     36:		entered = true
         .          .     37:	}
         .          .     38:
         .      260ms     39:	return &memIterator{
         .          .     40:		start:     start,
         .          .     41:		end:       end,
         .          .     42:		items:     itemsInDomain,
         .          .     43:		ascending: ascending,
         .          .     44:	}
```

Fixes #8810

* Move all migration scripts to v043 (#8814)

* Move all migration scripts to v043

* Fix permaling

* Fix test

* Fix test again

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* permalinks

Co-authored-by: chrly <[email protected]>
Co-authored-by: Amaury <[email protected]>
Co-authored-by: Jonathan Gimeno <[email protected]>
Co-authored-by: Marko <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Akhil Kumar P <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Marko <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Albert Chon <[email protected]>
Co-authored-by: Emmanuel T Odeke <[email protected]>
(cherry picked from commit 55fc465dce737f35f245932152198847f2b96f4f)

Co-authored-by: Charly <[email protected]>

* Security/ghsa mvm6 gfm2 89xj (#8852)

* Merge pull request from GHSA-mvm6-gfm2-89xj

Co-authored-by: Alessio Treglia <[email protected]>

* v0.42.1 Changelog update (#8851)

Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>

* keyring: update documentation (#8839) (#8858)

* keyring: update documentation

* Update docs/run-node/keyring.md

Co-authored-by: Barrie Byron <[email protected]>

* Update docs/run-node/keyring.md

Co-authored-by: Barrie Byron <[email protected]>

Co-authored-by: Barrie Byron <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 3954c244b641e68b8a1a2159ba8fb45b9a0b03c9)

Co-authored-by: Alessio Treglia <[email protected]>

* Fix SendToModuleAccountTest (bp #8857) (#8860)

* Fix SendToModuleAccountTest (#8857)

(cherry picked from commit 280ee4f15e46117a5061ab3a374d9b695ed082bf)

Co-authored-by: Jonathan Gimeno <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>

* all: skip noisy/faulty benchmarks + add b.ReportAllocs for every benchmark (bp #8856) (#8859)

* all: skip noisy/faulty benchmarks + add b.ReportAllocs for every benchmark (#8856)

* Skips very noisy benchmarks that end up running only for b.N=1 because
their entire time is spent in setup, and varying parameters doesn't change
much given that the number of stores is what dominates the expense. To
ensure we can provide reliable benchmarks, progressively for the project,
skip these until there is a proper re-work of what the benchmarks need to do

* Previously sub-benchmarks: b.Run(...) did not b.ReportAllocs() due to a faulty
assumption that invoking b.ReportAllocs() at the top would be inherited by
all sub-benchmarks. This change fixes that

Fixes #8779
Fixes #8855

Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit b9f3db1be8b9978094265407396fc864e19c00cd)

* Remove stray code that got pulled in by mergify but not essential

Co-authored-by: Emmanuel T Odeke <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>

* add --output-document to multisign-batch (#8873) (#8877)

Closes: #8870

Co-authored-by: SaReN <[email protected]>
(cherry picked from commit 5f71e93b1e0f9a7d9617f5ea88f5c18b73361a7b)

Co-authored-by: Alessio Treglia <[email protected]>

* Fix multisig LegacyAminoPubKey Amino marshaling (bp #8841) (#8878)

(cherry picked from commit d4d27e1c0c138d76ab3082ba8e380d4d26db050a)

closes: #8776

Co-authored-by: Amaury <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Anil Kumar Kammari <[email protected]>

* docs: update dropdown v0.41 → v0.42 (#8888)

* Update docs (bp #8751) (#8894)

closes: #8750

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 36f68eb9e041e20a5bb47e216ac5eb8b91f95471)

Co-authored-by: Pash <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* add orderBy parameter to TxsByEvents (bp #8815) (#8883)

Closes: #8686

(cherry picked from commit 553aac50305b02e406cd51479b48a99ca34b4a4e)

Co-authored-by: Amaury <[email protected]>
Co-authored-by: MD Aleem <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Jonathan Gimeno <[email protected]>
Co-authored-by: aleem1314 <[email protected]>

* Fix typo (#8905) (#8910)

Co-authored-by: Marko <[email protected]>
(cherry picked from commit 0836361c0e873a73554ccc6aab338c7d5af1e2c7)

Co-authored-by: Hanjun Kim <[email protected]>

* Docs: Anys Usage, Events & small cleanups (bp #8895) (#8911)

Co-authored-by: Barrie Byron <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>
(cherry picked from commit 1a4418b32b4ee0245478c560caf93f3496cbe017)
Co-authored-by: Amaury <[email protected]>

* update changelog and RELEASE NOTES (#8912)

Co-authored-by: Amaury <[email protected]>
Co-authored-by: Barrie Byron <[email protected]>

* add +nobuild flags to all relevant test cases (bp #8934) (#8938)

Closes: #8923
(cherry picked from commit 7b09f95ab5bed044ef9c74de0c7b093cf26ef648)
Co-authored-by: Alessio Treglia <[email protected]>

* backport test detection ci fix (#8924) (#8942)

cherry-pick 641b13ee47d59c838cc05d1b288a496c4d9f3301

* update changelog

* Staking spec updates (bp #8843) (#8939)

* Staking spec updates (#8843)

* Overview of keepers in object capability model (OCM)

* Updates to the spec, making clarifications

* Create a sequence diagram of a (fresh) delegation

* Misc notes, not yet decided where to put them

* Description of the shares abstraction in validators

* Model all keeper dependencies and move the UML file to docs

* Move and rename delegation sequence diagram

* Move shares description

* Remove TODO

* Diagram touch-ups

* Add how consensus power is calculated

* remove temp file

* Diagram improvements

* Describe slashing in more detail

* Describe redelegation

* Describe unbonding

* Delegation updates

* Delegation updates

* Make a diagram describing overall transaction flow

* Add delegation flows for the events of tokens being bonded/unbonding/etc.

* Grammar fix

* Diagram updates: distinguish alts, remove numbering.

* Use groups instead of "func:" participants

* Remove unused keepers from dependency diagram

* Add title to unbonding diagram

* Move keeper dependencies

* small doc updates

* remove numbers on sequence diagram

* !!!WIP EndBlock

* Explain "Last"-prefix in storage

* Remove `panic` step (they are supposed to never happen)

* EndBlock sequence diagram (with TODOs)

* Add TODO

* More visible TODOs

* Remove numbering

* Complete EndBlock

* Remove numbering

* Remove TODOs and update title

* add title back

* remove endblock seq-diagram

* spec updates

* Make power index update conditional on not being jailed

* update title

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 0b2497049ab90e8be5c10ded1717997a10fd2a4f)
Co-authored-by: Rikard Hjort <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* Merge pull request from GHSA-2f3p-6gfj-jccq (#8985)

* finalise release changelog and notes (#8987)

* [Backport] Add ledger/multisig detection in SignTx functions (#9026) (#9041)

Co-authored-by: Alessio Treglia <[email protected]>

* [Backport]  fix: grpc-gateway error codes (#9015) (#9078)

Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Amaury <[email protected]>

* Backport #9081: bump tendermint core (#9082)

* bump tendermint core

Depends on 0.34.9.

* fix FTBFS

* update changelog for v0.42.4 (#9083)

* update changelog for v0.42.4

* Update RELEASE_NOTES.md

* Update CHANGELOG.md

Co-authored-by: Barrie Byron <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Barrie Byron <[email protected]>

* Update RELEASE_NOTES.md

Co-authored-by: Barrie Byron <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Barrie Byron <[email protected]>

Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Barrie Byron <[email protected]>

* fix show multisig query (#9108)

closes: #9056

* update legacy rest swagger (#9049) (#9087)

Co-authored-by: SaReN <[email protected]>
Co-authored-by: Amaury <[email protected]>

* crypto/types: check for overflow and unreasonably large element count (#9173)

From: #9163
Fixes: #9162
Thanks: @odeke-em for the patch.

Co-authored-by: Emmanuel T Odeke <[email protected]>

* backport: make NewDecFromStr returns error for too large decimal (#9175)

From: #9157
Closes: #9160

Co-authored-by: Cuong Manh Le <[email protected]>

* backport 0.42.x: Fix IBC doc links (#9210)

closes: #9180

* setup: reuses proto container (backport #9192) (#9203)

Co-authored-by: marbar3778 <[email protected]>
Co-authored-by: Amaury <[email protected]>
(cherry picked from commit 71b7fb829ed1d320264b3bc1eb4e995fc402a6a4)
Co-authored-by: Robert Zaremba <[email protected]>

* Add more details in error message for invalid vote option (#9185) (#9217)

Co-authored-by: Marko <[email protected]>
Co-authored-by: Amaury <[email protected]>
(cherry picked from commit 15edf3c38fe893751385489dda5b089e86fcbe77)

Co-authored-by: Devashish Dixit <[email protected]>

* x/gov/keeper: fix flaky TestPaginatedVotesQuery (backport #9223) (#9225)

* x/gov/keeper: fix flaky TestPaginatedVotesQuery (#9223)

When testing with -race, sometimes the random source generate the same
string for consecutive calls, causing duplicated voter address. So the
number of votes in DB is not 20.

To fix this, we ensure unique addresses are generated, by using a map
for tracking which one was produced, and skip the duplicated address and
generated new one. Testing with:

	go test -race -v -count=1000 -run=TestPaginatedVotesQuery

now passes.

Updates #9010

(cherry picked from commit 6ad84c5065ad50d6a2f1a2ee4f781d3fe68acf61)

# Conflicts:
#	x/gov/keeper/querier_test.go

* fi merge conflict

Co-authored-by: Cuong Manh Le <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* Keyring migrate command doc (#8979) (#9254)

Co-authored-by: SaReN <[email protected]>
Co-authored-by: Barrie Byron <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Amaury <[email protected]>
(cherry picked from commit d5f5fe68d0e93d271718ef13f40b74687ad0026a)
Co-authored-by: Andrei Ivasko <[email protected]>

* store/internal: validate keys before calling ProofsFromMap (backport #9235) (#9247)

Fixes #9233

(cherry picked from commit 711976efc13f135d334e41cd4a61bb490a8befa3)
Co-authored-by: Cuong Manh Le <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* Update chain migration docs to use v0.42 (#9090) (#9317)

* Update docs

* Tweak

Co-authored-by: Marko <[email protected]>
(cherry picked from commit 47c399fc16e486d45bd709d1e28d4f9951087644)

Co-authored-by: Amaury <[email protected]>

* Update IBC overview document to latest ICS-24 link (backport #9044) (#9316)

* Update overview.md (#9044)

Co-authored-by: SaReN <[email protected]>
(cherry picked from commit cad3987bd0b3b0af1a9401af155181758671cf07)

# Conflicts:
#	docs/ibc/overview.md

* Fix conflits

Co-authored-by: Calvin Lau <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* fix arm (#9345)

* Add client config subcommand to CLI (backport #8953) (#9255)

* Add client config subcommand to CLI (#8953)

* add client config

* addressed reviewers comments

* refactored,ready for review

* fixed linter issues and addressed reviewers comments

* Bump golangci-lint

* fix linter warnings

* fix some tests

Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Amaury <[email protected]>

* Fix build

Co-authored-by: Andrei Ivasko <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>

* fix SA5011 static check in ibc/../chain.go (#9333)

* Add env variable to cmd flags (backport #9040) (#9318)

* Add env variable to cmd flags (#9040)

* first draft

* add tests in config_test package

* refactored, all tests pass, r4r

* ready for review

* add envPrefix

* Update simapp/simd/cmd/root.go

Co-authored-by: Amaury <[email protected]>

* fix linter issues

* minor fixes

Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Amaury <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit a465ae182c9c715742336af798dee2bddfca7b3c)

# Conflicts:
#	client/context.go
#	simapp/simd/cmd/root.go

* Remove line

Co-authored-by: Andrei Ivasko <[email protected]>
Co-authored-by: Amaury M <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>

* Update Changelog and RL for v0.42.5 (#9350)

* Update Changelog and RL for v0.42.5

* Reword

* Tweak

* fix client config don't take effect (backport #9211) (#9360)

* fix client config don't take effect (#9211)

* fix client keyring config

* fix output flag of keys commads

Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Amaury <[email protected]>
(cherry picked from commit b4d1a5e5d6c9393c02c69fcbd34e9fd7ef4e0879)

# Conflicts:
#	client/keys/add.go

* Fix conflicts

Co-authored-by: yihuang <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* fix: add missing nil check in store.GetStore (#9354) (#9359)

* fix: add missing nil check in store.GetStore

* check nil in rootmulti as well

(cherry picked from commit b065e20f2bfb24312b4aa93091866741df6664d3)

Co-authored-by: Robert Zaremba <[email protected]>

* CLI: `query ibc-transfer escrow-address` (#9383)

* Fix the liveliness test Docker error (#9396) (#9402)

(cherry picked from commit 44a41383f4644bb0877b02cebbbcc4c6d822ee67)

Co-authored-by: Riccardo Montagnin <[email protected]>

* docs: fix broken interfaces links (backport #9448) (#9478)

* fix interfaces links (#9448)

Co-authored-by: ryanchrypto <[email protected]>
Co-authored-by: Amaury <[email protected]>
(cherry picked from commit 37fc37d853e477afadb540062f46be839f1946d3)

# Conflicts:
#	docs/building-modules/messages-and-queries.md
#	docs/building-modules/module-interfaces.md
#	docs/building-modules/module-manager.md
#	docs/building-modules/query-services.md

* resolve merge conflicts

* revert rename codec

Co-authored-by: Ryan Christoffersen <[email protected]>
Co-authored-by: ryanchrypto <[email protected]>

* backport: fix ibc genesis export bug (#9401)

* correctly set next identifier sequence in genesis export for clients/connections/channels

* add changelog

* fix linting (#9531)

* fix: testnet cli command update genesis supply (backport #9497) (#9513)

* fix: testnet cli command update genesis supply (#9497)

<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

closes: #9372

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

### This PR makes the `testnet` command update the bank genesis supply.

When using the `testnet` cli command, it creates nodes and balances, but does **not** update the supply. When using this in conjunction with `add-genesis-account` which **does** update the supply, it creates an invalid genesis file. This PR updates the testnet command to properly set the supply.

---

### 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...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/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
- [x] 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 179c819a9d542cb56c236454dc75d7120591438c)

# Conflicts:
#	simapp/simd/cmd/testnet.go

* fix errors

* changelog entry

Co-authored-by: Tyler <[email protected]>
Co-authored-by: technicallyty <[email protected]>

* feat: add header hash to `Context` (backport #9390) (#9395)

* feat: add header hash to `Context` (#9390)

* baseapp, types: add header hash to

* changelog

(cherry picked from commit 151d6c5e97e87d97f0f5872c35b43fc0a821f101)

# Conflicts:
#	CHANGELOG.md

* Fix conflicts

Co-authored-by: Federico Kunze <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* fix: x/gov deposits querier (Initial Deposit) (backport #9288) (#9453)

* fix: x/gov deposits querier (Initial Deposit) (#9288)

* copied from old PR

* fix errors

* add test

* Update x/gov/client/utils/query.go

Co-authored-by: Robert Zaremba <[email protected]>

* fix tests

* fix failing test

* add test

* update test

* fix tests

* fix deposit query

* fix test

* update tests

* add more tests

* address lint error

* address lint error

* review changes

Co-authored-by: Robert Zaremba <[email protected]>
(cherry picked from commit 66ee994ce4b5951a373131f0ee5bb0436f507ab4)

# Conflicts:
#	CHANGELOG.md
#	x/gov/client/cli/query.go
#	x/gov/client/testutil/cli_test.go
#	x/gov/client/utils/query.go

* resolve conflicts

Co-authored-by: MD Aleem <[email protected]>
Co-authored-by: aleem1314 <[email protected]>

* feat: add `RefundGas` function to `GasMeter` (backport #9403) (#9444)

* feat: add `RefundGas` function to `GasMeter` (#9403)

* feat: add RefundGas function to GasMeter

* changelog

* add comment about use case

* Apply suggestions from code review

Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Amaury <[email protected]>
(cherry picked from commit 90edeb67e29eb5335e406ab3ad56c5b4020740a0)

# Conflicts:
#	CHANGELOG.md

* conflicts

* fix

* Update CHANGELOG.md

Co-authored-by: Amaury <[email protected]>

Co-authored-by: Federico Kunze <[email protected]>
Co-authored-by: Federico Kunze <[email protected]>
Co-authored-by: Amaury <[email protected]>

* fix: Bank module init genesis optimization (backport #9428) (#9440)

* fix: Bank module init genesis optimization (#9428)

* optimize the bank module genesis initialization

* remove k.setBalances & k.clearBalances and update changelog

* fix lint

Co-authored-by: Aaron Craelius <[email protected]>
(cherry picked from commit 2ae78754889203a6611b478ae31c9e29aef1b45b)

# Conflicts:
#	CHANGELOG.md
#	x/bank/keeper/genesis.go
#	x/bank/keeper/send.go

* fix conflicts

* Update CHANGELOG.md

Co-authored-by: yys <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* fix: update simapp to use correct default broadcast mode (backport #9408) (#9527)

* fix: update simapp to use correct default broadcast mode (#9408)

(cherry picked from commit 80330ec17c9b11aae51f7c95d555878a5489b46d)

* Add changelog

Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* Backport: IBC query header/node-state fixes (#9385)

* fix ibc query header/node-state cmds

* changelog

Co-authored-by: Amaury M <[email protected]>

* build(deps): tendermint version (backport #9541) (#9542)

* build(deps): tendermint version (#9541)

* bump tendermint version

* go mod tidy

(cherry picked from commit e4673ad552a4d50f5e2026948b025abcede449cd)

* add changelog entry

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Marko <[email protected]>
Co-authored-by: Amaury <[email protected]>

* feat: add cosmos-sdk Version (backport #9429) (#9543)

* feat: add cosmos-sdk Version (#9429)

<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v                               ✰  Thanks for creating a PR! ✰
v    Before smashing the submit button please review the checkboxes.
v    If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  -->

## Description

Add CosmosSDKVersion to nodeInfo.

closes: #9420

(cherry picked from commit 105ad99a8ee2deeb136ab451cf21dd409390fbe2)

# Conflicts:
#	CHANGELOG.md
#	CONTRIBUTING.md
#	docs/core/proto-docs.md

* resolve conflicts

* resolve conflicts

Co-authored-by: Marko <[email protected]>

* fix: set header hash every block (backport #9552) (#9555)

* fix: set header hash every block (#9552)

## Description

- Sets the header hash on every block (ref #9390). Previously was only set during initialization for `deliverState`.
- Closes #9514

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### 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
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue 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 all author checklist items have been addressed
- [ ] confirmed that this PR does not change production code

(cherry picked from commit 81747b4a9ea33f8823b04478a7cbf772d2102d97)

# Conflicts:
#	CHANGELOG.md

* fix conflicts

Co-authored-by: Federico Kunze <[email protected]>
Co-authored-by: Federico Kunze <[email protected]>

* chore: Update release notes and Changelog for 0.42.6 (#9544)

* Update release notes

* Clean up changelog

* Fixed parse key issue (backport #9299) (#9561)

* Fixed parse key issue (#9299)

* Fixed parse key issue

* Added getconfig in root command

* uncommented changes in parse.go

(cherry picked from commit d7dd1d7affc02a819845802da540bc2742d82074)

# Conflicts:
#	simapp/simd/cmd/root.go

* Add changelog

Co-authored-by: Prathyusha Lakkireddy <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* feat: return trace value from baseapp (backport #9578) (#9580)

* feat: return trace value from baseapp (#9578)

## Description

Closes: #XXXX

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### 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
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue 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 all author checklist items have been addressed
- [ ] confirmed that this PR does not change production code

(cherry picked from commit bb61e2890f81c6061f5aba4d9c68fa99383ede2c)

# Conflicts:
#	CHANGELOG.md

* conflicts

Co-authored-by: Federico Kunze <[email protected]>
Co-authored-by: Federico Kunze <[email protected]>

* fix: Dumping upgrade info interrupted by cosmovisor (#9384) (#9608)

Solution:
- dumping upgrade info before emit `UPGRADED NEEDED` log which will
  cause cosmovisor to kill chain process

<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v                               ✰  Thanks for creating a PR! ✰
v    Before smashing the submit button please review the checkboxes.
v    If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  -->

## Description

The problematic procedure:

1. chain process output UPGRADE NEEDED log
2. cosmovisor see the message and kill the chain binary
3. chain process dump upgrade info and panic itself

the step 2 and 3 runs concurrently, so the dumping process can be interrupted by cosmovisor's terminate signal. The proposed solution is to dump upgrade info before emitting the log.
there are two problematic situation:
1. the upgrade info file is created, but content is not written or flushed before killed, when the chain process restart, it'll panic because of json parsing error.
2. the upgrade info file is not created at all, when the chain process restart, the [store upgrades](https://github.com/crypto-org-chain/chain-main/blob/master/app/app.go#L436) are not activated, will cause app hash mismatch error later on.

---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [x] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [x] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [x] Re-reviewed `Files changed` in the Github PR explorer
- [x] Review `Codecov Report` in the comment section below once CI passes

(cherry picked from commit 0540ed2f06781c1b5ad04d298b3b1e19c20ac90f)

Co-authored-by: yihuang <[email protected]>

* feat: Error on blank chain-id in multisign command (backport #9593) (#9605)

* feat: Error on blank chain-id in multisign command (#9593)

Error on `tx multisign` command if chain-id is blank. This is a common cause of signature verification failures when combining signatures and the error message doesn't provide any clues to this common cause.

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/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/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/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 f65b6c9363fc452db3ea3881a44e3b040bf766bf)

# Conflicts:
#	CHANGELOG.md

* fix conflicts

* less change diff

Co-authored-by: Zaki Manian <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* x/capability: Cap Initialization Fix (#9392)

* fix: correct ibc metric labels (#9645)

* backport https://github.com/cosmos/ibc-go/pull/223

* add changelog

* fix unnecessary changes

* fix: Fix IBC Transfer Event (#9640)

* fix event type

* CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Amaury M <[email protected]>

* chore: v0.42.7 release notes & changelog (#9661)

* chore: v0.42.7 release notes & changelog

* Add ibc

* fix(keyring): update keyring for kwallet fix (backport #9563) (#9579)

* fix(keyring): update keyring for kwallet fix (#9563)

## Description

Closes: #9562

---

### 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...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/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...

- [x] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] 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 e845a500880f5980d57cbd8b833d41e852e33ba6)

# Conflicts:
#	CHANGELOG.md
#	go.sum

* resolve conflicts

* Update CHANGELOG.md

Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Amaury <[email protected]>

* docs: add v0.43 release version option  (backport #9506) (#9677)

* docs: add v0.43 version option (#9506)

Co-authored-by: ryanchrypto <[email protected]>
(cherry picked from commit 325dabd83c66c23a1f2320783de552a14090a086)

# Conflicts:
#	docs/versions

* fix conflicts

Co-authored-by: Ryan Christoffersen <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* chore: Add missing entry in 0.42.7 Changelog (#9722)

* fix: support output flag on tx commands (backport #9717) (#9772)

* fix: support output flag on tx commands (#9717)

<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

Closes: #9684

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### 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/master/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/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/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 92535034d6fa16858394e1470e7ec1784ecc6ad4)

# Conflicts:
#	CHANGELOG.md

* Fix changelog

Co-authored-by: Sai Kumar <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* feat: Query txs by signature and by address+seq (backport #9750) (#9783)

* feat: Query txs by signature and by address+seq (#9750)

<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

Closes: #9741

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### 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/master/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/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/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 7c194340006b186c99b1a8d6417f621f9d480efd)

# Conflicts:
#	CHANGELOG.md
#	x/auth/client/cli/cli_test.go
#	x/auth/client/cli/query.go

* Fix conflicts

* Fix build

* Fix IBC test

* use createBankMsg from master

Co-authored-by: Amaury <[email protected]>

* fix: hardcoded ledger algo on `keys add` (backport #9766) (#9804)

* fix: hardcoded ledger algo on `keys add` (#9766)

<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

Closes: #9734

cc: @jleni

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### 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...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] 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...

- [x] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] 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
- [x] reviewed tests and test coverage
- [ ] manually tested (if applicable)

(cherry picked from commit f1e64878d8a66e3343112605ad19e48306b77273)

# Conflicts:
#	CHANGELOG.md

* fix conflict

Co-authored-by: Federico Kunze Küllmer <[email protected]>
Co-authored-by: Amaury M <[email protected]>

* chore: Add Changelog and Release Notes for v0.42.8 (#9807)

* chore: Add Changelog and Release Notes for v0.42.8

* Change date

* feat: Improve withdraw-all-rewards UX (backport #9781) (#9825)

* feat: Improve withdraw-all-rewards UX (#9781)

## Description
Related to #9489, this PR improves the UX when using the `withdraw-all-rewards` command by forcing the broadcast mode to `block` if the chunk size is greater than 0. This will ensure that the transactions do not fail even if the user uses invalid broadcast modes for this command (`sync` and `async`).

---

### 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...

- [x] 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
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] 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 90157fc5f47bb1f347f0a0f61d250a72b950df3f)

# Conflicts:
#	CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Riccardo Montagnin <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>

* fix: Capability Issue on Restart, Backport to v0.42 (#9835)

* implement BeginBlock fix

* add changelog

* fix lint

* address reviews

* Update CHANGELOG.md

Co-authored-by: Aleksandr Bezobchuk <[email protected]>

* address reviews

* Apply suggestions from code review

Co-authored-by: Robert Zaremba <[email protected]>

* move store check

* add api breaking changelog

* fix lint

Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>

* Fixed the --recover flag not working properly inside the init command (#9201) (#9850)

Co-authored-by: Alessio Treglia <[email protected]>
(cherry picked from commit fdbc32e50c93689ec7352c11edb6d93f33d47a6c)

Co-authored-by: Riccardo Montagnin <[email protected]>

* chore: prepare 0.42.9 release (#9852)

* prepare 0.42.9 release

* add 9201 to changelog

* feat: async store pruning

* perf: made query concurrent

* perf: precaching on iavl cache, cache interface to experiment and compare different caches

* perf: updated prefetch launch mechanism, better prefetcher for set operation

* perf: prefetch iavl nodes when receiving address not present

* chore: prefetch on by default

* fix: added freecache & xxhash modules

* fix: test error

* fix: added freecache & xxhash modules

* style: updated typo in comment

* style: made Stats() consistent in style

* build(deps): bump github.com/prometheus/client_golang (#417)

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.11.0 to 1.12.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.11.0...v1.12.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: bump up iavl version

* chore: seperate prefetch.go, style fixes

* fix: incorrect panic on cachemulti store write

* style: lint error

* fix: go test race

* ci: no prefetch for race test

* chore: bump up iavl

* test: iavl store cache tests

* chore: bump up iavl

* ci: reduced number of goroutines for race test

* ci: more prefetch coverage

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Charly <[email protected]>
Co-authored-by: Gianguido Sora <[email protected]>
Co-authored-by: Emmanuel T Odeke <[email protected]>
Co-authored-by: Charly <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Jonathan Gimeno <[email protected]>
Co-authored-by: Amaury <[email protected]>
Co-authored-by: Anil Kumar Kammari <[email protected]>
Co-authored-by: Cyrus Goh <[email protected]>
Co-authored-by: Pash <[email protected]>
Co-authored-by: MD Aleem <[email protected]>
Co-authored-by: aleem1314 <[email protected]>
Co-authored-by: Hanjun Kim <[email protected]>
Co-authored-by: Barrie Byron <[email protected]>
Co-authored-by: Rikard Hjort <[email protected]>
Co-authored-by: Cory <[email protected]>
Co-authored-by: atheeshp <[email protected]>
Co-authored-by: SaReN <[email protected]>
Co-authored-by: Cuong Manh Le <[email protected]>
Co-authored-by: colin axnér <[email protected]>
Co-authored-by: marbar3778 <[email protected]>
Co-authored-by: Devashish Dixit <[email protected]>
Co-authored-by: Cuong Manh Le <[email protected]>
Co-authored-by: Andrei Ivasko <[email protected]>
Co-authored-by: Calvin Lau <[email protected]>
Co-authored-by: yihuang <[email protected]>
Co-authored-by: Ethan Buchman <[email protected]>
Co-authored-by: Riccardo Montagnin <[email protected]>
Co-authored-by: Ryan Christoffersen <[email protected]>
Co-authored-by: ryanchrypto <[email protected]>
Co-authored-by: Tyler <[email protected]>
Co-authored-by: technicallyty <[email protected]>
Co-authored-by: Federico Kunze <[email protected]>
Co-authored-by: Federico Kunze <[email protected]>
Co-authored-by: yys <[email protected]>
Co-authored-by: Prathyusha Lakkireddy <[email protected]>
Co-authored-by: Zaki Manian <[email protected]>
Co-authored-by: Aditya <[email protected]>
Co-authored-by: Sai Kumar <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Co-authored-by: zemyblue <[email protected]>
Co-authored-by: iproudhon <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Charly <[email protected]>
Co-authored-by: Gianguido Sora <[email protected]>
Co-authored-by: Emmanuel T Odeke <[email protected]>
Co-authored-by: Charly <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
Co-authored-by: Alessio Treglia <[email protected]>
Co-authored-by: Jonathan Gimeno <[email protected]>
Co-authored-by: Amaury <[email protected]>
Co-authored-by: Anil Kumar Kammari <[email protected]>
Co-authored-by: Cyrus Goh <[email protected]>
Co-authored-by: Pash <[email protected]>
Co-authored-by: MD Aleem <[email protected]>
Co-authored-by: aleem1314 <[email protected]>
Co-authored-by: Hanjun Kim <[email protected]>
Co-authored-by: Barrie Byron <[email protected]>
Co-authored-by: Rikard Hjort <[email protected]>
Co-authored-by: Cory <[email protected]>
Co-authored-by: atheeshp <[email protected]>
Co-authored-by: SaReN <[email protected]>
Co-authored-by: Cuong Manh Le <[email protected]>
Co-authored-by: colin axnér <[email protected]>
Co-authored-by: marbar3778 <[email protected]>
Co-authored-by: Devashish Dixit <[email protected]>
Co-authored-by: Cuong Manh Le <[email protected]>
Co-authored-by: Andrei Ivasko <cyberbono3@gm…
  • Loading branch information
Show file tree
Hide file tree
Showing 209 changed files with 4,701 additions and 674 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: golangci/golangci-lint-action@master
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.28
version: v1.39
args: --timeout 10m
github-token: ${{ secrets.GITHUB_TOKEN }}
if: env.GIT_DIFF
49 changes: 9 additions & 40 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ jobs:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: test & coverage report creation
env:
USE_PRELOAD: 1,4
SAVE_BRANCH_LAUNCH_DEPTH: 1
run: |
cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 30m -coverprofile=${{ matrix.part }}profile.out -covermode=atomic -tags='norace ledger test_ledger_mock goleveldb'
if: env.GIT_DIFF
Expand Down Expand Up @@ -212,59 +215,25 @@ jobs:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: test & coverage report creation
env:
USE_PREFETCH: NO
USE_PRELOAD: 1,4
SAVE_BRANCH_LAUNCH_DEPTH: 1
run: |
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -json -timeout 30m -race -tags='cgo ledger test_ledger_mock goleveldb' | tee ${{ matrix.part }}-race-output.txt
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -timeout 30m -race -tags='cgo ledger test_ledger_mock goleveldb'
if: env.GIT_DIFF
- uses: actions/upload-artifact@v2
with:
name: "${{ github.sha }}-${{ matrix.part }}-race-output"
path: ./${{ matrix.part }}-race-output.txt

race-detector-report:
runs-on: ubuntu-latest
needs: [test-race, install-tparse]
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/download-artifact@v2
with:
name: "${{ github.sha }}-00-race-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
with:
name: "${{ github.sha }}-01-race-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
with:
name: "${{ github.sha }}-02-race-output"
if: env.GIT_DIFF
- uses: actions/download-artifact@v2
with:
name: "${{ github.sha }}-03-race-output"
if: env.GIT_DIFF
- uses: actions/[email protected]
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tparse-binary
if: env.GIT_DIFF
- name: Generate test report (go test -race)
run: cat ./*-race-output.txt | ~/go/bin/tparse
if: env.GIT_DIFF

# TODO ebony: enable this test
# liveness-test:
# runs-on: ubuntu-latest
# timeout-minutes: 10
# steps:
# - uses: actions/checkout@v2
# - uses: actions/[email protected].5
# - uses: actions/[email protected].3
# with:
# go-version: 1.15
# - uses: technote-space/[email protected]
Expand Down
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ issues:
- text: "ST1016:"
linters:
- stylecheck
- text: "SA1019: codec.LegacyAmino is deprecated"
linters:
- staticcheck
max-issues-per-linter: 10000
max-same-issues: 10000

Expand Down
1,057 changes: 1,056 additions & 1 deletion CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ All PRs require two Reviews before merge (except docs changes, or variable name-
If you open a PR on the LBM SDK, it is mandatory to update the relevant documentation in /docs.

- If your change relates to the core SDK (baseapp, store, ...), please update the `docs/basics/`, `docs/core/` and/or `docs/building-modules/` folders.
- If your changes relate to the core of the CLI or Light-client (not specifically to module's CLI/Rest), please modify the `docs/interfaces/` folder.
- If your changes relate to the core of the CLI (not specifically to module's CLI/Rest), please modify the `docs/run-node/` folder.
- If your changes relate to a module, please update the module's spec in `x/moduleName/docs/spec/`.

## Forking
Expand Down
30 changes: 20 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -416,30 +416,40 @@ easyjson-gen:
### Protobuf ###
###############################################################################

containerProtoVer=v0.2
containerProtoImage=tendermintdev/sdk-proto-gen:$(containerProtoVer)
containerProtoGen=cosmos-sdk-proto-gen-$(containerProtoVer)
containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer)
containerProtoFmt=cosmos-sdk-proto-fmt-$(containerProtoVer)

proto-all: proto-format proto-lint proto-gen

proto-gen:
@echo "Generating Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen.sh

proto-format:
@echo "Formatting Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace \
--workdir /workspace tendermintdev/docker-build-proto \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
@if $(DOCKER) ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then $(DOCKER) start -a $(containerProtoGen); else $(DOCKER) run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
sh ./scripts/protocgen.sh; fi

# This generates the SDK's custom wrapper for google.protobuf.Any. It should only be run manually when needed
proto-gen-any:
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen-any.sh
@echo "Generating Protobuf Any"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) sh ./scripts/protocgen-any.sh

proto-swagger-gen:
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protoc-swagger-gen.sh
@echo "Generating Protobuf Swagger"
@if $(DOCKER) ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenSwagger}$$"; then $(DOCKER) start -a $(containerProtoGenSwagger); else $(DOCKER) run --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
sh ./scripts/protoc-swagger-gen.sh; fi

proto-format:
@echo "Formatting Protobuf files"
@if $(DOCKER) ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoFmt}$$"; then $(DOCKER) start -a $(containerProtoFmt); else $(DOCKER) run --name $(containerProtoFmt) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {}; fi

proto-lint:
@$(DOCKER_BUF) lint --error-format=json

proto-check-breaking:
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main
@$(DOCKER_BUF) check breaking --against $(HTTPS_GIT)#branch=main


TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.0-rc6/proto/tendermint
GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
Expand Down
22 changes: 20 additions & 2 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"github.com/line/lbm-sdk/telemetry"
sdk "github.com/line/lbm-sdk/types"
sdkerrors "github.com/line/lbm-sdk/types/errors"

iavlstore "github.com/line/lbm-sdk/store/iavl"
)

// InitChain implements the ABCI interface. It runs the initialization logic
Expand Down Expand Up @@ -176,9 +178,21 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg
gasMeter = sdk.NewInfiniteGasMeter()
}

app.deliverState.ctx = app.deliverState.ctx.WithBlockGasMeter(gasMeter).
// NOTE: header hash is not set in NewContext, so we manually set it here

app.deliverState.ctx = app.deliverState.ctx.
WithVoteInfos(app.voteInfos).
WithConsensusParams(app.GetConsensusParams(app.deliverState.ctx))
WithConsensusParams(app.GetConsensusParams(app.deliverState.ctx)).
WithBlockGasMeter(gasMeter).
WithHeaderHash(req.Hash)

// we also set block gas meter to checkState in case the application needs to
// verify gas consumption during (Re)CheckTx
if app.checkState != nil {
app.checkState.ctx = app.checkState.ctx.
WithBlockGasMeter(gasMeter).
WithHeaderHash(req.Hash)
}

if app.beginBlocker != nil {
res = app.beginBlocker(app.deliverState.ctx, req)
Expand Down Expand Up @@ -262,11 +276,13 @@ func (app *BaseApp) CheckTxAsync(req abci.RequestCheckTx, callback abci.CheckTxC
func (app *BaseApp) BeginRecheckTx(req abci.RequestBeginRecheckTx) abci.ResponseBeginRecheckTx {
// NOTE: This is safe because Ostracon holds a lock on the mempool for Rechecking.
app.setCheckState(req.Header)
iavlstore.PausePrefetcher()
return abci.ResponseBeginRecheckTx{Code: abci.CodeTypeOK}
}

// EndRecheckTx implements the ABCI interface.
func (app *BaseApp) EndRecheckTx(req abci.RequestEndRecheckTx) abci.ResponseEndRecheckTx {
iavlstore.ResumePrefetcher()
return abci.ResponseEndRecheckTx{Code: abci.CodeTypeOK}
}

Expand Down Expand Up @@ -324,7 +340,9 @@ func (app *BaseApp) Commit() (res abci.ResponseCommit) {
// The write to the DeliverTx state writes all state transitions to the root
// MultiStore (app.cms) so when Commit() is called is persists those values.
app.deliverState.ms.Write()
iavlstore.PausePrefetcher()
commitID := app.cms.Commit()
iavlstore.ResumePrefetcher()
app.logger.Info("commit synced", "commit", fmt.Sprintf("%X", commitID))

// iavl, db & disk stats
Expand Down
5 changes: 5 additions & 0 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ func (app *BaseApp) Logger() log.Logger {
return app.logger
}

// Trace returns the boolean value for logging error stack traces.
func (app *BaseApp) Trace() bool {
return app.trace
}

// MsgServiceRouter returns the MsgServiceRouter of a BaseApp.
func (app *BaseApp) MsgServiceRouter() *MsgServiceRouter { return app.msgServiceRouter }

Expand Down
6 changes: 5 additions & 1 deletion baseapp/baseapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,11 @@ func TestCheckTx(t *testing.T) {

// If a block is committed, CheckTx state should be reset.
header := ocproto.Header{Height: 1}
app.BeginBlock(abci.RequestBeginBlock{Header: header})
app.BeginBlock(abci.RequestBeginBlock{Header: header, Hash: []byte("hash")})

require.NotNil(t, app.checkState.ctx.BlockGasMeter(), "block gas meter should have been set to checkState")
require.NotEmpty(t, app.checkState.ctx.HeaderHash())

app.EndBlock(abci.RequestEndBlock{})
app.Commit()

Expand Down
16 changes: 16 additions & 0 deletions baseapp/grpcrouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package baseapp
import (
"fmt"
"reflect"
"sync"

gogogrpc "github.com/gogo/protobuf/grpc"
abci "github.com/line/ostracon/abci/types"
Expand All @@ -20,6 +21,7 @@ var protoCodec = encoding.GetCodec(proto.Name)

// GRPCQueryRouter routes ABCI Query requests to GRPC handlers
type GRPCQueryRouter struct {
lck sync.Mutex
routes map[string]GRPCQueryHandler
// returnTypes is a map of FQ method name => its return type. It is used
// for cache purposes: the first time a method handler is run, we save its
Expand All @@ -41,6 +43,7 @@ var _ gogogrpc.Server = &GRPCQueryRouter{}
// NewGRPCQueryRouter creates a new GRPCQueryRouter
func NewGRPCQueryRouter() *GRPCQueryRouter {
return &GRPCQueryRouter{
lck: sync.Mutex{},
returnTypes: map[string]reflect.Type{},
routes: map[string]GRPCQueryHandler{},
}
Expand All @@ -53,6 +56,8 @@ type GRPCQueryHandler = func(ctx sdk.Context, req abci.RequestQuery) (abci.Respo
// Route returns the GRPCQueryHandler for a given query route path or nil
// if not found
func (qrt *GRPCQueryRouter) Route(path string) GRPCQueryHandler {
qrt.lck.Lock()
defer qrt.lck.Unlock()
handler, found := qrt.routes[path]
if !found {
return nil
Expand All @@ -66,6 +71,9 @@ func (qrt *GRPCQueryRouter) Route(path string) GRPCQueryHandler {
// This functions PANICS:
// - if a protobuf service is registered twice.
func (qrt *GRPCQueryRouter) RegisterService(sd *grpc.ServiceDesc, handler interface{}) {
qrt.lck.Lock()
defer qrt.lck.Unlock()

// adds a top-level query handler based on the gRPC service name
for _, method := range sd.Methods {
fqName := fmt.Sprintf("/%s/%s", sd.ServiceName, method.MethodName)
Expand Down Expand Up @@ -104,9 +112,11 @@ func (qrt *GRPCQueryRouter) RegisterService(sd *grpc.ServiceDesc, handler interf
// If it's the first time we call this handler, then we save
// the return type of the handler in the `returnTypes` map.
// The return type will be used for decoding subsequent requests.
qrt.lck.Lock()
if _, found := qrt.returnTypes[fqName]; !found {
qrt.returnTypes[fqName] = reflect.TypeOf(res)
}
qrt.lck.Unlock()

if err != nil {
return abci.ResponseQuery{}, err
Expand Down Expand Up @@ -135,6 +145,9 @@ func (qrt *GRPCQueryRouter) RegisterService(sd *grpc.ServiceDesc, handler interf
// SetInterfaceRegistry sets the interface registry for the router. This will
// also register the interface reflection gRPC service.
func (qrt *GRPCQueryRouter) SetInterfaceRegistry(interfaceRegistry codectypes.InterfaceRegistry) {
// qrt.lck.Lock()
// defer qrt.lck.Unlock()

qrt.interfaceRegistry = interfaceRegistry

// Once we have an interface registry, we can register the interface
Expand All @@ -150,6 +163,9 @@ func (qrt *GRPCQueryRouter) SetInterfaceRegistry(interfaceRegistry codectypes.In
// guaranteed to be found if it's retrieved **after** the method handler ran at
// least once. If not, then a logic error is return.
func (qrt *GRPCQueryRouter) returnTypeOf(method string) (reflect.Type, error) {
qrt.lck.Lock()
defer qrt.lck.Unlock()

returnType, found := qrt.returnTypes[method]
if !found {
return nil, sdkerrors.Wrapf(sdkerrors.ErrLogic, "cannot find %s return type", method)
Expand Down
24 changes: 21 additions & 3 deletions client/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"strings"

"github.com/line/ostracon/libs/cli"
rpchttp "github.com/line/ostracon/rpc/client/http"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -98,6 +97,10 @@ func ReadPersistentCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Cont
homeDir, _ := flagSet.GetString(flags.FlagHome)
clientCtx = clientCtx.WithHomeDir(homeDir)
}
if !clientCtx.Simulate || flagSet.Changed(flags.FlagDryRun) {
dryRun, _ := flagSet.GetBool(flags.FlagDryRun)
clientCtx = clientCtx.WithSimulation(dryRun)
}

if clientCtx.KeyringDir == "" || flagSet.Changed(flags.FlagKeyringDir) {
keyringDir, _ := flagSet.GetString(flags.FlagKeyringDir)
Expand All @@ -120,7 +123,7 @@ func ReadPersistentCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Cont
keyringBackend, _ := flagSet.GetString(flags.FlagKeyringBackend)

if keyringBackend != "" {
kr, err := newKeyringFromFlags(clientCtx, keyringBackend)
kr, err := NewKeyringFromBackend(clientCtx, keyringBackend)
if err != nil {
return clientCtx, err
}
Expand All @@ -134,7 +137,7 @@ func ReadPersistentCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Cont
if rpcURI != "" {
clientCtx = clientCtx.WithNodeURI(rpcURI)

client, err := rpchttp.New(rpcURI, "/websocket")
client, err := NewClientFromNode(rpcURI)
if err != nil {
return clientCtx, err
}
Expand Down Expand Up @@ -254,6 +257,21 @@ func readTxCommandFlags(clientCtx Context, flagSet *pflag.FlagSet) (Context, err
return clientCtx, nil
}

// ReadHomeFlag checks if home flag is changed.
// If this is a case, we update HomeDir field of Client Context
/* Discovered a bug with Cory
./build/simd init andrei --home ./test
cd test/config there is no client.toml configuration file
*/
func ReadHomeFlag(clientCtx Context, cmd *cobra.Command) Context {
if cmd.Flags().Changed(flags.FlagHome) {
rootDir, _ := cmd.Flags().GetString(flags.FlagHome)
clientCtx = clientCtx.WithHomeDir(rootDir)
}

return clientCtx
}

// GetClientQueryContext returns a Context from a command with fields set based on flags
// defined in AddQueryFlagsToCmd. An error is returned if any flag query fails.
//
Expand Down
Loading

0 comments on commit 7c10e90

Please sign in to comment.