Skip to content

Commit 3de1b81

Browse files
committed
Fixed splitSignature logic for verifying EIP-2930 and EIP-1559 v (ethers-io#2084).
1 parent ab319f2 commit 3de1b81

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/bytes/src.ts/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,11 @@ export function splitSignature(signature: SignatureLike): Signature {
406406
} else {
407407
if (result.v == null) {
408408
result.v = 27 + result.recoveryParam;
409-
} else if (result.recoveryParam !== (1 - (result.v % 2))) {
410-
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
409+
} else {
410+
const recId = (result.v === 0 || result.v === 1) ? result.v :(1 - (result.v % 2));
411+
if (result.recoveryParam !== recId) {
412+
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
413+
}
411414
}
412415
}
413416

0 commit comments

Comments
 (0)