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

Procedurally generate packing libraries #5051

Closed

Conversation

ernestognw
Copy link
Member

@ernestognw ernestognw commented May 21, 2024

Description

This PR extends the new (unreleased) Packing library to be automatically generated. It allows for packing values into bytes32, bytes16, bytes8 and bytes4.

I decided to split the contract in PackingBytes32, PackingBytes16, PackingBytes8 and PackingBytes4. The reason is that when function identifiers collide (i.e. there are multiple definitions of at and pack so the compiler can't dissambiguate).

The alternative is to give users instructions of how to apply the using syntax to only apply the functions to those types intended. This is simpler imo.

PR Checklist

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

Copy link

changeset-bot bot commented May 21, 2024

⚠️ No Changeset found

Latest commit: 745039b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

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

Click here to learn what changesets are, and how to add one.

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

@ernestognw
Copy link
Member Author

Unit tests are missing. Will update later

@ernestognw ernestognw changed the title Generate Packing.sol Procedurally generate packing libraries May 21, 2024
@ernestognw
Copy link
Member Author

In favor of #5056

@ernestognw ernestognw closed this Jun 3, 2024
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

1 participant