Replace if (...) revert() with require(...) (#2376)
This commit is contained in:
@ -52,13 +52,8 @@ library ECDSA {
|
|||||||
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
|
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
|
||||||
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
|
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
|
||||||
// these malleable signatures as well.
|
// these malleable signatures as well.
|
||||||
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
|
require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value");
|
||||||
revert("ECDSA: invalid signature 's' value");
|
require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value");
|
||||||
}
|
|
||||||
|
|
||||||
if (v != 27 && v != 28) {
|
|
||||||
revert("ECDSA: invalid signature 'v' value");
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the signature is valid (and not malleable), return the signer address
|
// If the signature is valid (and not malleable), return the signer address
|
||||||
address signer = ecrecover(hash, v, r, s);
|
address signer = ecrecover(hash, v, r, s);
|
||||||
|
|||||||
Reference in New Issue
Block a user