Removes backendFactory placeholder type

This commit is contained in:
Ben 2024-09-16 10:09:04 +02:00
parent 656ce37158
commit 64f4fbcb8f
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
4 changed files with 5 additions and 15 deletions

View File

@ -273,9 +273,7 @@ proc new*(
engine = BlockExcEngine.new(repoStore, wallet, network, blockDiscovery, advertiser, peerStore, pendingBlocks)
store = NetworkStore.new(engine, repoStore)
prover = if config.prover:
let
backendFactory = BackendFactory()
backend = backendFactory.initializeBackend(config).expect("Unable to create prover backend.")
let backend = config.initializeBackend().expect("Unable to create prover backend.")
some Prover.new(store, backend, config)
else:
none Prover

View File

@ -11,9 +11,6 @@ import ../../conf
import ./backends
import ./backendutils
type
BackendFactory* = object of RootObj
proc initializeFromConfig(
config: CodexConf,
utils: BackendUtils): ?!AnyBackend =
@ -73,7 +70,6 @@ proc suggestDownloadTool(config: CodexConf) =
echo "'./" & tokens.join(" ") & "'"
proc initializeBackend*(
self: BackendFactory,
config: CodexConf,
utils: BackendUtils = BackendUtils()): ?!AnyBackend =

View File

@ -36,7 +36,6 @@ suite "Test BackendFactory":
let
utilsMock = BackendUtilsMock()
circuitDir = "testecircuitdir"
factory = BackendFactory()
setup:
createDir(circuitDir)
@ -57,7 +56,7 @@ suite "Test BackendFactory":
circomWasm: InputFile("tests/circuits/fixtures/proof_main.wasm"),
circomZkey: InputFile("tests/circuits/fixtures/proof_main.zkey")
)
backend = factory.initializeBackend(config, utilsMock).tryGet
backend = config.initializeBackend(utilsMock).tryGet
check:
backend.vkp != nil
@ -79,7 +78,7 @@ suite "Test BackendFactory":
# will be picked up as local files:
circuitDir: OutDir("tests/circuits/fixtures")
)
backend = factory.initializeBackend(config, utilsMock).tryGet
backend = config.initializeBackend(utilsMock).tryGet
check:
backend.vkp != nil
@ -98,7 +97,7 @@ suite "Test BackendFactory":
marketplaceAddress: EthAddress.example.some,
circuitDir: OutDir(circuitDir)
)
backendResult = factory.initializeBackend(config, utilsMock)
backendResult = config.initializeBackend(utilsMock)
check:
backendResult.isErr

View File

@ -52,10 +52,7 @@ suite "Test Prover":
circomZkey: InputFile("tests/circuits/fixtures/proof_main.zkey"),
numProofSamples: samples
)
let
backendFactory = BackendFactory()
backend = backendFactory.initializeBackend(config).tryGet()
backend = config.initializeBackend().tryGet()
store = RepoStore.new(repoDs, metaDs)
prover = Prover.new(store, backend, config)