Skip to content

Commit

Permalink
Fixes bug in yParity handling.
Browse files Browse the repository at this point in the history
Fixes ethers-io#3835.
I think.

Note: I didn't test, made this change in a browser, but I'm pretty sure this or something very much like it will fix ethers-io#3835.
  • Loading branch information
MicahZoltu authored Jul 12, 2023
1 parent 1dd5427 commit 33fec5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src.ts/crypto/signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,13 @@ export class Signature {
}

assertError(false, "missing v");
})(sig.v, sig.yParityAndS, sig.yParity);
})(sig.v, sig.yParityAndS, getNumber(sig.yParity, "yParity"));

const result = new Signature(_guard, r, s, v);
if (networkV) { result.#networkV = networkV; }

// If multiple of v, yParity, yParityAndS we given, check they match
assertError(!("yParity" in sig && sig.yParity !== result.yParity), "yParity mismatch");
assertError(!("yParity" in sig && sig.yParity !== getNumber(result.yParity, "yParity"), "yParity mismatch");
assertError(!("yParityAndS" in sig && sig.yParityAndS !== result.yParityAndS), "yParityAndS mismatch");

return result;
Expand Down

0 comments on commit 33fec5c

Please sign in to comment.