From 63d768c257865c95eeebe16c935c6a95bba954d5 Mon Sep 17 00:00:00 2001
From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com>
Date: Fri, 10 Jun 2022 10:28:25 +0200
Subject: [PATCH] fix: update index of crisis invariant check logs (backport
#12208) (#12210)
* fix: update index of crisis invariant check logs (#12208)
## Description
the info log messages describing invariant checks use the index to state
progress (eg. `asserting crisis invariants inv=0/15`). this simple change
makes them 1-indexed (eg. `asserting crisis invariants inv=1/15`).
example before:
Closes: #XXXX
---
### 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 - N/A
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification - N/A
- [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - N/A
- [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - N/A
- [x] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc) - N/A
- [x] updated the relevant documentation or specification - N/A
- [x] reviewed "Files changed" and left comments if necessary - N/A
- [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...
- [ ] 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 907df327edf731147a9cd74d4b3ac19bec212822)
# Conflicts:
# CHANGELOG.md
* fix conflict
Co-authored-by: Robert Pirtle
Co-authored-by: Julien Robert
---
CHANGELOG.md | 4 ++++
x/crisis/keeper/keeper.go | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 82975b4fafe7..bb7d44dc9ac4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -37,6 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
## [Unreleased]
+### Bug Fixes
+
+* (x/crisis) [#12208](https://github.com/cosmos/cosmos-sdk/pull/12208) Fix progress index of crisis invariant assertion logs.
+
## [v0.45.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.5) - 2022-06-09
### Improvements
diff --git a/x/crisis/keeper/keeper.go b/x/crisis/keeper/keeper.go
index b9c563d5293d..b52ad7352cd4 100644
--- a/x/crisis/keeper/keeper.go
+++ b/x/crisis/keeper/keeper.go
@@ -76,7 +76,7 @@ func (k Keeper) AssertInvariants(ctx sdk.Context) {
invarRoutes := k.Routes()
n := len(invarRoutes)
for i, ir := range invarRoutes {
- logger.Info("asserting crisis invariants", "inv", fmt.Sprint(i, "/", n), "name", ir.FullRoute())
+ logger.Info("asserting crisis invariants", "inv", fmt.Sprint(i+1, "/", n), "name", ir.FullRoute())
if res, stop := ir.Invar(ctx); stop {
// TODO: Include app name as part of context to allow for this to be
// variable.