mirror of
https://github.com/status-im/nim-codex.git
synced 2025-01-09 10:32:11 +00:00
8589e63d34
* Update codex-contracts-eth * contracts: update G2Point definition * integration: disable automatic advancing of time reason: makes reasoning about timing in tests harder, because the period is set to 60 seconds in the marketplace configuration, but this code switches to a new period every 500 milliseconds * integration: fix parameters of marketplace payouts test * integration: update test settings * integration: fix typo * integration: workaround for hardhat issue Subscriptions expire after 5 minutes when using websockets. Use http and polling instead. * integration: remove origDatasetSizeInBlocks * integration: fix proof parameters for test * integration: do not log output by default * integration: fix failure rate in test * integration: fix warning * integration: include clock in logs * integration: allow for more periods 5 periods was cutting it close, if we get too much pointer downtime, then the test would fail
44 lines
1.1 KiB
Nim
44 lines
1.1 KiB
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
|
|
# A field element F_{p^2} encoded as `real + i * imag`
|
|
Fp2Element* = object
|
|
real*: UInt256
|
|
imag*: UInt256
|
|
G2Point* = object
|
|
x*: Fp2Element
|
|
y*: Fp2Element
|
|
|
|
func solidityType*(_: type G1Point): string =
|
|
solidityType(G1Point.fieldTypes)
|
|
|
|
func solidityType*(_: type Fp2Element): string =
|
|
solidityType(Fp2Element.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, element: Fp2Element) =
|
|
encoder.write(element.fieldValues)
|
|
|
|
func encode*(encoder: var AbiEncoder, point: G2Point) =
|
|
encoder.write(point.fieldValues)
|
|
|
|
func encode*(encoder: var AbiEncoder, proof: Groth16Proof) =
|
|
encoder.write(proof.fieldValues)
|