From 7a610c22175e126b4a4c6e8a4434446fab095019 Mon Sep 17 00:00:00 2001 From: Balazs Komuves Date: Fri, 16 Jan 2026 11:50:33 +0100 Subject: [PATCH] add a "makeWitness" convenience function --- groth16.nimble | 1 + groth16/files/witness.nim | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/groth16.nimble b/groth16.nimble index dde65c4..b5510f6 100644 --- a/groth16.nimble +++ b/groth16.nimble @@ -6,6 +6,7 @@ license = "MIT OR Apache-2.0" skipDirs = @["groth16/example"] binDir = "build" namedBin = {"cli/cli_main": "nim-groth16"}.toTable() +installExt = @["nim"] requires "nim >= 2.0.0" requires "https://github.com/status-im/nim-taskpools >= 0.0.5" diff --git a/groth16/files/witness.nim b/groth16/files/witness.nim index 381e85c..93a6159 100644 --- a/groth16/files/witness.nim +++ b/groth16/files/witness.nim @@ -32,6 +32,14 @@ type nvars* : int values* : seq[Fr[BN254_Snarks]] +func makeWitnessBN254*(vals: seq[Fr[BN254_Snarks]]): Witness = + return Witness( + curve : "bn128" + , r : primeR + , nvars : vals.len + , values : vals + ) + #------------------------------------------------------------------------------- proc parseSection1_header( stream: Stream, user: var Witness, sectionLen: int ) =