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: Expiration bucket check on cover expiration #878

Merged

Conversation

shark0der
Copy link
Collaborator

@shark0der shark0der commented Jun 16, 2023

Context

Due to a lax check on the expiration bucket id the expire cover could revert with an underflow since the allocations could have been already freed up.

Changes proposed in this pull request

This PR moves corrects the check and moves it earlier in the code to fail with a custom error instead.

Test plan

Added a new test that:

  1. Allocates a short cover in the current bucket
  2. Moves to the next bucket
  3. Tries to expire

Before the fix it will fail with an underflow, with the fix it fails with a custom error.

Checklist

  • Rebased the base branch
  • Attached corresponding Github issue
  • Prefixed the name with the type of change (i.e. feat, chore, test)
  • Performed a self-review of my own code
  • Followed the style guidelines of this project
  • Made corresponding changes to the documentation
  • Didn't generate new warnings
  • Didn't generate failures on existing tests
  • Added tests that prove my fix is effective or that my feature works

Review

When reviewing a PR, please indicate intention in comments using the following emojis:

  • 🍰 = Nice to have but not essential.
  • 💡 = Suggestion or a comment based on personal opinion
  • 🔨 = I believe this should be changed.
  • 🤔 = I don’t understand something, do you mind giving me more context?
  • 🚀 = Feedback

@shark0der shark0der changed the title Add failing test for cover expiration when the bucket was already pro… Fix: Expiration bucket check on cover expiration Jun 16, 2023
@shark0der shark0der marked this pull request as ready for review June 16, 2023 15:01
Copy link
Contributor

@danoctavian danoctavian left a comment

Choose a reason for hiding this comment

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

LGTM

@shark0der shark0der merged commit 7e995dd into release-candidate Jun 19, 2023
5 checks passed
@shark0der shark0der deleted the fix/expiration-bucket-check-on-cover-expiration branch June 19, 2023 09:41
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.

None yet

4 participants