mirror of
https://github.com/status-im/nim-codex.git
synced 2025-01-11 19:34:32 +00:00
2cf892c467
* Smart contracts update: Groth16Proof instead of bytes * Use dummy verifier for now, until we can create ZK proofs * Fix tests: submit proof only when slot is filled * Submit dummy proofs for now * More detailed log when proof submission failed * Use dummy verifier for integration tests For now at least * Fix mistake in blanket renaming to ethProvider * Update to latest codex-contracts-eth * feat: zkey-hash from chain * Fix zkeyHash --------- Co-authored-by: Adam Uhlíř <adam@uhlir.dev>
34 lines
805 B
Nim
34 lines
805 B
Nim
import pkg/stint
|
|
import pkg/contractabi
|
|
import pkg/ethers/fields
|
|
|
|
type
|
|
Groth16Proof* = object
|
|
a*: G1Point
|
|
b*: G2Point
|
|
c*: G1Point
|
|
G1Point* = object
|
|
x*: UInt256
|
|
y*: UInt256
|
|
G2Point* = object
|
|
x*: array[2, UInt256]
|
|
y*: array[2, UInt256]
|
|
|
|
func solidityType*(_: type G1Point): string =
|
|
solidityType(G1Point.fieldTypes)
|
|
|
|
func solidityType*(_: type G2Point): string =
|
|
solidityType(G2Point.fieldTypes)
|
|
|
|
func solidityType*(_: type Groth16Proof): string =
|
|
solidityType(Groth16Proof.fieldTypes)
|
|
|
|
func encode*(encoder: var AbiEncoder, point: G1Point) =
|
|
encoder.write(point.fieldValues)
|
|
|
|
func encode*(encoder: var AbiEncoder, point: G2Point) =
|
|
encoder.write(point.fieldValues)
|
|
|
|
func encode*(encoder: var AbiEncoder, proof: Groth16Proof) =
|
|
encoder.write(proof.fieldValues)
|