Use real verifier (#737)

* use a real verifying contract address

* contracts: cleanup

* marketplacesuite: set correct circuit files, interval mining

* Proofs tests updates

Contains changes to get the proving tests working reliably.

* integration: use correct circom artifacts for creating proofs

* integration: cleanup

---------

Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
This commit is contained in:
markspanbroek 2024-03-12 15:20:42 +01:00 committed by GitHub
parent b3e57a37e2
commit 4d069599c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 18 deletions

View File

@ -14,10 +14,7 @@ type Deployment* = ref object
const knownAddresses = { const knownAddresses = {
# Hardhat localhost network # Hardhat localhost network
"31337": { "31337": {
# TODO: This is currently the address of the marketplace with a dummy "Marketplace": Address.init("0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44"),
# verifier. Replace with "0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44" once we
# can generate actual Groth16 ZK proofs
"Marketplace": Address.init("0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f"),
}.toTable, }.toTable,
# Taiko Alpha-3 Testnet # Taiko Alpha-3 Testnet
"167005": { "167005": {

View File

@ -33,7 +33,7 @@ when codex_enable_proof_failures:
try: try:
warn "Submitting INVALID proof", period = currentPeriod, slotId = slot.id warn "Submitting INVALID proof", period = currentPeriod, slotId = slot.id
await market.submitProof(slot.id, Groth16Proof.default) await market.submitProof(slot.id, Groth16Proof.default)
except ProviderError as e: except SignerError as e:
if not e.msgDetail.contains("Invalid proof"): if not e.msgDetail.contains("Invalid proof"):
onSubmitProofError(e, currentPeriod, slot.id) onSubmitProofError(e, currentPeriod, slot.id)
except CatchableError as e: except CatchableError as e:

View File

@ -61,7 +61,7 @@ template marketplacesuite*(name: string, body: untyped) =
proc requestStorage(client: CodexClient, proc requestStorage(client: CodexClient,
cid: Cid, cid: Cid,
proofProbability: uint64 = 1, proofProbability = 1,
duration: uint64 = 12.periods, duration: uint64 = 12.periods,
reward = 400.u256, reward = 400.u256,
collateral = 100.u256, collateral = 100.u256,
@ -84,11 +84,7 @@ template marketplacesuite*(name: string, body: untyped) =
return id return id
setup: setup:
# TODO: This is currently the address of the marketplace with a dummy marketplace = Marketplace.new(Marketplace.address, ethProvider.getSigner())
# verifier. Use real marketplace address, `Marketplace.address` once we
# can generate actual Groth16 ZK proofs.
let marketplaceAddress = Marketplace.address(dummyVerifier = true)
marketplace = Marketplace.new(marketplaceAddress, ethProvider.getSigner())
let tokenAddress = await marketplace.token() let tokenAddress = await marketplace.token()
token = Erc20Token.new(tokenAddress, ethProvider.getSigner()) token = Erc20Token.new(tokenAddress, ethProvider.getSigner())
let config = await mp.config(marketplace) let config = await mp.config(marketplace)

View File

@ -204,9 +204,12 @@ 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(PersistenceCmd.prover, "--circom-r1cs", "tests/circuits/fixtures/proof_main.r1cs") config.addCliOption(PersistenceCmd.prover, "--circom-r1cs",
config.addCliOption(PersistenceCmd.prover, "--circom-wasm", "tests/circuits/fixtures/proof_main.wasm") "vendor/codex-contracts-eth/verifier/networks/hardhat/proof_main.r1cs")
config.addCliOption(PersistenceCmd.prover, "--circom-zkey", "tests/circuits/fixtures/proof_main.zkey") config.addCliOption(PersistenceCmd.prover, "--circom-wasm",
"vendor/codex-contracts-eth/verifier/networks/hardhat/proof_main.wasm")
config.addCliOption(PersistenceCmd.prover, "--circom-zkey",
"vendor/codex-contracts-eth/verifier/networks/hardhat/proof_main.zkey")
return await newCodexProcess(providerIdx, config, Role.Provider) return await newCodexProcess(providerIdx, config, Role.Provider)

View File

@ -25,14 +25,14 @@ marketplacesuite "Hosts submit regular proofs":
CodexConfigs.init(nodes=1) CodexConfigs.init(nodes=1)
# .debug() # uncomment to enable console log output # .debug() # uncomment to enable console log output
# .withLogFile() # uncomment to output log file to tests/integration/logs/<start_datetime> <suite_name>/<test_name>/<node_role>_<node_idx>.log # .withLogFile() # uncomment to output log file to tests/integration/logs/<start_datetime> <suite_name>/<test_name>/<node_role>_<node_idx>.log
# .withLogTopics("node") # .withLogTopics("node, marketplace")
.some, .some,
providers: providers:
CodexConfigs.init(nodes=1) CodexConfigs.init(nodes=1)
# .debug() # uncomment to enable console log output # .debug() # uncomment to enable console log output
# .withLogFile() # uncomment to output log file to tests/integration/logs/<start_datetime> <suite_name>/<test_name>/<node_role>_<node_idx>.log # .withLogFile() # uncomment to output log file to tests/integration/logs/<start_datetime> <suite_name>/<test_name>/<node_role>_<node_idx>.log
# .withLogTopics("marketplace", "sales", "reservations", "node") # .withLogTopics("marketplace", "sales", "reservations", "node", "clock")
.some, .some,
): ):
let client0 = clients()[0].client let client0 = clients()[0].client
@ -80,7 +80,7 @@ marketplacesuite "Simulate invalid proofs":
CodexConfigs.init(nodes=1) CodexConfigs.init(nodes=1)
# .debug() # uncomment to enable console log output # .debug() # uncomment to enable console log output
# .withLogFile() # uncomment to output log file to tests/integration/logs/<start_datetime> <suite_name>/<test_name>/<node_role>_<node_idx>.log # .withLogFile() # uncomment to output log file to tests/integration/logs/<start_datetime> <suite_name>/<test_name>/<node_role>_<node_idx>.log
# .withLogTopics("node", "clock") # .withLogTopics("node", "marketplace", "clock")
.some, .some,
providers: providers:
@ -88,7 +88,7 @@ marketplacesuite "Simulate invalid proofs":
.withSimulateProofFailures(idx=0, failEveryNProofs=1) .withSimulateProofFailures(idx=0, failEveryNProofs=1)
# .debug() # uncomment to enable console log output # .debug() # uncomment to enable console log output
# .withLogFile() # uncomment to output log file to tests/integration/logs/<start_datetime> <suite_name>/<test_name>/<node_role>_<node_idx>.log # .withLogFile() # uncomment to output log file to tests/integration/logs/<start_datetime> <suite_name>/<test_name>/<node_role>_<node_idx>.log
# .withLogTopics("marketplace", "sales", "reservations", "node", "clock") # .withLogTopics("marketplace", "sales", "reservations", "node", "clock", "slotsbuilder")
.some, .some,
validators: validators: