Skip to content

Commit

Permalink
minor comments, cleanup, TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vindaar committed Aug 13, 2024
1 parent 7a049b3 commit 9c4ed12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9c4ed12

Please sign in to comment.