pass proper input

This commit is contained in:
Dmitriy Ryajov 2024-01-27 16:36:55 -06:00
parent e62b5c918a
commit 9f1ec4b02f
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
1 changed files with 9 additions and 4 deletions

View File

@ -63,6 +63,7 @@ proc prove*(
var var
entropy = input.entropy.toBytes entropy = input.entropy.toBytes
verifyRoot = input.verifyRoot.toBytes verifyRoot = input.verifyRoot.toBytes
slotRoot = input.slotRoot.toBytes
if backend.pushInputU256Array( if backend.pushInputU256Array(
"entropy".cstring, entropy.addr, entropy.len.uint32) != ERR_OK: "entropy".cstring, entropy.addr, entropy.len.uint32) != ERR_OK:
@ -72,6 +73,10 @@ proc prove*(
"dataSetRoot".cstring, verifyRoot.addr, verifyRoot.len.uint32) != ERR_OK: "dataSetRoot".cstring, verifyRoot.addr, verifyRoot.len.uint32) != ERR_OK:
return failure("Failed to push data set root") return failure("Failed to push data set root")
if backend.pushInputU256Array(
"slotRoot".cstring, slotRoot.addr, slotRoot.len.uint32) != ERR_OK:
return failure("Failed to push data set root")
if backend.pushInputU32( if backend.pushInputU32(
"nCellsPerSlot".cstring, input.numCells.uint32) != ERR_OK: "nCellsPerSlot".cstring, input.numCells.uint32) != ERR_OK:
return failure("Failed to push nCellsPerSlot") return failure("Failed to push nCellsPerSlot")
@ -90,19 +95,19 @@ proc prove*(
# arrays are always flattened # arrays are always flattened
if backend.pushInputU256Array( if backend.pushInputU256Array(
"slotProof".cstring, "slotProof".cstring,
slotProof.addr, slotProof[0].addr,
uint input.verifyProof.len) != ERR_OK: uint (32 * input.verifyProof.len)) != ERR_OK:
return failure("Failed to push slot proof") return failure("Failed to push slot proof")
for s in input.samples: for s in input.samples:
var var
merklePaths = s.merkleProof.mapIt( it.toBytes ).concat merklePaths = s.merkleProof.mapIt( it.toBytes )
data = s.data data = s.data
if backend.pushInputU256Array( if backend.pushInputU256Array(
"merklePaths".cstring, "merklePaths".cstring,
merklePaths[0].addr, merklePaths[0].addr,
uint merklePaths.len) != ERR_OK: uint (32 * merklePaths.len)) != ERR_OK:
return failure("Failed to push merkle paths") return failure("Failed to push merkle paths")
if backend.pushInputU256Array( if backend.pushInputU256Array(