Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Move ECDSA message hash methods to its own MessageHashUtils library #4430

Conversation

ernestognw
Copy link
Member

As part of #4318, we agreed that the ECDSA library can just focus on recovery methods, whereas a new library for ECDSA message hashes would be a suitable place for adding support to new message schemes.

It includes some updates to the documentation.

PR Checklist

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

@ernestognw ernestognw requested review from frangio and Amxx July 5, 2023 23:04
@changeset-bot
Copy link

changeset-bot bot commented Jul 5, 2023

🦋 Changeset detected

Latest commit: d976a6f

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 Major

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
Copy link
Member Author

Note that the MessageHashUtils name is not yet agreed but one of the options.

Some other options could be:

  • library DigestUtils {}
  • library SignatureDigestUtils {}
  • library MessageHashUtils {}
  • library SignatureHashUtils {}
  • library MessageDigestUtils {}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Files to this file doesn't feel right. Can you double check ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I merge master with:

git merge master -X theirs

Then applied the patch with bash scripts/upgradeable/patch-apply.sh, solved conflicts (ECDSA vs MessageHashUtils import in EIP-712), and saved the patch with bash scripts/upgradeable/patch-save.sh.

Should be fine but I did the same conflict resolution before, let me know if I'm missing something.

Copy link
Collaborator

@Amxx Amxx left a comment

Choose a reason for hiding this comment

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

  • Minor comments on the test
  • The patch file doesn't feel right

otherwize its good

test/utils/cryptography/MessageHashUtils.test.js Outdated Show resolved Hide resolved
test/utils/cryptography/MessageHashUtils.test.js Outdated Show resolved Hide resolved
ernestognw and others added 3 commits July 6, 2023 10:46
@ernestognw ernestognw requested a review from Amxx July 6, 2023 18:00
Amxx
Amxx previously approved these changes Jul 6, 2023
Co-authored-by: Francisco <fg@frang.io>
Co-authored-by: Francisco <fg@frang.io>
Copy link
Contributor

Choose a reason for hiding this comment

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

The patch looks good to me. The changes I see are to commit hashes and line numbers, as well as context that has changed.

@ernestognw ernestognw requested a review from Amxx July 7, 2023 03:41
@Amxx Amxx enabled auto-merge (squash) July 7, 2023 10:06
@Amxx Amxx merged commit 0053ee0 into OpenZeppelin:master Jul 7, 2023
* hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
*
* NOTE: The `hash` parameter is intended to be the result of hashing a raw message with
* keccak256, althoguh any bytes32 value can be safely used because the final digest will
Copy link
Contributor

Choose a reason for hiding this comment

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

"althoguh" -> typo; I think for such a fix no need for a PR overhead and one of you maintainers can quickly fix it in main ;-): cc: @ernestognw, @frangio, @Amxx

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed via #4462 (thx @Amxx)

This was referenced Sep 10, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants