Skip to content

Commit c315fd8

Browse files
committed
add comments
1 parent 72fc13b commit c315fd8

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

packages/keyring-eth-mpc/src/mpc-keyring.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ export class MPCKeyring implements Keyring {
301301
networkSession,
302302
});
303303

304+
// NOTE: We could create an Ethereum compliant signature more efficiently if
305+
// the signing library provided the parity bit.
304306
return toEthSig(signature, hash, publicKey);
305307
}
306308
}

packages/keyring-eth-mpc/src/util.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ export function toEthSig(
7777
throw new Error('Invalid signature length');
7878
}
7979

80+
// Enforce low S value
81+
8082
const rBuf = signature.slice(0, 32);
8183
let sBuf = signature.slice(32, 64);
8284

@@ -93,6 +95,8 @@ export function toEthSig(
9395
}
9496
}
9597

98+
// Recover parity bit
99+
96100
const expectedAddr = publicToAddressHex(pubKey);
97101

98102
for (const candidateV of [0n, 1n]) {

0 commit comments

Comments
 (0)