mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-09 12:35:51 +00:00
4e8630791a
* Introduces a start method to prover * Moves backend creation into start method * sets up three paths for backend initialization * Extracts backend initialization to backend-factory * Implements loading backend from cli files or previously downloaded local files * Wires up downloading and unzipping * functional implementation * Fixes testprover.nim * Sets up tests for backendfactory * includes libzip-dev * pulls in updated contracts * removes integration cli tests for r1cs, wasm, and zkey file arguments. * Fixes issue where inner-scope values are lost before returning * sets local proof verification for dist-test images * Adds two traces and bumps nim-ethers * Adds separate path for circuit files * Create circuit dir if not exists * fix: make sure requestStorage is mined * fix: correct place to plug confirm * test: fixing contracts tests * Restores gitmodules * restores nim-datastore reference * Sets up downloader exe * sets up tool skeleton * implements getting of circuit hash * Implements downloader tool * sets up test skeleton * Implements test for cirdl * includes testTools in testAll * Cleanup building.md * cleans up previous downloader implementation * cleans up testbackendfactory * moves start of prover into node.nim * Fills in arguments in example command * Initializes backend in prover constructor * Restores tests * Restores tests for cli instructions * Review comments by Dmitriy, part 1 * Quotes path in download instruction. * replaces curl with chronos http session * Moves cirdl build output to 'build' folder. * Fixes chronicles log output * Add cirdl support to the codex Dockerfile Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com> * Add cirdl support to the docker entrypoint Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com> * Add cirdl support to the release workflow Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com> * Disable verify_circuit flag for releases Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com> * Removes backendFactory placeholder type * wip * Replaces zip library with status-im/zippy library (which supports zip and tar) * Updates cirdl to not change circuitdir folder * Switches from zip to tar.gz * Review comments by Dmitriy * updates codex-contracts-eth * Adds testTools to CI * Adds check for access to config.circuitdir * Update fixture circuit zkey * Update matrix to run tools tests on Windows * Adds 'deps' dependency for cirdl * Adjust docker-entrypoint.sh to use CODEX_CIRCUIT_DIR env var * Review comments by Giuliano --------- Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com> Co-authored-by: Adam Uhlíř <adam@uhlir.dev> Co-authored-by: Veaceslav Doina <20563034+veaceslavdoina@users.noreply.github.com>
58 lines
2.0 KiB
Nim
58 lines
2.0 KiB
Nim
import std/unittest
|
|
import std/tempfiles
|
|
import codex/conf
|
|
import codex/utils/fileutils
|
|
import ./nodes
|
|
import ../examples
|
|
|
|
suite "Command line interface":
|
|
|
|
let key = "4242424242424242424242424242424242424242424242424242424242424242"
|
|
|
|
test "complains when persistence is enabled without ethereum account":
|
|
let node = startNode(@[
|
|
"persistence"
|
|
])
|
|
node.waitUntilOutput("Persistence enabled, but no Ethereum account was set")
|
|
node.stop()
|
|
|
|
test "complains when ethereum private key file has wrong permissions":
|
|
let unsafeKeyFile = genTempPath("", "")
|
|
discard unsafeKeyFile.writeFile(key, 0o666)
|
|
let node = startNode(@[
|
|
"persistence",
|
|
"--eth-private-key=" & unsafeKeyFile])
|
|
node.waitUntilOutput("Ethereum private key file does not have safe file permissions")
|
|
node.stop()
|
|
discard removeFile(unsafeKeyFile)
|
|
|
|
let
|
|
marketplaceArg = "--marketplace-address=" & $EthAddress.example
|
|
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 = startNode(@["persistence", "prover", marketplaceArg])
|
|
node.waitUntilOutput(expectedDownloadInstruction)
|
|
node.stop()
|
|
|
|
test "suggests downloading of circuit files when persistence is enabled without accessible wasm file":
|
|
let node = startNode(@[
|
|
"persistence",
|
|
"prover",
|
|
marketplaceArg,
|
|
"--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs"
|
|
])
|
|
node.waitUntilOutput(expectedDownloadInstruction)
|
|
node.stop()
|
|
|
|
test "suggests downloading of circuit files when persistence is enabled without accessible zkey file":
|
|
let node = startNode(@[
|
|
"persistence",
|
|
"prover",
|
|
marketplaceArg,
|
|
"--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs",
|
|
"--circom-wasm=tests/circuits/fixtures/proof_main.wasm"
|
|
])
|
|
node.waitUntilOutput(expectedDownloadInstruction)
|
|
node.stop()
|