select verification path based on px coordinate

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2026-09-11 15:29:29 +03:00
parent 8d94ab0dd1
commit e2f0d0fea4
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA

View File

@ -21,7 +21,7 @@ library Verifier {
uint256 s uint256 s
) internal view returns (bool) { ) internal view returns (bool) {
if (px >= P || rx >= P || s >= N || s == 0) { return false; } if (px >= P || rx >= P || s >= N || s == 0) { return false; }
if (rx < N) { return verifySpectre(call, px, rx, s); } if (px < N) { return verifySpectre(call, px, rx, s); }
return verifyBanshee(call, px, rx, s); return verifyBanshee(call, px, rx, s);
} }
@ -38,6 +38,8 @@ library Verifier {
// Explanation: https://hackmd.io/@nZ-twauPRISEa6G9zg3XRw/SyjJzSLt9 // Explanation: https://hackmd.io/@nZ-twauPRISEa6G9zg3XRw/SyjJzSLt9
bytes32 sp = bytes32(N - mulmod(s, px, N)); bytes32 sp = bytes32(N - mulmod(s, px, N));
bytes32 ep = bytes32(N - mulmod(e, px, N)); bytes32 ep = bytes32(N - mulmod(e, px, N));
if (sp == 0) { return false; }
if (ep == 0) { return false; }
// Parity should be always even // Parity should be always even
address recoveredR = ecrecover(sp, 27, bytes32(px), ep); address recoveredR = ecrecover(sp, 27, bytes32(px), ep);