diff --git a/codex/codex.nim b/codex/codex.nim index d5c6d58b..ea3c0068 100644 --- a/codex/codex.nim +++ b/codex/codex.nim @@ -39,6 +39,7 @@ import ./contracts/clock import ./contracts/deployment import ./utils/addrutils import ./namespaces +import ./codextypes import ./logutils logScope: @@ -131,6 +132,7 @@ proc bootstrapInteractions( let sales = Sales.new(market, clock, repo, proofFailures) client = some ClientInteractions.new(clock, purchasing) host = some HostInteractions.new(clock, sales) + if config.validator: let validation = Validation.new(clock, market, config.validatorMaxSlots) validator = some ValidatorInteractions.new(clock, validation) @@ -264,12 +266,21 @@ proc new*( store = NetworkStore.new(engine, repoStore) erasure = Erasure.new(store, leoEncoderProvider, leoDecoderProvider) prover = if config.persistence: - circomBackend = CircomCompat.init(config.circomR1cs, config.circomWasm, config.circomZkey) - some Prover.new(store, circomBackend) + let + zkey = if config.circomNoZkey: "" else: config.circomZkey + some Prover.new( + store, + CircomCompat.init(config.circomR1cs, config.circomWasm, zkey)) else: none Prover - codexNode = CodexNodeRef.new(switch, store, engine, erasure, prover, discovery) + codexNode = CodexNodeRef.new( + switch = switch, + store = store, + engine = engine, + erasure = erasure, + prover = prover, + discovery = discovery) restServer = RestServerRef.new( codexNode.initRestApi(config, repoStore), diff --git a/codex/conf.nim b/codex/conf.nim index 037197ae..c5f6f5d9 100644 --- a/codex/conf.nim +++ b/codex/conf.nim @@ -33,14 +33,15 @@ import pkg/ethers import pkg/questionable import pkg/questionable/results +import ./codextypes import ./discovery import ./logutils import ./stores import ./units import ./utils -export units -export net +export units, net, codextypes + export DefaultQuotaBytes, DefaultBlockTtl, @@ -229,21 +230,33 @@ type circomR1cs* {. desc: "The r1cs file for the storage circuit" defaultValue: defaultDataDir() / "circuits" / "proof_main.r1cs" - name: "circuit-r1cs" + name: "circom-r1cs" .}: string circomWasm* {. desc: "The wasm file for the storage circuit" defaultValue: defaultDataDir() / "circuits" / "proof_main.wasm" - name: "circuit-wasm" + name: "circom-wasm" .}: string circomZkey* {. desc: "The zkey file for the storage circuit" defaultValue: defaultDataDir() / "circuits" / "proof_main.zkey" - name: "circuit-zkey" + name: "circom-zkey" .}: string + circomNoZkey* {. + desc: "Ignore the zkey file - use only for testing!" + defaultValue: false + name: "circom-no-zkey" + .}: bool + + numProofSamples* {. + desc: "Number of samples to prove" + defaultValue: DefaultSamplesNum + defaultValueDesc: $DefaultSamplesNum + name: "proof-samples" }: int + ethProvider* {. desc: "The URL of the JSON-RPC API of the Ethereum node" defaultValue: "ws://localhost:8545"