select verification path based on px coordinate
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
8d94ab0dd1
commit
e2f0d0fea4
@ -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);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user