-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
fix: Do not call Remove during Walk #24044
base: release/v0.53.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
lint and tests failing here |
Do you want me to fix it in this PR? or create a new issue? |
yeah, we should fix in this PR |
@aljo242 I've fixed them. Please review again when you have time.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good - would just like to keep the diff smaller in the Endblocker. Thanks so much for all of the lint fixes!!!
Co-authored-by: Alex | Interchain Labs <[email protected]>
@@ -24,35 +24,45 @@ | |||
// delete dead proposals from store and returns theirs deposits. | |||
// A proposal is dead when it's inactive and didn't get enough deposit on time to get into voting phase. | |||
rng := collections.NewPrefixUntilPairRange[time.Time, uint64](ctx.BlockTime()) | |||
err := keeper.InactiveProposalsQueue.Walk(ctx, rng, func(key collections.Pair[time.Time, uint64], _ uint64) (bool, error) { | |||
proposal, err := keeper.Proposals.Get(ctx, key.K2()) | |||
iter, err := keeper.InactiveProposalsQueue.Iterate(ctx, rng) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
return err | ||
} | ||
|
||
inactiveProps, err := iter.KeyValues() |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
} | ||
|
||
for _, prop := range inactiveProps { | ||
proposal, err := keeper.Proposals.Get(ctx, prop.Key.K2()) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
|
||
// fetch active proposals whose voting periods have ended (are passed the block time) | ||
rng = collections.NewPrefixUntilPairRange[time.Time, uint64](ctx.BlockTime()) | ||
iter, err = keeper.ActiveProposalsQueue.Iterate(ctx, rng) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
|
||
return false, nil | ||
}) | ||
activeProps, err := iter.KeyValues() |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
err = keeper.ActiveProposalsQueue.Walk(ctx, rng, func(key collections.Pair[time.Time, uint64], _ uint64) (bool, error) { | ||
proposal, err := keeper.Proposals.Get(ctx, key.K2()) | ||
for _, prop := range activeProps { | ||
proposal, err := keeper.Proposals.Get(ctx, prop.Key.K2()) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Closes: #23806
backport:#19833 , #19851
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...
!
in the type prefix if API or client breaking changeCHANGELOG.md
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.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...