Skip to content

Commit

Permalink
Remove explicit v check from ECDSA lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Psirex committed Apr 13, 2023
1 parent 6db4af6 commit c956d93
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion contracts/common/lib/ECDSA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ library ECDSA {
// 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.
require(uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ECDSA: invalid signature 's' value");
require(v == 27 || v == 28, "ECDSA: invalid signature 'v' value");

// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
Expand Down
2 changes: 1 addition & 1 deletion test/common/lib/signature-utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function testWithConsumer(SignatureUtilsConsumer, desc) {

await assert.reverts(
sigUtils.isValidSignature(alice.address, msgHash, INVALID_V, sig.r, sig.s),
`ECDSA: invalid signature 'v' value`
'ECDSA: invalid signature'
)
})
})
Expand Down

0 comments on commit c956d93

Please sign in to comment.