init prover

This commit is contained in:
Dmitriy Ryajov 2024-01-29 14:59:59 -06:00
parent 8de2d6d35a
commit de140b7333
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
1 changed files with 10 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import std/times
import pkg/libp2p import pkg/libp2p
import pkg/chronos import pkg/chronos
import pkg/codex/slots
import pkg/codex/codextypes import pkg/codex/codextypes
import pkg/codex/chunker import pkg/codex/chunker
@ -50,6 +51,8 @@ proc pipeChunker*(stream: BufferStream, chunker: Chunker) {.async.} =
template setupAndTearDown*() {.dirty.} = template setupAndTearDown*() {.dirty.} =
var var
file: File file: File
r1cs: string
wasm: string
chunker: Chunker chunker: Chunker
switch: Switch switch: Switch
wallet: WalletRef wallet: WalletRef
@ -66,12 +69,16 @@ template setupAndTearDown*() {.dirty.} =
pendingBlocks: PendingBlocksManager pendingBlocks: PendingBlocksManager
discovery: DiscoveryEngine discovery: DiscoveryEngine
erasure: Erasure erasure: Erasure
circomBackend: CircomCompat
prover: Prover
let let
path = currentSourcePath().parentDir path = currentSourcePath().parentDir
setup: setup:
file = open(path /../ "" /../ "fixtures" / "test.jpg") file = open(path /../ "" /../ "fixtures" / "test.jpg")
r1cs = path /../ "" /../ "circuits" / "fixtures" / "proofs_main.r1cs"
wasm = path /../ "" /../ "circuits" / "fixtures" / "proofs_main.r1cs"
chunker = FileChunker.new(file = file, chunkSize = DefaultBlockSize) chunker = FileChunker.new(file = file, chunkSize = DefaultBlockSize)
switch = newStandardSwitch() switch = newStandardSwitch()
wallet = WalletRef.new(EthPrivateKey.random()) wallet = WalletRef.new(EthPrivateKey.random())
@ -93,7 +100,9 @@ template setupAndTearDown*() {.dirty.} =
engine = BlockExcEngine.new(localStore, wallet, network, discovery, peerStore, pendingBlocks) engine = BlockExcEngine.new(localStore, wallet, network, discovery, peerStore, pendingBlocks)
store = NetworkStore.new(engine, localStore) store = NetworkStore.new(engine, localStore)
erasure = Erasure.new(store, leoEncoderProvider, leoDecoderProvider) erasure = Erasure.new(store, leoEncoderProvider, leoDecoderProvider)
node = CodexNodeRef.new(switch, store, engine, erasure, blockDiscovery) circomBackend = CircomCompat.init(r1cs, wasm)
prover = Prover.new(store, circomBackend)
node = CodexNodeRef.new(switch, store, engine, erasure, prover.some, blockDiscovery)
await node.start() await node.start()