-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
Inconsistent usage of V values in signatures #19751
Comments
Originally Ethereum used The current logic is that the low level crypto operations returns 0/1 (because that is the canonical V value), and the higher level signers (Frontier, Homestead, EIP155) convert that V to whatever Ethereum specs on top of secp256k1. TL;DR: Use the high level signers, don't use the secp256k1 library directly. If you use the low level crypto library directly, you need to be aware of how generic ECC relates to Ethereum signatures. |
Hi, I found some inconsistent usage (code and comments) of V values (namely using 0/1 or 27/28) in signature related functions (sign and recover), which might lead to misunderstandings and misoperations for developers.
For example, this PR, OpenZeppelin/openzeppelin-contracts#1622, would make the contracts using this popular library deny signatures with 0/1 V values, which are generated by go-ethereum's secp256k1.Sign() function.
Here are some of the inconsistent code and comments:
code using 27/28 for V values:
code using 0/1 for V values:
The text was updated successfully, but these errors were encountered: