From df684302f63a0e7dd6ed179be276320ce931b03a Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Thu, 1 Feb 2024 19:01:26 -0600 Subject: [PATCH] wip: wire in prover --- codex/node.nim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/codex/node.nim b/codex/node.nim index 067475f5..185a618a 100644 --- a/codex/node.nim +++ b/codex/node.nim @@ -65,6 +65,7 @@ type engine: BlockExcEngine erasure: Erasure prover: ?Prover + numSamples: int discovery: Discovery contracts*: Contracts clock*: Clock @@ -551,10 +552,14 @@ 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 "Storage request processed" + return success() proc onProve( @@ -586,7 +591,7 @@ proc onProve( error "Unable to fetch manifest for cid", err = err.msg 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 return failure(err) @@ -712,7 +717,8 @@ proc new*( erasure: Erasure, prover = Prover.none, discovery: Discovery, - contracts = Contracts.default): CodexNodeRef = + contracts = Contracts.default, + numSamples = DefaultSamplesNum): CodexNodeRef = ## Create new instance of a Codex self, call `start` to run it ## @@ -723,4 +729,5 @@ proc new*( erasure: erasure, prover: prover, discovery: discovery, - contracts: contracts) + contracts: contracts, + numSamples: numSamples)