mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-16 12:23:07 +00:00
refactor: simplify error handling in suggestDownloadTool and enhance test setup for CLI
This commit is contained in:
parent
ebf4ce4c6f
commit
71fdf952cf
@ -71,9 +71,7 @@ proc getZkeyFile*(config: CodexConf): ?!string =
|
||||
|
||||
proc suggestDownloadTool(config: CodexConf) =
|
||||
without address =? config.marketplaceAddress:
|
||||
raise (ref Defect)(
|
||||
msg: "Proving backend initializing while marketplace address not set."
|
||||
)
|
||||
raiseAssert("Proving backend initializing while marketplace address not set.")
|
||||
|
||||
let
|
||||
tokens = ["cirdl", "\"" & $config.circuitDir & "\"", config.ethProvider, $address]
|
||||
|
||||
@ -65,6 +65,10 @@ asyncchecksuite "Command line interface":
|
||||
|
||||
test "complains when persistence is enabled without ethereum account":
|
||||
let node = await startCodex(@["persistence"])
|
||||
|
||||
defer:
|
||||
await node.stop()
|
||||
|
||||
await node.waitUntilOutput("Persistence enabled, but no Ethereum account was set")
|
||||
await node.stop(expectedErrCode = 1)
|
||||
|
||||
@ -84,10 +88,8 @@ asyncchecksuite "Command line interface":
|
||||
await node.stop(expectedErrCode = 1)
|
||||
discard removeFile(unsafeKeyFile)
|
||||
|
||||
let
|
||||
marketplaceArg = "--marketplace-address=" & $EthAddress.example
|
||||
expectedDownloadInstruction =
|
||||
"Proving circuit files are not found. Please run the following to download them:"
|
||||
let expectedDownloadInstruction =
|
||||
"Proving circuit files are not found. Please run the following to download them:"
|
||||
|
||||
test "suggests downloading of circuit files when persistence is enabled without accessible r1cs file":
|
||||
let node = await startCodex(@["persistence", "prover", marketplaceArg])
|
||||
@ -104,6 +106,10 @@ asyncchecksuite "Command line interface":
|
||||
"--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs",
|
||||
]
|
||||
)
|
||||
|
||||
defer:
|
||||
await node.stop()
|
||||
|
||||
await node.waitUntilOutput(expectedDownloadInstruction)
|
||||
await node.stop(expectedErrCode = 1)
|
||||
|
||||
@ -115,8 +121,11 @@ asyncchecksuite "Command line interface":
|
||||
"prover",
|
||||
marketplaceArg,
|
||||
"--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs",
|
||||
"--circom-wasm=tests/circuits/fixtures/proof_main.wasm",
|
||||
]
|
||||
)
|
||||
|
||||
defer:
|
||||
await node.stop()
|
||||
|
||||
await node.waitUntilOutput(expectedDownloadInstruction)
|
||||
await node.stop(expectedErrCode = 1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user