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 Arrays.sol #4859

Merged
merged 14 commits into from
Mar 27, 2024

Conversation

RenanSouza2
Copy link
Contributor

This PR creates scripts to generate the Arrays.sol file,

It also includes tests for unsafeMemoryAccess functions

PR Checklist

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

Copy link

changeset-bot bot commented Jan 28, 2024

⚠️ No Changeset found

Latest commit: c6c3bb9

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 no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@RenanSouza2
Copy link
Contributor Author

Hey,

Are you interested in adding a function for bytes32 memory array?

There are lots of simplifications that can be done if there are the same functions for both array and storage

@Amxx
Copy link
Collaborator

Amxx commented Jan 29, 2024

Hello @RenanSouza2

We have multiple PR targetting Array.sol. #4846, #4842. I'm not sure we need to generate this file procedurally. I'd delay that decision until after the above PR are processed.

@ernestognw ernestognw changed the title Generate arrays Procedurally generate Arrays.sol Mar 26, 2024
@ernestognw ernestognw requested a review from Amxx March 26, 2024 15:43
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.

I made a few adjustments after the other Arrays PRs got merged.
Right now it looks good to me but we might want to discuss how the generation script is ordered.

WDYT @Amxx ?

@Amxx
Copy link
Collaborator

Amxx commented Mar 26, 2024

When doing this kind of changes, I think we should aim at minimizing the review work on the solidity side by keeping the function ordering. This greatly reduces the diff size. Once that is merged, we can always discuss another PR that reorder the template (that at this point we know is correct).

Basically, its easy to:

  • review template change that don't touch the code to much
  • review template reorganisation

But its hard to

  • review brand new templates that result in significant solidity movement.

I did some changes to minimize the changes to Array.sol

@ernestognw
Copy link
Member

I agree with minimizing the diff. So LGTM as well.
However, I do think the previous ordering is better when reading the generation script. No need to update it now since I don't think the ordering is strictly important, but wanted to point it out.

@ernestognw ernestognw merged commit 5e3ba29 into OpenZeppelin:master Mar 27, 2024
18 checks passed
@RenanSouza2 RenanSouza2 deleted the generate-arrays branch March 27, 2024 19:41
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.

3 participants