Skip to content

Commit

Permalink
g1 and g2 in pairing contract, update type of pairing-check
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcardon committed Oct 26, 2022
1 parent 305ee91 commit 2b9919c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Pact/Native/Pairing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ scalarMultDef =

pairingCheckDef :: NativeDef
pairingCheckDef =
defRNative "pairing-check" pairingCheck' (funType tTyBool [("points-g1", a), ("points-g2", b)])
defRNative "pairing-check" pairingCheck' (funType tTyBool [("points-g1", TyList a), ("points-g2", TyList b)])
[]
"Perform pairing and final exponentiation points in G1 and G2 in BN254, check if the result is 1"
where
Expand Down
8 changes: 8 additions & 0 deletions tests/pact/pairing.repl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
delta2:object{point-g2}
ic:[object{point-g1}])

(defconst g1:object{point-g1}
{'x:1, 'y:2})

(defconst g2:object{point-g2}
{ 'x: [10857046999023057135944570762232829481370756359578518086990519993285655852781, 11559732032986387107991004021392285783925812861821192530917403151452391805634]
, 'y: [8495653923123431417604973247489272438418190587263600148770280649306958101930, 4082367875863433681332203403145435568316851327593401208105741076214120093531]}
)

(defconst verifying-key:object{vk}
{ "alfa1":
{'x: 20491192805390485299153009773594534940189261866228447918068658471970481763042,
Expand Down

0 comments on commit 2b9919c

Please sign in to comment.