mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-02-28 06:10:45 +00:00
figuring out basic shell commands
This commit is contained in:
parent
74a8a00a43
commit
e14f0657d7
@ -1,4 +1,5 @@
|
|||||||
import std/sequtils
|
import std/sequtils
|
||||||
|
import std/strutils
|
||||||
import std/options
|
import std/options
|
||||||
import std/importutils
|
import std/importutils
|
||||||
|
|
||||||
@ -22,6 +23,18 @@ import pkg/constantine/math/io/io_fields
|
|||||||
|
|
||||||
import codex/slots/backends/helpers
|
import codex/slots/backends/helpers
|
||||||
|
|
||||||
|
proc createCircuits() =
|
||||||
|
let cmds = """
|
||||||
|
${NIMCLI_DIR}/cli $CLI_ARGS -v --circom=${CIRCUIT_MAIN}.circom --output=input.json
|
||||||
|
circom --r1cs --wasm --O2 -l${CIRCUIT_DIR} ${CIRCUIT_MAIN}.circom
|
||||||
|
NODE_OPTIONS="--max-old-space-size=8192" snarkjs groth16 setup ${CIRCUIT_MAIN}.r1cs $PTAU_PATH ${CIRCUIT_MAIN}_0000.zkey
|
||||||
|
echo "some_entropy_75289v3b7rcawcsyiur" | NODE_OPTIONS="--max-old-space-size=8192" snarkjs zkey contribute ${CIRCUIT_MAIN}_0000.zkey ${CIRCUIT_MAIN}_0001.zkey --name="1st Contributor Name"
|
||||||
|
""".splitLines()
|
||||||
|
|
||||||
|
# rm ${CIRCUIT_MAIN}_0000.zkey
|
||||||
|
# mv ${CIRCUIT_MAIN}_0001.zkey ${CIRCUIT_MAIN}.zkey
|
||||||
|
|
||||||
|
|
||||||
proc setup() =
|
proc setup() =
|
||||||
let
|
let
|
||||||
inputData = readFile("tests/circuits/fixtures/input.json")
|
inputData = readFile("tests/circuits/fixtures/input.json")
|
||||||
@ -30,26 +43,12 @@ proc setup() =
|
|||||||
Poseidon2Hash.jsonToProofInput(inputJson)
|
Poseidon2Hash.jsonToProofInput(inputJson)
|
||||||
|
|
||||||
let
|
let
|
||||||
blockCells = 32
|
datasetProof = Poseidon2Proof.init(
|
||||||
cellIdxs = proofInput.entropy.cellIndices(proofInput.slotRoot, proofInput.nCellsPerSlot, 5)
|
proofInput.slotIndex,
|
||||||
|
proofInput.nSlotsPerDataSet,
|
||||||
|
proofInput.slotProof[0..<4]).tryGet
|
||||||
|
|
||||||
for i, cellIdx in cellIdxs:
|
let ver = datasetProof.verify(proofInput.slotRoot, proofInput.datasetRoot).tryGet
|
||||||
let
|
echo "ver: ", ver
|
||||||
sample = proofInput.samples[i]
|
|
||||||
cellIdx = cellIdxs[i]
|
|
||||||
|
|
||||||
cellProof = Poseidon2Proof.init(
|
setup()
|
||||||
cellIdx.toCellInBlk(blockCells),
|
|
||||||
proofInput.nCellsPerSlot,
|
|
||||||
sample.merklePaths[0..<5]).tryGet
|
|
||||||
|
|
||||||
slotProof = Poseidon2Proof.init(
|
|
||||||
cellIdx.toBlkInSlot(blockCells),
|
|
||||||
proofInput.nCellsPerSlot,
|
|
||||||
sample.merklePaths[5..<9]).tryGet
|
|
||||||
|
|
||||||
cellData = Poseidon2Hash.fromCircomData(sample.cellData)
|
|
||||||
cellLeaf = Poseidon2Hash.spongeDigest(cellData, rate = 2).tryGet
|
|
||||||
slotLeaf = cellProof.reconstructRoot(cellLeaf).tryGet
|
|
||||||
|
|
||||||
# check slotProof.verify(slotLeaf, proofInput.slotRoot).tryGet
|
|
Loading…
x
Reference in New Issue
Block a user