Update integration tests to include --payout-address

This commit is contained in:
Eric 2024-08-12 18:57:42 +10:00
parent f9384d508a
commit 8f9535cf35
No known key found for this signature in database
3 changed files with 14 additions and 2 deletions

View File

@ -204,6 +204,7 @@ template multinodesuite*(name: string, body: untyped) =
var config = conf var config = conf
config.addCliOption("--bootstrap-node", bootstrap) config.addCliOption("--bootstrap-node", bootstrap)
config.addCliOption(StartUpCmd.persistence, "--eth-account", $accounts[running.len]) config.addCliOption(StartUpCmd.persistence, "--eth-account", $accounts[running.len])
config.addCliOption(StartUpCmd.persistence, "--payout-address", $accounts[running.len])
config.addCliOption(PersistenceCmd.prover, "--circom-r1cs", config.addCliOption(PersistenceCmd.prover, "--circom-r1cs",
"vendor/codex-contracts-eth/verifier/networks/hardhat/proof_main.r1cs") "vendor/codex-contracts-eth/verifier/networks/hardhat/proof_main.r1cs")
config.addCliOption(PersistenceCmd.prover, "--circom-wasm", config.addCliOption(PersistenceCmd.prover, "--circom-wasm",

View File

@ -3,14 +3,17 @@ import std/tempfiles
import codex/conf import codex/conf
import codex/utils/fileutils import codex/utils/fileutils
import ./nodes import ./nodes
import ../contracts/examples
suite "Command line interface": suite "Command line interface":
let key = "4242424242424242424242424242424242424242424242424242424242424242" let key = "4242424242424242424242424242424242424242424242424242424242424242"
let address = Address.example
test "complains when persistence is enabled without ethereum account": test "complains when persistence is enabled without ethereum account":
let node = startNode(@[ let node = startNode(@[
"persistence" "persistence",
"--payout-address=" & $address
]) ])
node.waitUntilOutput("Persistence enabled, but no Ethereum account was set") node.waitUntilOutput("Persistence enabled, but no Ethereum account was set")
node.stop() node.stop()
@ -20,19 +23,24 @@ suite "Command line interface":
discard unsafeKeyFile.writeFile(key, 0o666) discard unsafeKeyFile.writeFile(key, 0o666)
let node = startNode(@[ let node = startNode(@[
"persistence", "persistence",
"--payout-address=" & $address,
"--eth-private-key=" & unsafeKeyFile]) "--eth-private-key=" & unsafeKeyFile])
node.waitUntilOutput("Ethereum private key file does not have safe file permissions") node.waitUntilOutput("Ethereum private key file does not have safe file permissions")
node.stop() node.stop()
discard removeFile(unsafeKeyFile) discard removeFile(unsafeKeyFile)
test "complains when persistence is enabled without accessible r1cs file": test "complains when persistence is enabled without accessible r1cs file":
let node = startNode(@["persistence", "prover"]) let node = startNode(@[
"persistence",
"--payout-address=" & $address,
"prover"])
node.waitUntilOutput("r1cs file not readable, doesn't exist or wrong extension (.r1cs)") node.waitUntilOutput("r1cs file not readable, doesn't exist or wrong extension (.r1cs)")
node.stop() node.stop()
test "complains when persistence is enabled without accessible wasm file": test "complains when persistence is enabled without accessible wasm file":
let node = startNode(@[ let node = startNode(@[
"persistence", "persistence",
"--payout-address=" & $address,
"prover", "prover",
"--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs" "--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs"
]) ])
@ -42,6 +50,7 @@ suite "Command line interface":
test "complains when persistence is enabled without accessible zkey file": test "complains when persistence is enabled without accessible zkey file":
let node = startNode(@[ let node = startNode(@[
"persistence", "persistence",
"--payout-address=" & $address,
"prover", "prover",
"--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs", "--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs",
"--circom-wasm=tests/circuits/fixtures/proof_main.wasm" "--circom-wasm=tests/circuits/fixtures/proof_main.wasm"

View File

@ -39,6 +39,7 @@ template twonodessuite*(name: string, debug1, debug2: string, body) =
"--disc-port=8090", "--disc-port=8090",
"--listen-addrs=/ip4/127.0.0.1/tcp/0", "--listen-addrs=/ip4/127.0.0.1/tcp/0",
"persistence", "persistence",
"--payout-address=" & $account1,
"prover", "prover",
"--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs", "--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs",
"--circom-wasm=tests/circuits/fixtures/proof_main.wasm", "--circom-wasm=tests/circuits/fixtures/proof_main.wasm",
@ -63,6 +64,7 @@ template twonodessuite*(name: string, debug1, debug2: string, body) =
"--listen-addrs=/ip4/127.0.0.1/tcp/0", "--listen-addrs=/ip4/127.0.0.1/tcp/0",
"--bootstrap-node=" & bootstrap, "--bootstrap-node=" & bootstrap,
"persistence", "persistence",
"--payout-address=" & $account2,
"prover", "prover",
"--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs", "--circom-r1cs=tests/circuits/fixtures/proof_main.r1cs",
"--circom-wasm=tests/circuits/fixtures/proof_main.wasm", "--circom-wasm=tests/circuits/fixtures/proof_main.wasm",