Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use CacheContext() in AssertInvariants() #14588

Merged
merged 7 commits into from
Jan 16, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions x/crisis/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ func (k *Keeper) AssertInvariants(ctx sdk.Context) {
n := len(invarRoutes)
for i, ir := range invarRoutes {
logger.Info("asserting crisis invariants", "inv", fmt.Sprint(i+1, "/", n), "name", ir.FullRoute())

ctx, _ := ctx.CacheContext()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add CacheContext() inside the loop, otherwise, an invariant may affect the other's precondition.

0Tech marked this conversation as resolved.
Show resolved Hide resolved
if res, stop := ir.Invar(ctx); stop {
0Tech marked this conversation as resolved.
Show resolved Hide resolved
// TODO: Include app name as part of context to allow for this to be
// variable.
Expand Down