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

Add clear function to Enumerable{Set,Map} #5486

Merged
merged 12 commits into from
Feb 10, 2025

Conversation

arr00
Copy link
Contributor

@arr00 arr00 commented Feb 3, 2025

Adds a new clear function to the EnumerableSet for each type of enumerable set. This function clears the set in reverse order (to save on gas). It does run in O(n) so developers should use it carefully and only when they are sure a set can not grow unbounded. I put a warning in the natspec for this.

PR Checklist

  • Tests
  • Documentation
  • Changeset entry (run npx changeset add)

Copy link

changeset-bot bot commented Feb 3, 2025

🦋 Changeset detected

Latest commit: a1b7066

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openzeppelin-solidity Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@arr00 arr00 requested review from Amxx and ernestognw February 3, 2025 19:28
@arr00 arr00 changed the title Add clear function to EnumerableSets Add clear function to Enumerable{Set,Map} Feb 4, 2025
Amxx
Amxx previously approved these changes Feb 4, 2025
@arr00 arr00 requested a review from Amxx February 10, 2025 16:20
@Amxx Amxx merged commit 3658269 into OpenZeppelin:master Feb 10, 2025
17 checks passed
@arr00 arr00 deleted the feat/clear-enumerable-set branch February 11, 2025 02:59
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.

2 participants