nim-dagger/benchmarks/ark_prover_bench.nim

42 lines
1.1 KiB
Nim
Raw Normal View History

2024-04-23 17:21:39 +00:00
import std/sequtils
2024-04-23 18:23:36 +00:00
import std/strutils
2024-04-23 17:21:39 +00:00
import std/options
import std/importutils
import pkg/questionable
import pkg/questionable/results
import pkg/datastore
import pkg/codex/rng
import pkg/codex/stores
import pkg/codex/merkletree
import pkg/codex/utils/json
import pkg/codex/codextypes
import pkg/codex/slots
import pkg/codex/slots/builder
import pkg/codex/utils/poseidon2digest
import pkg/codex/slots/sampler/utils
import pkg/constantine/math/arithmetic
import pkg/constantine/math/io/io_bigints
import pkg/constantine/math/io/io_fields
import codex/slots/backends/helpers
proc setup() =
2024-04-23 17:26:16 +00:00
let
inputData = readFile("tests/circuits/fixtures/input.json")
inputJson: JsonNode = !JsonNode.parse(inputData)
proofInput: ProofInputs[Poseidon2Hash] =
Poseidon2Hash.jsonToProofInput(inputJson)
2024-04-23 17:21:39 +00:00
let
2024-04-23 18:23:36 +00:00
datasetProof = Poseidon2Proof.init(
proofInput.slotIndex,
proofInput.nSlotsPerDataSet,
proofInput.slotProof[0..<4]).tryGet
2024-04-23 17:21:39 +00:00
2024-04-23 18:23:36 +00:00
let ver = datasetProof.verify(proofInput.slotRoot, proofInput.datasetRoot).tryGet
echo "ver: ", ver
2024-04-23 17:21:39 +00:00
2024-04-23 18:23:36 +00:00
setup()