mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-10 04:55:40 +00:00
Introduces a start method to prover
This commit is contained in:
parent
4d069599c9
commit
cfca6b4111
@ -23,6 +23,7 @@ import pkg/stew/shims/net as stewnet
|
||||
import pkg/datastore
|
||||
import pkg/ethers except Rng
|
||||
import pkg/stew/io2
|
||||
import pkg/questionable
|
||||
|
||||
import ./node
|
||||
import ./conf
|
||||
@ -66,7 +67,7 @@ proc waitForSync(provider: Provider): Future[void] {.async.} =
|
||||
inc sleepTime
|
||||
|
||||
proc bootstrapInteractions(
|
||||
s: CodexServer): Future[void] {.async.} =
|
||||
s: CodexServer): Future[?string] {.async.} =
|
||||
## bootstrap interactions and return contracts
|
||||
## using clients, hosts, validators pairings
|
||||
##
|
||||
@ -139,6 +140,7 @@ proc bootstrapInteractions(
|
||||
validator = some ValidatorInteractions.new(clock, validation)
|
||||
|
||||
s.codexNode.contracts = (client, host, validator)
|
||||
return await market.getZkeyHash()
|
||||
|
||||
proc start*(s: CodexServer) {.async.} =
|
||||
trace "Starting codex node", config = $s.config
|
||||
@ -173,7 +175,11 @@ proc start*(s: CodexServer) {.async.} =
|
||||
s.codexNode.discovery.updateAnnounceRecord(announceAddrs)
|
||||
s.codexNode.discovery.updateDhtRecord(s.config.nat, s.config.discoveryPort)
|
||||
|
||||
await s.bootstrapInteractions()
|
||||
let proofCeremonyUrl = await s.bootstrapInteractions()
|
||||
|
||||
if prover =? s.codexNode.prover:
|
||||
prover.start(s.config, proofCeremonyUrl)
|
||||
|
||||
await s.codexNode.start()
|
||||
s.restServer.start()
|
||||
|
||||
@ -283,11 +289,13 @@ proc new*(
|
||||
$config.circomZkey
|
||||
else: ""
|
||||
|
||||
echo "Prover is some!"
|
||||
some Prover.new(
|
||||
store,
|
||||
CircomCompat.init($config.circomR1cs, $config.circomWasm, zkey),
|
||||
config.numProofSamples)
|
||||
else:
|
||||
echo "Prover is none!"
|
||||
none Prover
|
||||
|
||||
codexNode = CodexNodeRef.new(
|
||||
|
@ -64,7 +64,7 @@ type
|
||||
networkId: PeerId
|
||||
networkStore: NetworkStore
|
||||
engine: BlockExcEngine
|
||||
prover: ?Prover
|
||||
prover*: ?Prover
|
||||
discovery: Discovery
|
||||
contracts*: Contracts
|
||||
clock*: Clock
|
||||
|
@ -21,6 +21,7 @@ import ../../merkletree
|
||||
import ../../stores
|
||||
import ../../market
|
||||
import ../../utils/poseidon2digest
|
||||
import ../../conf
|
||||
|
||||
import ../builder
|
||||
import ../sampler
|
||||
@ -89,6 +90,14 @@ proc verify*(
|
||||
|
||||
self.backend.verify(proof, inputs)
|
||||
|
||||
proc start*(
|
||||
self: Prover,
|
||||
config: CodexConf,
|
||||
proofCeremonyUrl: ?string
|
||||
) =
|
||||
echo "prover start!"
|
||||
echo proofCeremonyUrl
|
||||
|
||||
proc new*(
|
||||
_: type Prover,
|
||||
store: BlockStore,
|
||||
|
Loading…
x
Reference in New Issue
Block a user