Skip to content

Refactor EnumerableSet and EnumerableMap to support more types#5558

Closed
Amxx wants to merge 7 commits intoOpenZeppelin:masterfrom
Amxx:refactor/enumerable
Closed

Refactor EnumerableSet and EnumerableMap to support more types#5558
Amxx wants to merge 7 commits intoOpenZeppelin:masterfrom
Amxx:refactor/enumerable

Conversation

@Amxx
Copy link
Collaborator

@Amxx Amxx commented Mar 5, 2025

This PR refactors EnumerableSet and EnumerableMap generation:

  • use a single config file Enumerable.opts.js to generate all type descriptions
  • use rich type descriptions, including support of memory location
  • add new variants
    • StringSet
    • BytesSet
    • BytesToUintMap (usefull for something like an ERC-7093 contract for guardian->weight)
    • StringToStringMap (usefull for somthing like an ERC-7786 gateway/adaptor for caip2->address)

PR Checklist

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

Note

In 6.0 I'd remove the current design where the Bytes32Set and Bytes32ToBytes32Map are reused under the hood for other value types. This will allow us to reduce the number of variants of the generation functions.

@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2025

🦋 Changeset detected

Latest commit: 5fd07fd

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 requested review from arr00 and ernestognw March 5, 2025 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant