marketplacesuite: set correct circuit files, interval mining
This commit is contained in:
parent
1afa201049
commit
f8f57d8dba
|
@ -1,5 +1,5 @@
|
|||
import pkg/chronos
|
||||
import pkg/ethers/erc20
|
||||
import pkg/ethers/erc20 except `%`
|
||||
from pkg/libp2p import Cid
|
||||
import pkg/codex/contracts/marketplace as mp
|
||||
import pkg/codex/periods
|
||||
|
@ -60,7 +60,7 @@ template marketplacesuite*(name: string, body: untyped) =
|
|||
maxCollateral=200.u256
|
||||
)
|
||||
|
||||
proc validateRequest(nodes, tolerance, origDatasetSizeInBlocks: uint) =
|
||||
proc validateRequest(nodes, tolerance, origDatasetSizeInBlocks: int) =
|
||||
if nodes > 1:
|
||||
doAssert(origDatasetSizeInBlocks >= 3,
|
||||
"dataset size must be greater than or equal to 3 blocks with " &
|
||||
|
@ -77,6 +77,8 @@ template marketplacesuite*(name: string, body: untyped) =
|
|||
tolerance = 0,
|
||||
origDatasetSizeInBlocks: int): Future[PurchaseId] {.async.} =
|
||||
|
||||
validateRequest(nodes, tolerance, origDatasetSizeInBlocks)
|
||||
|
||||
let expiry = (await ethProvider.currentTime()) + expiry.u256
|
||||
|
||||
let id = client.requestStorage(
|
||||
|
@ -93,18 +95,14 @@ template marketplacesuite*(name: string, body: untyped) =
|
|||
return id
|
||||
|
||||
proc continuouslyAdvanceEvery(every: chronos.Duration) {.async.} =
|
||||
try:
|
||||
while true:
|
||||
await advanceToNextPeriod()
|
||||
await sleepAsync(every)
|
||||
except CancelledError:
|
||||
discard
|
||||
discard await ethProvider.send("evm_setAutomine", @[%false])
|
||||
discard await ethProvider.send("evm_setIntervalMining", @[%5000]);
|
||||
|
||||
setup:
|
||||
# TODO: This is currently the address of the marketplace with a dummy
|
||||
# verifier. Use real marketplace address, `Marketplace.address` once we
|
||||
# can generate actual Groth16 ZK proofs.
|
||||
let marketplaceAddress = Marketplace.address(dummyVerifier = true)
|
||||
let marketplaceAddress = Marketplace.address(dummyVerifier = false)
|
||||
marketplace = Marketplace.new(marketplaceAddress, ethProvider.getSigner())
|
||||
let tokenAddress = await marketplace.token()
|
||||
token = Erc20Token.new(tokenAddress, ethProvider.getSigner())
|
||||
|
@ -112,7 +110,7 @@ template marketplacesuite*(name: string, body: untyped) =
|
|||
period = config.proofs.period.truncate(uint64)
|
||||
periodicity = Periodicity(seconds: period.u256)
|
||||
|
||||
continuousMineFut = continuouslyAdvanceEvery(chronos.millis(500))
|
||||
continuousMineFut = continuouslyAdvanceEvery(chronos.millis(30000))
|
||||
|
||||
teardown:
|
||||
await continuousMineFut.cancelAndWait()
|
||||
|
|
|
@ -204,9 +204,12 @@ template multinodesuite*(name: string, body: untyped) =
|
|||
var config = conf
|
||||
config.addCliOption("--bootstrap-node", bootstrap)
|
||||
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-wasm", "tests/circuits/fixtures/proof_main.wasm")
|
||||
config.addCliOption(PersistenceCmd.prover, "--circom-zkey", "tests/circuits/fixtures/proof_main.zkey")
|
||||
config.addCliOption(PersistenceCmd.prover, "--circom-r1cs",
|
||||
"vendor/codex-contracts-eth/verifier/networks/hardhat/proof_main.r1cs")
|
||||
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)
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ marketplacesuite "Hosts submit regular proofs":
|
|||
|
||||
providers:
|
||||
CodexConfigs.init(nodes=5)
|
||||
# .debug() # uncomment to enable console log output
|
||||
.debug(idx=0) # 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
|
||||
.withLogTopics("marketplace", "sales", "reservations", "node")
|
||||
.withLogTopics("marketplace", "sales", "reservations", "node", "clock")
|
||||
.some,
|
||||
):
|
||||
let client0 = clients()[0].client
|
||||
|
@ -51,9 +51,9 @@ marketplacesuite "Hosts submit regular proofs":
|
|||
duration=totalPeriods.periods,
|
||||
expiry=30.periods,
|
||||
nodes=5,
|
||||
tolerance=1,
|
||||
tolerance=2,
|
||||
origDatasetSizeInBlocks = datasetSizeInBlocks)
|
||||
check eventually client0.purchaseStateIs(purchaseId, "started")
|
||||
check eventually(client0.purchaseStateIs(purchaseId, "started"), timeout=totalPeriods.periods.int * 1000)
|
||||
|
||||
var proofWasSubmitted = false
|
||||
proc onProofSubmitted(event: ProofSubmitted) =
|
||||
|
|
Loading…
Reference in New Issue