mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-09 12:35:51 +00:00
293c676f22
* rework cli to accept circuit params * check circom files extension * adding new required cli changes * don't use ufcs * persistence is a command now * use `nimOldCaseObjects` switch for nim confutils compat * misc * Update cli integration tests * Fix: simulateProofFailures option is not for validator * moving circom params under `prover` command * update tests * Use circuit assets from codex-contract-eth in tests * Add "prover" cli command to tests * use correct stores * make `verifier` a cmd option * update circuit artifacts path * fix cli tests * Update integration tests to use cli commands Integration tests have been updated to use the new cli commands. The api for usage in the integration tests has also changed a bit. Proofs tests have been updated to use 5 nodes and 8 blocks of data. The remaining integration tests also need to be updated. * remove parsedCli from CodexConfig Instead, parse the cli args on the fly when needed * remove unneeded gcsafes * graceful shutdowns Where possible, do not raise assert, as other nodes in the test may already be running. Instead, raise exceptions, catch them in multinodes.nim, and attempt to do a teardown before failing the test. `abortOnError` is set to true so that `fail()` will quit immediately, after teardown has been run. * update testmarketplace to new api, with valid EC params --------- Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com> Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
56 lines
1.7 KiB
Nim
56 lines
1.7 KiB
Nim
import pkg/ethers
|
|
import codex/contracts/deployment
|
|
import codex/conf
|
|
import codex/contracts
|
|
|
|
import ../asynctest
|
|
import ../checktest
|
|
|
|
type MockProvider = ref object of Provider
|
|
chainId*: UInt256
|
|
|
|
method getChainId*(provider: MockProvider): Future[UInt256] {.async.} =
|
|
return provider.chainId
|
|
|
|
proc configFactory(): CodexConf =
|
|
CodexConf(
|
|
cmd: StartUpCmd.persistence,
|
|
nat: ValidIpAddress.init("127.0.0.1"),
|
|
discoveryIp: ValidIpAddress.init(IPv4_any()),
|
|
metricsAddress: ValidIpAddress.init("127.0.0.1"))
|
|
|
|
proc configFactory(marketplace: Option[EthAddress]): CodexConf =
|
|
CodexConf(
|
|
cmd: StartUpCmd.persistence,
|
|
nat: ValidIpAddress.init("127.0.0.1"),
|
|
discoveryIp: ValidIpAddress.init(IPv4_any()),
|
|
metricsAddress: ValidIpAddress.init("127.0.0.1"),
|
|
marketplaceAddress: marketplace)
|
|
|
|
asyncchecksuite "Deployment":
|
|
let provider = MockProvider()
|
|
|
|
test "uses conf value as priority":
|
|
let deployment = Deployment.new(provider, configFactory(EthAddress.init("0x59b670e9fA9D0A427751Af201D676719a970aaaa")))
|
|
provider.chainId = 1.u256
|
|
|
|
let address = await deployment.address(Marketplace)
|
|
check address.isSome
|
|
check $(!address) == "0x59b670e9fa9d0a427751af201d676719a970aaaa"
|
|
|
|
test "uses chainId hardcoded values as fallback":
|
|
let deployment = Deployment.new(provider, configFactory())
|
|
provider.chainId = 167005.u256
|
|
|
|
let address = await deployment.address(Marketplace)
|
|
check address.isSome
|
|
check $(!address) == "0x948cf9291b77bd7ad84781b9047129addf1b894f"
|
|
|
|
test "return none for unknown networks":
|
|
let deployment = Deployment.new(provider, configFactory())
|
|
provider.chainId = 1.u256
|
|
|
|
let address = await deployment.address(Marketplace)
|
|
check address.isNone
|
|
|