Skip to content

Commit

Permalink
Fixed splitSignature logic for verifying EIP-2930 and EIP-1559 v (#2084
Browse files Browse the repository at this point in the history
…).
  • Loading branch information
ricmoo committed Oct 18, 2021
1 parent ab319f2 commit 3de1b81
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/bytes/src.ts/index.ts
Expand Up @@ -406,8 +406,11 @@ export function splitSignature(signature: SignatureLike): Signature {
} else {
if (result.v == null) {
result.v = 27 + result.recoveryParam;
} else if (result.recoveryParam !== (1 - (result.v % 2))) {
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
} else {
const recId = (result.v === 0 || result.v === 1) ? result.v :(1 - (result.v % 2));
if (result.recoveryParam !== recId) {
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
}
}
}

Expand Down

0 comments on commit 3de1b81

Please sign in to comment.