wire prover into node

This commit is contained in:
Dmitriy Ryajov 2024-02-09 19:33:03 -06:00
parent 6cbadc6079
commit e271875f6a
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
2 changed files with 6 additions and 11 deletions

View File

@ -556,11 +556,13 @@ proc onStore(
trace "Unable to build slot", err = err.msg
return failure(err)
trace "Slot successfully retrieved and reconstructed"
if cid =? slotRoot.toSlotCid() and cid != manifest.slotRoots[slotIdx.int]:
trace "Slot root mismatch", manifest = manifest.slotRoots[slotIdx.int], recovered = slotRoot.toSlotCid()
return failure(newException(CodexError, "Slot root mismatch"))
trace "Slot successfully retrieved and reconstructed"
trace "Storage request processed"
return success()
@ -593,16 +595,8 @@ proc onProve(
error "Unable to fetch manifest for cid", err = err.msg
return failure(err)
without builder =? Poseidon2Builder.new(self.networkStore.localStore, manifest), err:
error "Unable to create slots builder", err = err.msg
return failure(err)
without sampler =? DataSampler.new(slotIdx, self.networkStore.localStore, builder), err:
error "Unable to create data sampler", err = err.msg
return failure(err)
without proofInput =? await sampler.getProofInput(challenge, nSamples = 3), err:
error "Unable to get proof input for slot", err = err.msg
without proof =? await prover.prove(slotIdx, manifest, challenge), err:
error "Unable to generate proof", err = err.msg
return failure(err)
# Todo: send proofInput to circuit. Get proof. (Profit, repeat.)

View File

@ -6,6 +6,7 @@ import pkg/chronos
import pkg/codex/codextypes
import pkg/codex/chunker
import pkg/codex/slots
import ../../asynctest