wip: wire in prover

This commit is contained in:
Dmitriy Ryajov 2024-02-01 19:01:26 -06:00
parent 29d4ff5556
commit df684302f6
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
1 changed files with 10 additions and 3 deletions

View File

@ -65,6 +65,7 @@ type
engine: BlockExcEngine engine: BlockExcEngine
erasure: Erasure erasure: Erasure
prover: ?Prover prover: ?Prover
numSamples: int
discovery: Discovery discovery: Discovery
contracts*: Contracts contracts*: Contracts
clock*: Clock clock*: Clock
@ -551,10 +552,14 @@ proc onStore(
trace "Unable to build slot", err = err.msg trace "Unable to build slot", err = err.msg
return failure(err) return failure(err)
trace "Slot successfully retrieved and reconstructed"
if cid =? slotRoot.toSlotCid() and cid != manifest.slotRoots[slotIdx.int]: if cid =? slotRoot.toSlotCid() and cid != manifest.slotRoots[slotIdx.int]:
trace "Slot root mismatch", manifest = manifest.slotRoots[slotIdx.int], recovered = slotRoot.toSlotCid() trace "Slot root mismatch", manifest = manifest.slotRoots[slotIdx.int], recovered = slotRoot.toSlotCid()
return failure(newException(CodexError, "Slot root mismatch")) return failure(newException(CodexError, "Slot root mismatch"))
trace "Storage request processed"
return success() return success()
proc onProve( proc onProve(
@ -586,7 +591,7 @@ proc onProve(
error "Unable to fetch manifest for cid", err = err.msg error "Unable to fetch manifest for cid", err = err.msg
return failure(err) return failure(err)
without proof =? await prover.prove(slotIdx, manifest, challenge), err: without proof =? await prover.prove(slotIdx, manifest, challenge, self.numSamples), err:
error "Unable to generate proof", err = err.msg error "Unable to generate proof", err = err.msg
return failure(err) return failure(err)
@ -712,7 +717,8 @@ proc new*(
erasure: Erasure, erasure: Erasure,
prover = Prover.none, prover = Prover.none,
discovery: Discovery, discovery: Discovery,
contracts = Contracts.default): CodexNodeRef = contracts = Contracts.default,
numSamples = DefaultSamplesNum): CodexNodeRef =
## Create new instance of a Codex self, call `start` to run it ## Create new instance of a Codex self, call `start` to run it
## ##
@ -723,4 +729,5 @@ proc new*(
erasure: erasure, erasure: erasure,
prover: prover, prover: prover,
discovery: discovery, discovery: discovery,
contracts: contracts) contracts: contracts,
numSamples: numSamples)