diff --git a/scripts/install_rln_tests_dependencies.sh b/scripts/install_rln_tests_dependencies.sh index 7b3bbd142..e19e0ef3c 100755 --- a/scripts/install_rln_tests_dependencies.sh +++ b/scripts/install_rln_tests_dependencies.sh @@ -1,11 +1,7 @@ #!/usr/bin/env bash # Install Anvil -if ! command -v anvil &> /dev/null; then - ./scripts/install_anvil.sh -fi +./scripts/install_anvil.sh #Install pnpm -if ! command -v pnpm &> /dev/null; then - ./scripts/install_pnpm.sh -fi \ No newline at end of file +./scripts/install_pnpm.sh \ No newline at end of file diff --git a/tests/waku_rln_relay/test_rln_group_manager_onchain.nim b/tests/waku_rln_relay/test_rln_group_manager_onchain.nim index 5e6bab732..80183c892 100644 --- a/tests/waku_rln_relay/test_rln_group_manager_onchain.nim +++ b/tests/waku_rln_relay/test_rln_group_manager_onchain.nim @@ -89,14 +89,16 @@ suite "Onchain group manager": raise newException(CatchableError, "Failed to deploy test token contract") let TOKEN_ADDRESS = testTokenAddressRes.get() - let differentContractAddress = + let differentContractAddress = ( waitFor executeForgeContractDeployScripts(privateKey, acc, web3) - if differentContractAddress.isErr(): - error "Failed to deploy RLN contract", error = differentContractAddress.error + ).valueOr: + assert false, "Failed to deploy RLN contract: " & $error + return + # simulating a change in the contractAddress let manager2 = OnchainGroupManager( ethClientUrls: @[EthClient], - ethContractAddress: $differentContractAddress.get(), + ethContractAddress: $differentContractAddress, rlnInstance: manager.rlnInstance, onFatalErrorAction: proc(errStr: string) = assert false, errStr diff --git a/tests/waku_rln_relay/utils_onchain.nim b/tests/waku_rln_relay/utils_onchain.nim index d6ac0944a..74a7436ca 100644 --- a/tests/waku_rln_relay/utils_onchain.nim +++ b/tests/waku_rln_relay/utils_onchain.nim @@ -119,7 +119,7 @@ proc sendMintCall*( let amountHex = amountTokens.toHex() let amountWithout0x = - if amountHex.startsWith("0x"): + if amountHex.toLower().startsWith("0x"): amountHex[2 .. ^1] else: amountHex @@ -308,7 +308,7 @@ proc approveTokenAllowanceAndVerify*( tokenAddress: Address, spender: Address, amountWei: UInt256, -): Future[bool] {.async.} = +): Future[Result[void, string]] {.async.} = debug "Starting approval process", owner = accountFrom, tokenAddress = tokenAddress, @@ -328,8 +328,7 @@ proc approveTokenAllowanceAndVerify*( # Check if status is present and successful if receipt.status.isNone or receipt.status.get != 1.Quantity: - error "Approval transaction failed" - return false + return err("Approval transaction failed") # Give it a moment for the state to settle await sleepAsync(100.milliseconds) @@ -338,7 +337,12 @@ proc approveTokenAllowanceAndVerify*( let allowanceAfter = await checkAllowance(web3, tokenAddress, accountFrom, spender) debug "Allowance after approval", amount = allowanceAfter - return allowanceAfter >= amountWei + if allowanceAfter >= amountWei: + return ok() + else: + error "Allowance is insufficient after approval", + amount = allowanceAfter, expected = amountWei + return err("Allowance is insufficient after approval") proc executeForgeContractDeployScripts*( pk: keys.PrivateKey, acc: Address, web3: Web3 @@ -348,12 +352,11 @@ proc executeForgeContractDeployScripts*( # All RLN related tests should be run from the root directory of the project let submodulePath = "./vendor/waku-rlnv2-contract" - # Default Anvil account[1] privatekey - # let PRIVATE_KEY = "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d" - let PRIVATE_KEY = $pk + + let privateKey = $pk let forgePath = getForgePath() debug "Forge path", forgePath - debug "contract deployer account details", account = acc, pk = pk + debug "contract deployer account details", account = acc, privateKey = privateKey # Build the Foundry project let (forgeCleanOutput, forgeCleanExitCode) = @@ -387,7 +390,7 @@ proc executeForgeContractDeployScripts*( # Deploy LinearPriceCalculator contract let forgeCmdPriceCalculator = - fmt"""cd {submodulePath} && {forgePath} script script/Deploy.s.sol --broadcast -vvvv --rpc-url http://localhost:8540 --tc DeployPriceCalculator --private-key {PRIVATE_KEY} && rm -rf broadcast/*/*/run-1*.json && rm -rf cache/*/*/run-1*.json""" + fmt"""cd {submodulePath} && {forgePath} script script/Deploy.s.sol --broadcast -vvvv --rpc-url http://localhost:8540 --tc DeployPriceCalculator --private-key {privateKey} && rm -rf broadcast/*/*/run-1*.json && rm -rf cache/*/*/run-1*.json""" let (outputDeployPriceCalculator, exitCodeDeployPriceCalculator) = execCmdEx(forgeCmdPriceCalculator) debug "Executed forge command to deploy LinearPriceCalculator contract", @@ -405,7 +408,7 @@ proc executeForgeContractDeployScripts*( putEnv("PRICE_CALCULATOR_ADDRESS", priceCalculatorAddress) let forgeCmdWakuRln = - fmt"""cd {submodulePath} && {forgePath} script script/Deploy.s.sol --broadcast -vvvv --rpc-url http://localhost:8540 --tc DeployWakuRlnV2 --private-key {PRIVATE_KEY} && rm -rf broadcast/*/*/run-1*.json && rm -rf cache/*/*/run-1*.json""" + fmt"""cd {submodulePath} && {forgePath} script script/Deploy.s.sol --broadcast -vvvv --rpc-url http://localhost:8540 --tc DeployWakuRlnV2 --private-key {privateKey} && rm -rf broadcast/*/*/run-1*.json && rm -rf cache/*/*/run-1*.json""" let (outputDeployWakuRln, exitCodeDeployWakuRln) = execCmdEx(forgeCmdWakuRln) debug "Executed forge command to deploy WakuRlnV2 contract", output = outputDeployWakuRln @@ -425,7 +428,7 @@ proc executeForgeContractDeployScripts*( # Deploy Proxy contract let forgeCmdProxy = - fmt"""cd {submodulePath} && {forgePath} script script/Deploy.s.sol --broadcast -vvvv --rpc-url http://localhost:8540 --tc DeployProxy --private-key {PRIVATE_KEY} && rm -rf broadcast/*/*/run-1*.json && rm -rf cache/*/*/run-1*.json""" + fmt"""cd {submodulePath} && {forgePath} script script/Deploy.s.sol --broadcast -vvvv --rpc-url http://localhost:8540 --tc DeployProxy --private-key {privateKey} && rm -rf broadcast/*/*/run-1*.json && rm -rf cache/*/*/run-1*.json""" let (outputDeployProxy, exitCodeDeployProxy) = execCmdEx(forgeCmdProxy) debug "Executed forge command to deploy proxy contract", output = outputDeployProxy if exitCodeDeployProxy != 0: diff --git a/waku/factory/networks_config.nim b/waku/factory/networks_config.nim index 91ab50aef..619a1a7c5 100644 --- a/waku/factory/networks_config.nim +++ b/waku/factory/networks_config.nim @@ -39,7 +39,7 @@ proc TheWakuNetworkConf*(T: type ClusterConf): ClusterConf = rlnRelayDynamic: true, rlnRelayChainId: RelayChainId, rlnEpochSizeSec: 600, - rlnRelayUserMessageLimit: 20, + rlnRelayUserMessageLimit: 100, numShardsInNetwork: 8, discv5Discovery: true, discv5BootstrapNodes: