diff --git a/constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim b/constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim index a2254b93..ec6e6a05 100644 --- a/constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim +++ b/constantine/proof_systems/constraint_systems/r1cs_circom_parser.nim @@ -121,6 +121,7 @@ type R1csCustomGatesList* = object R1csCustomGatesApp* = object + ## XXX: Make this a `R1CS[T]` which takes care of parsing the field elements R1CS* = object magic*: array[4, char] version*: uint32 diff --git a/constantine/proof_systems/constraint_systems/wtns_binary_parser.nim b/constantine/proof_systems/constraint_systems/wtns_binary_parser.nim index 0a349b5e..1d3e6bd4 100644 --- a/constantine/proof_systems/constraint_systems/wtns_binary_parser.nim +++ b/constantine/proof_systems/constraint_systems/wtns_binary_parser.nim @@ -40,10 +40,7 @@ import - Content: Each witness element is a 256-bit (32 bytes) unsigned integer in Big Endian format ]# -# We use `sortedByIt` to sort the different sections in the file by their -# `WtnsSectionKind` from std / sequtils import filterIt -from std / algorithm import sortedByIt from std / strutils import endsWith type @@ -58,7 +55,7 @@ type num*: uint32 # number of witness elements Witness* = object - data*: seq[byte] + data*: seq[byte] ## Important: The values are *not* Montgomery encoded Section* = object size*: uint64 # NOTE: in the real file the section type is *FIRST* and then the size @@ -82,6 +79,9 @@ type # of each different section in the file and then parse them in increasing # order of the section types +## XXX: Add `Wtns[T]` type, which takes care of converting field elements and +## does not contain `seq[Section]` anymore + func header*(wtns: WtnsBin): WitnessHeader = result = wtns.sections.filterIt(it.sectionType == kHeader)[0].header diff --git a/constantine/proof_systems/constraint_systems/zkey_binary_parser.nim b/constantine/proof_systems/constraint_systems/zkey_binary_parser.nim index 169159d9..adcb6a77 100644 --- a/constantine/proof_systems/constraint_systems/zkey_binary_parser.nim +++ b/constantine/proof_systems/constraint_systems/zkey_binary_parser.nim @@ -108,6 +108,9 @@ type # of each different section in the file and then parse them in increasing # order of the section types +## XXX: Add `Zkey[T]` type, which takes care of converting field elements and +## does not contain `seq[Section]` anymore + func header*(zkey: ZkeyBin): Header = result = zkey.sections.filterIt(it.sectionType == kHeader)[0].header