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

Bound lookup in arrays with duplicate #4842

Merged
merged 13 commits into from
Jan 29, 2024

Conversation

Amxx
Copy link
Collaborator

@Amxx Amxx commented Jan 18, 2024

This PR does the following:

  • Deprecate Array.findUpperBound which does not match the "upper bound" function in other standard libraries
  • Add Array.lowerBound and Array.upperBound that perform lower and upper bound lookup in storage arrays (with support for duplicates).
  • Add Array.lowerBoundMemory and Array.upperBoundMemory that perform lower and upper bound lookup in memory arrays (with support for duplicates).

Fixes #4744
Fixes LIB-1182
Fixes LIB-1188

PR Checklist

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

Copy link

changeset-bot bot commented Jan 18, 2024

🦋 Changeset detected

Latest commit: 7c9f21b

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

@Amxx Amxx added the feature New contracts, functions, or helpers. label Jan 18, 2024
@Amxx Amxx added this to the 5.1 milestone Jan 18, 2024
@Amxx Amxx requested a review from ernestognw January 18, 2024 15:30
@Amxx Amxx mentioned this pull request Jan 29, 2024
3 tasks
Copy link
Member

@ernestognw ernestognw left a comment

Choose a reason for hiding this comment

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

Will continue reviewing

contracts/utils/Arrays.sol Outdated Show resolved Hide resolved
test/utils/Arrays.test.js Show resolved Hide resolved
contracts/utils/Arrays.sol Outdated Show resolved Hide resolved
contracts/utils/Arrays.sol Outdated Show resolved Hide resolved
contracts/utils/Arrays.sol Outdated Show resolved Hide resolved
contracts/utils/Arrays.sol Outdated Show resolved Hide resolved
test/utils/Arrays.test.js Outdated Show resolved Hide resolved
Copy link
Member

@ernestognw ernestognw left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New contracts, functions, or helpers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a findLowerBound function to the Arrays library
3 participants