Skip to content

Commit

Permalink
Merge pull request #329 from 0xPolygonHermez/feature/sub-fix
Browse files Browse the repository at this point in the history
Subtraction fix
  • Loading branch information
krlosMata authored Feb 8, 2024
2 parents 09b0cc3 + 7a3d075 commit a302c6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
run: |
export NUM_CPUS=31
npm run test:start
sh tools/parallel-testing/checker.sh
sh tools/parallel-testing/checker.sh
8 changes: 7 additions & 1 deletion main/pairings/FPBN254/subFpBN254.zkasm
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

subFpBN254:
; 0] Negate C
A => D
%BN254_P => A
C => B
$ => C :SUB
D => A

; 1] Compute and check the sub over Z
; A·[1] + [BN254_P-C] = [D]·2²⁵⁶ + [E]
1 => B
${const.BN254_P - C} => C
$${var _subFpBN254_AC = A + C}
${_subFpBN254_AC >> 256} => D
${_subFpBN254_AC} => E :ARITH
Expand Down

0 comments on commit a302c6a

Please sign in to comment.