Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix FNEC_DIV_TWO constant and update test #225

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main/ecrecover/constEc.zkasm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CONSTL %FPEC = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2Fn
CONSTL %FPEC_MINUS_ONE = %FPEC - 1
CONSTL %FNEC_DIV_TWO = 57896044618658097711785492504343953926418782139537452191302581570759080747169n
CONSTL %FNEC_DIV_TWO = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0n
CONSTL %FPEC_C2_256 = 0x1000003D1n
CONSTL %FPEC_NON_SQRT = (1n << 256n) - 1n

Expand Down
15 changes: 13 additions & 2 deletions test/ecrecover.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,26 @@ repeat_ecrecover_test:
:CALL(ecrecover_tx)
0x0000000000000000000000000000000000000000n :ASSERT

; #34 s == field/2 + 1. Valid
; #34 s == field/2 + 1. Valid (precompiled)

0x456e9aea5e197a1f1af7a3e85a3212fa4049a3ba34c2289b4c860fc0b0c64ef3n => A
0x9242685bf161793cc25603c231bc2f568eb630ea16aa137d2664ac8038825608n => B
0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1n => C
0x1cn => D
:CALL(ecrecover_tx)
:CALL(ecrecover_precompiled)
0x4ef445CADd8bEe8A02bc79b30A97e6Fe3AE3B7a3n :ASSERT

; #34' s == field/2 + 1. Invalid (tx)

0x456e9aea5e197a1f1af7a3e85a3212fa4049a3ba34c2289b4c860fc0b0c64ef3n => A
0x9242685bf161793cc25603c231bc2f568eb630ea16aa137d2664ac8038825608n => B
0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1n => C
0x1cn => D
:CALL(ecrecover_tx)
0n :ASSERT
B => A
4n :ASSERT

; #35 s == field/2. Valid

0x456e9aea5e197a1f1af7a3e85a3212fa4049a3ba34c2289b4c860fc0b0c64ef3n => A
Expand Down