Consistently name multiple returned values (#5177)
Signed-off-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
committed by
Hadrien Croubois
parent
22ec876c5a
commit
6c73fcddea
@ -53,7 +53,10 @@ library ECDSA {
|
||||
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
|
||||
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
|
||||
*/
|
||||
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
|
||||
function tryRecover(
|
||||
bytes32 hash,
|
||||
bytes memory signature
|
||||
) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
|
||||
if (signature.length == 65) {
|
||||
bytes32 r;
|
||||
bytes32 s;
|
||||
@ -96,7 +99,11 @@ library ECDSA {
|
||||
*
|
||||
* See https://eips.ethereum.org/EIPS/eip-2098[ERC-2098 short signatures]
|
||||
*/
|
||||
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
|
||||
function tryRecover(
|
||||
bytes32 hash,
|
||||
bytes32 r,
|
||||
bytes32 vs
|
||||
) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
|
||||
unchecked {
|
||||
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
|
||||
// We do not check for an overflow here since the shift operation results in 0 or 1.
|
||||
@ -123,7 +130,7 @@ library ECDSA {
|
||||
uint8 v,
|
||||
bytes32 r,
|
||||
bytes32 s
|
||||
) internal pure returns (address, RecoverError, bytes32) {
|
||||
) internal pure returns (address recovered, RecoverError err, bytes32 errArg) {
|
||||
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
|
||||
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
|
||||
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
|
||||
|
||||
Reference in New Issue
Block a user