Skip to content

Conversation

ernestognw
Copy link
Member

Follow up from #5680

PR Checklist

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

@ernestognw ernestognw requested a review from a team as a code owner July 31, 2025 18:41
Copy link

changeset-bot bot commented Jul 31, 2025

🦋 Changeset detected

Latest commit: fd7d2b5

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

@ernestognw ernestognw marked this pull request as draft July 31, 2025 18:42
function verify(
bytes memory key,
bytes memory value,
bytes[] memory proof,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder that proofs are almost always provided via calldata, as such calldata should be used here for reduced gas costs.

Comment on lines +246 to +253
function _nibbles(bytes memory value) private pure returns (bytes memory) {
uint256 length = value.length;
bytes memory nibbles_ = new bytes(length * 2);
for (uint256 i = 0; i < length; i++) {
(nibbles_[i * 2], nibbles_[i * 2 + 1]) = (value[i] & 0xf0, value[i] & 0x0f);
}
return nibbles_;
}
Copy link

@0xClandestine 0xClandestine Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder, a much more efficient approached has been added to Solady.

Vectorized/solady#1461

EDIT: more context https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN

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.

4 participants