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

Avoid storing hashing function pointers in storage make MerkleTree structure upgrade-safe #5080

Merged
merged 7 commits into from
Jun 13, 2024

Conversation

Amxx
Copy link
Collaborator

@Amxx Amxx commented Jun 12, 2024

Fixes #5079

This is change to an unreleased feature, no need for a changeset entry.

PR Checklist

  • Tests

@Amxx Amxx added this to the 5.1 milestone Jun 12, 2024
@Amxx Amxx requested review from ernestognw and cairoeth June 12, 2024 16:33
Copy link

changeset-bot bot commented Jun 12, 2024

⚠️ No Changeset found

Latest commit: 7d19d75

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

contracts/utils/structs/MerkleTree.sol Outdated Show resolved Hide resolved
contracts/utils/structs/MerkleTree.sol Outdated Show resolved Hide resolved
contracts/utils/structs/MerkleTree.sol Outdated Show resolved Hide resolved
contracts/utils/structs/MerkleTree.sol Outdated Show resolved Hide resolved
@ernestognw ernestognw changed the title Do not store function pointer to make structure upgrade-safe Avoid storing hashing function pointers in storage make MerkleTree structure upgrade-safe Jun 12, 2024
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 expanded a bit on the documentation, I felt we needed to give an official recommendation of how to store the function as it may seem pretty easy to just put it in storage as we were doing.

Also, I added cross-references where possible but the custom setup and push can't be referenced since adding two - (hyphens) gets encoded as —%E2%80%8B and can't find where the issue is (likely in https://github.com/OpenZeppelin/solidity-docgen/)

LGTM

@Amxx Amxx merged commit 8a990e6 into OpenZeppelin:master Jun 13, 2024
21 checks passed
@Amxx Amxx deleted the refactor/dont-store-fn-pointers branch June 13, 2024 12:50
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.

Resolve issue with function pointers in MerkleTree not being upgrade safe
3 participants