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

fix IterateInitTimeoutTimestamp #549

Merged
merged 3 commits into from
Dec 6, 2022
Merged

Conversation

MSalopek
Copy link
Contributor

@MSalopek MSalopek commented Dec 2, 2022

Description

provider.EndBlockCCR removes chains which timed out. However, when iterating through all chains, it stops as soon as it finds one chain that did not time out, falsely assuming that the chains are ordered by their time of arrival <=> expiration time.

Linked issues

Closes: #513

Type of change

Please delete options that are not relevant.

  • Non-breaking changes
  • Updates in store keepers or store keys

How was the feature tested?

  • Unit tests

Other information

This bug was found during code audit.

Checklist:

Please delete options that are not relevant.

  • Relevant issus are linked
  • Tests are passing (make test)
  • PR satisfies closing criteria defined in issue (remove if not applicable or issue has no criteria)
  • Added iterators follow SDK pattern (IterateX(ctx sdk.Context, cb func(arg1, arg2) (stop bool)))

@@ -332,11 +332,9 @@ func (k Keeper) EndBlockCCR(ctx sdk.Context) {
if currentTimeUint64 > ts {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @MSalopek- can you add a comment on IterateInitTimeoutTimestamp (in different file), making it clear that it is not in order?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also open an issue on the repo (put it in the v1.1 milestone) to make IterateInitTimeoutTimestamp go in order? That would be a little better because it would avoid uneccesary iteration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can do: #561. Can't tag it as 1.1 though, maybe I'm missing some access rights?

Are we expecting loads of chains to be removed due to timeouts? If we're iterating 5-20 items this does not seem worthwhile.

@MSalopek MSalopek force-pushed the masa/513-fix-consumer-rm-prop-iter branch from 0313d92 to 287450e Compare December 6, 2022 09:26
@mpoke mpoke merged commit 262780b into main Dec 6, 2022
@mpoke mpoke deleted the masa/513-fix-consumer-rm-prop-iter branch December 6, 2022 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consumer chain removal sub-protocol fails to remove some chains
4 participants