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

Process and verify merkle proofs (and multiproof) with custom hash function #4887

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

Amxx
Copy link
Collaborator

@Amxx Amxx commented Feb 8, 2024

Fixes #4886

The hasher should be view, but the existing versions are pure. This is resulved by

  • Keeping the existing versions (pure)
  • Add new (view) versions that use the a custom hasher
  • Both for memory and calldata
  • Both for simple proofs and multiproofs

This large amount of code duplication is handled through procedural generation


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

Copy link

changeset-bot bot commented Feb 8, 2024

🦋 Changeset detected

Latest commit: 55b390e

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 marked this pull request as ready for review February 12, 2024 20:11
@ernestognw ernestognw mentioned this pull request Feb 16, 2024
4 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.

I pushed some nits but the PR looks good imo. It may just need to be tested with custom hashing functions but that can't be done until we release the merkle tree library.

I'd be fine leaving an issue and merging, wdyt @Amxx? I see codecov was flagging a drop in coverage. Investigating both #4977 and this drop

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.

Add a MerkleProof.verify function that support arbitrary internal hashes
2 participants