539 lines
19 KiB
Python
Raw Normal View History

chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
import errno
import json
2023-11-01 14:02:29 +02:00
import os
2024-08-20 14:11:36 +03:00
import random
import re
import shutil
2024-08-20 14:11:36 +03:00
import string
import pytest
import requests
from src.libs.common import delay
from src.libs.custom_logger import get_custom_logger
2023-11-01 14:02:29 +02:00
from tenacity import retry, stop_after_delay, wait_fixed
2023-11-03 17:01:00 +02:00
from src.node.api_clients.rest import REST
2023-11-01 14:02:29 +02:00
from src.node.docker_mananger import DockerManager
from src.env_vars import DOCKER_LOG_DIR
2023-11-01 14:02:29 +02:00
from src.data_storage import DS
from src.test_data import DEFAULT_CLUSTER_ID, LOG_ERROR_KEYWORDS
2023-11-01 14:02:29 +02:00
logger = get_custom_logger(__name__)
2023-11-01 14:02:29 +02:00
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
def select_private_key(prv_keys, key_id):
for key in prv_keys:
if key.endswith(key_id):
return key
raise ValueError("No matching key was found")
def sanitize_docker_flags(input_flags):
output_flags = {}
for key, value in input_flags.items():
key = key.replace("_", "-")
output_flags[key] = value
return output_flags
chore: RLN relay tests (#30) * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: move RLN related code into separate class * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: reformated with pre-commit * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: rebase onto master * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * test: re-test again after rebase * fix: wait longer for credential store * test: try again with Discord report off * fix: enable Discord - delete test workflow
2024-05-07 08:31:12 +08:00
@retry(stop=stop_after_delay(180), wait=wait_fixed(0.5), reraise=True)
chore: RLNv2 tests update (#62) * test: node startup time for valid_payloads_dynamic_at_slow_rate * fix: remove timing debug info * fix: reuse existing keystore file * fix: remove skip marks for PR2612 * fix: remove skip marks for Issue 2837 * test: change valid_payloads_at_slow_rate to send 102 messages * fix: remove existing keystore before new registration * test: magical 20 messages * fix: omit RLN params for static mode - update test_valid_payloads_at_slow_rate - update test_valid_payloads_at_spam_rate * fix: condition check for rln-relay-dynamic * fix: update static tests - update test_valid_payloads_dynamic_at_slow_rate * fix: add rln-relay-user-message-limit to registration * fix: on-chain tests * fix: valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate * fix: rename lrn method for lightpush setup - delete test_valid_payloads_mixed_epoch_at_slow_rate * fix: test_valid_payloads_lightpush_at_spam_rate * fix: run registration only when necessary * fix: reorder tests - lightpush first - test workflow * fix: use touch instead of unlink * test: single test only test_valid_payloads_lightpush_at_spam_rate * test: run 2 tests * fix: remove reporting part from test workflow * fix: all tests * fix: use rmtree on keystore dir_path * fix: use external rm * fix: enable all RLN tests * fix: further optimize number or registrations * test: single on chain test * test: two on chain tests * test: swap order of tests * test: reduce test logging and output docker log * fix: rewrite keystore path related logic * fix: use cache for keystore prefixes * fix: index in setup_optional_rln_relay_nodes * fix: delete test workflows - revert env_vars
2024-08-09 16:13:17 +08:00
def rln_credential_store_ready(creds_file_path, single_check=False):
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
if os.path.exists(creds_file_path):
return True
chore: RLNv2 tests update (#62) * test: node startup time for valid_payloads_dynamic_at_slow_rate * fix: remove timing debug info * fix: reuse existing keystore file * fix: remove skip marks for PR2612 * fix: remove skip marks for Issue 2837 * test: change valid_payloads_at_slow_rate to send 102 messages * fix: remove existing keystore before new registration * test: magical 20 messages * fix: omit RLN params for static mode - update test_valid_payloads_at_slow_rate - update test_valid_payloads_at_spam_rate * fix: condition check for rln-relay-dynamic * fix: update static tests - update test_valid_payloads_dynamic_at_slow_rate * fix: add rln-relay-user-message-limit to registration * fix: on-chain tests * fix: valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate * fix: rename lrn method for lightpush setup - delete test_valid_payloads_mixed_epoch_at_slow_rate * fix: test_valid_payloads_lightpush_at_spam_rate * fix: run registration only when necessary * fix: reorder tests - lightpush first - test workflow * fix: use touch instead of unlink * test: single test only test_valid_payloads_lightpush_at_spam_rate * test: run 2 tests * fix: remove reporting part from test workflow * fix: all tests * fix: use rmtree on keystore dir_path * fix: use external rm * fix: enable all RLN tests * fix: further optimize number or registrations * test: single on chain test * test: two on chain tests * test: swap order of tests * test: reduce test logging and output docker log * fix: rewrite keystore path related logic * fix: use cache for keystore prefixes * fix: index in setup_optional_rln_relay_nodes * fix: delete test workflows - revert env_vars
2024-08-09 16:13:17 +08:00
elif not single_check:
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), creds_file_path)
chore: RLNv2 tests update (#62) * test: node startup time for valid_payloads_dynamic_at_slow_rate * fix: remove timing debug info * fix: reuse existing keystore file * fix: remove skip marks for PR2612 * fix: remove skip marks for Issue 2837 * test: change valid_payloads_at_slow_rate to send 102 messages * fix: remove existing keystore before new registration * test: magical 20 messages * fix: omit RLN params for static mode - update test_valid_payloads_at_slow_rate - update test_valid_payloads_at_spam_rate * fix: condition check for rln-relay-dynamic * fix: update static tests - update test_valid_payloads_dynamic_at_slow_rate * fix: add rln-relay-user-message-limit to registration * fix: on-chain tests * fix: valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate * fix: rename lrn method for lightpush setup - delete test_valid_payloads_mixed_epoch_at_slow_rate * fix: test_valid_payloads_lightpush_at_spam_rate * fix: run registration only when necessary * fix: reorder tests - lightpush first - test workflow * fix: use touch instead of unlink * test: single test only test_valid_payloads_lightpush_at_spam_rate * test: run 2 tests * fix: remove reporting part from test workflow * fix: all tests * fix: use rmtree on keystore dir_path * fix: use external rm * fix: enable all RLN tests * fix: further optimize number or registrations * test: single on chain test * test: two on chain tests * test: swap order of tests * test: reduce test logging and output docker log * fix: rewrite keystore path related logic * fix: use cache for keystore prefixes * fix: index in setup_optional_rln_relay_nodes * fix: delete test workflows - revert env_vars
2024-08-09 16:13:17 +08:00
return False
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
def peer_info2multiaddr(peer, is_nwaku=True):
if is_nwaku:
return peer["multiaddr"]
else:
return peer["multiaddrs"][0]
def peer_info2id(peer, is_nwaku=True):
return peer_info2multiaddr(peer, is_nwaku).split("/")[-1]
def multiaddr2id(multiaddr):
return multiaddr.split("/")[-1]
def resolve_sharding_flags(kwargs):
if "pubsub_topic" in kwargs:
pubsub_topic = kwargs["pubsub_topic"]
if not "cluster_id" in kwargs:
try:
if isinstance(pubsub_topic, list):
pubsub_topic = pubsub_topic[0]
cluster_id = pubsub_topic.split("/")[4]
logger.debug(f"Cluster id was resolved to: {cluster_id}")
kwargs["cluster_id"] = cluster_id
except Exception as ex:
raise Exception("Could not resolve cluster_id from pubsub_topic")
return kwargs
2023-11-01 14:02:29 +02:00
class WakuNode:
2023-11-01 16:44:42 +02:00
def __init__(self, docker_image, docker_log_prefix=""):
2023-11-01 14:02:29 +02:00
self._image_name = docker_image
self._log_path = os.path.join(DOCKER_LOG_DIR, f"{docker_log_prefix}__{self._image_name.replace('/', '_')}.log")
2023-11-01 14:02:29 +02:00
self._docker_manager = DockerManager(self._image_name)
self._container = None
logger.debug(f"WakuNode instance initialized with log path {self._log_path}")
@retry(stop=stop_after_delay(60), wait=wait_fixed(0.1), reraise=True)
def start(self, wait_for_node_sec=20, **kwargs):
logger.debug("Starting Node...")
self._docker_manager.create_network()
2023-11-01 14:02:29 +02:00
self._ext_ip = self._docker_manager.generate_random_ext_ip()
2023-11-03 17:01:00 +02:00
self._ports = self._docker_manager.generate_ports()
self._rest_port = self._ports[0]
self._tcp_port = self._ports[1]
self._websocket_port = self._ports[2]
self._discv5_port = self._ports[3]
self._metrics_port = self._ports[4]
self._api = REST(self._rest_port)
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
self._volumes = []
2023-11-01 14:02:29 +02:00
default_args = {
"listen-address": "0.0.0.0",
2023-11-03 17:01:00 +02:00
"rest": "true",
"rest-admin": "true",
2023-11-01 14:02:29 +02:00
"websocket-support": "true",
"log-level": "TRACE",
"rest-relay-cache-capacity": "100",
"websocket-port": self._websocket_port,
2023-11-03 17:01:00 +02:00
"rest-port": self._rest_port,
"tcp-port": self._tcp_port,
"discv5-udp-port": self._discv5_port,
2023-11-03 17:01:00 +02:00
"rest-address": "0.0.0.0",
2023-11-01 14:02:29 +02:00
"nat": f"extip:{self._ext_ip}",
"peer-exchange": "true",
"discv5-discovery": "true",
"cluster-id": DEFAULT_CLUSTER_ID,
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
"rln-creds-id": None,
"rln-creds-source": None,
2024-08-20 14:11:36 +03:00
"nodekey": self.generate_random_nodekey(),
# "max-connections": "50",
# "filter-subscription-timeout": "600",
2023-11-01 14:02:29 +02:00
}
if self.is_gowaku():
2023-11-01 14:02:29 +02:00
go_waku_args = {
"min-relay-peers-to-publish": "1",
2023-11-01 14:02:29 +02:00
"log-level": "DEBUG",
"rest-filter-cache-capacity": "50",
2024-07-04 11:59:54 +03:00
"peer-store-capacity": "10",
2023-11-01 14:02:29 +02:00
}
default_args.update(go_waku_args)
elif self.is_nwaku():
nwaku_args = {
2024-04-29 12:44:25 +03:00
"shard": "0",
"metrics-server": "true",
"metrics-server-address": "0.0.0.0",
"metrics-server-port": self._metrics_port,
"metrics-logging": "true",
}
default_args.update(nwaku_args)
else:
raise NotImplementedError("Not implemented for this node type")
2023-11-01 14:02:29 +02:00
if "remove_container" in kwargs:
remove_container = kwargs["remove_container"]
del kwargs["remove_container"]
else:
remove_container = True
kwargs = self.parse_peer_persistence_config(kwargs)
kwargs = resolve_sharding_flags(kwargs)
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
default_args.update(sanitize_docker_flags(kwargs))
rln_args, rln_creds_set, keystore_path = self.parse_rln_credentials(default_args, False)
chore: RLNv2 tests update (#62) * test: node startup time for valid_payloads_dynamic_at_slow_rate * fix: remove timing debug info * fix: reuse existing keystore file * fix: remove skip marks for PR2612 * fix: remove skip marks for Issue 2837 * test: change valid_payloads_at_slow_rate to send 102 messages * fix: remove existing keystore before new registration * test: magical 20 messages * fix: omit RLN params for static mode - update test_valid_payloads_at_slow_rate - update test_valid_payloads_at_spam_rate * fix: condition check for rln-relay-dynamic * fix: update static tests - update test_valid_payloads_dynamic_at_slow_rate * fix: add rln-relay-user-message-limit to registration * fix: on-chain tests * fix: valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate * fix: rename lrn method for lightpush setup - delete test_valid_payloads_mixed_epoch_at_slow_rate * fix: test_valid_payloads_lightpush_at_spam_rate * fix: run registration only when necessary * fix: reorder tests - lightpush first - test workflow * fix: use touch instead of unlink * test: single test only test_valid_payloads_lightpush_at_spam_rate * test: run 2 tests * fix: remove reporting part from test workflow * fix: all tests * fix: use rmtree on keystore dir_path * fix: use external rm * fix: enable all RLN tests * fix: further optimize number or registrations * test: single on chain test * test: two on chain tests * test: swap order of tests * test: reduce test logging and output docker log * fix: rewrite keystore path related logic * fix: use cache for keystore prefixes * fix: index in setup_optional_rln_relay_nodes * fix: delete test workflows - revert env_vars
2024-08-09 16:13:17 +08:00
default_args.pop("rln-creds-id", None)
default_args.pop("rln-creds-source", None)
default_args.pop("rln-keystore-prefix", None)
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
if rln_creds_set:
rln_credential_store_ready(keystore_path)
default_args.update(rln_args)
else:
logger.info(f"RLN credentials not set or credential store not available, starting without RLN")
chore: RLN relay tests (#30) * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: move RLN related code into separate class * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: reformated with pre-commit * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: rebase onto master * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * test: re-test again after rebase * fix: wait longer for credential store * test: try again with Discord report off * fix: enable Discord - delete test workflow
2024-05-07 08:31:12 +08:00
logger.debug(f"Using volumes {self._volumes}")
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
self._container = self._docker_manager.start_container(
self._docker_manager.image,
ports=self._ports,
args=default_args,
log_path=self._log_path,
container_ip=self._ext_ip,
volumes=self._volumes,
remove_container=remove_container,
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
)
2023-11-01 14:02:29 +02:00
logger.debug(f"Started container from image {self._image_name}. REST: {self._rest_port}")
2023-11-01 14:02:29 +02:00
DS.waku_nodes.append(self)
delay(1) # if we fire requests to soon after starting the node will sometimes fail to start correctly
2023-11-01 14:02:29 +02:00
try:
chore: RLN relay tests (#30) * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: move RLN related code into separate class * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: reformated with pre-commit * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: rebase onto master * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * test: re-test again after rebase * fix: wait longer for credential store * test: try again with Discord report off * fix: enable Discord - delete test workflow
2024-05-07 08:31:12 +08:00
self.ensure_ready(timeout_duration=wait_for_node_sec)
except Exception as ex:
logger.error(f"REST service did not become ready in time: {ex}")
2023-11-01 14:02:29 +02:00
raise
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
@retry(stop=stop_after_delay(250), wait=wait_fixed(0.1), reraise=True)
def register_rln(self, **kwargs):
logger.debug("Registering RLN credentials...")
self._docker_manager.create_network()
self._ext_ip = self._docker_manager.generate_random_ext_ip()
self._ports = self._docker_manager.generate_ports()
self._rest_port = self._ports[0]
self._api = REST(self._rest_port)
self._volumes = []
chore: RLNv2 tests update (#62) * test: node startup time for valid_payloads_dynamic_at_slow_rate * fix: remove timing debug info * fix: reuse existing keystore file * fix: remove skip marks for PR2612 * fix: remove skip marks for Issue 2837 * test: change valid_payloads_at_slow_rate to send 102 messages * fix: remove existing keystore before new registration * test: magical 20 messages * fix: omit RLN params for static mode - update test_valid_payloads_at_slow_rate - update test_valid_payloads_at_spam_rate * fix: condition check for rln-relay-dynamic * fix: update static tests - update test_valid_payloads_dynamic_at_slow_rate * fix: add rln-relay-user-message-limit to registration * fix: on-chain tests * fix: valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate * fix: rename lrn method for lightpush setup - delete test_valid_payloads_mixed_epoch_at_slow_rate * fix: test_valid_payloads_lightpush_at_spam_rate * fix: run registration only when necessary * fix: reorder tests - lightpush first - test workflow * fix: use touch instead of unlink * test: single test only test_valid_payloads_lightpush_at_spam_rate * test: run 2 tests * fix: remove reporting part from test workflow * fix: all tests * fix: use rmtree on keystore dir_path * fix: use external rm * fix: enable all RLN tests * fix: further optimize number or registrations * test: single on chain test * test: two on chain tests * test: swap order of tests * test: reduce test logging and output docker log * fix: rewrite keystore path related logic * fix: use cache for keystore prefixes * fix: index in setup_optional_rln_relay_nodes * fix: delete test workflows - revert env_vars
2024-08-09 16:13:17 +08:00
default_args = {"rln-creds-id": None, "rln-creds-source": None, "rln-relay-user-message-limit-registration": 100}
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
default_args.update(sanitize_docker_flags(kwargs))
rln_args, rln_creds_set, keystore_path = self.parse_rln_credentials(default_args, True)
if rln_creds_set:
self._container = self._docker_manager.start_container(
self._docker_manager.image, self._ports, rln_args, self._log_path, self._ext_ip, self._volumes
)
logger.debug(f"Executed container from image {self._image_name}. REST: {self._rest_port} to register RLN")
logger.debug(f"Waiting for keystore {keystore_path}")
try:
rln_credential_store_ready(keystore_path)
except Exception as ex:
logger.error(f"File {keystore_path} with RLN credentials did not become available in time {ex}")
raise
else:
logger.warn("RLN credentials not set, no action performed")
2023-11-01 14:02:29 +02:00
@retry(stop=stop_after_delay(5), wait=wait_fixed(0.1), reraise=True)
def stop(self):
if self._container:
logger.debug(f"Stopping container with id {self._container.short_id}")
2023-11-01 14:02:29 +02:00
self._container.stop()
try:
self._container.remove()
except:
pass
self._container = None
2023-11-01 14:02:29 +02:00
logger.debug("Container stopped.")
@retry(stop=stop_after_delay(5), wait=wait_fixed(0.1), reraise=True)
def kill(self):
if self._container:
logger.debug(f"Killing container with id {self._container.short_id}")
self._container.kill()
try:
self._container.remove()
except:
pass
self._container = None
logger.debug("Container killed.")
def restart(self):
if self._container:
logger.debug(f"Restarting container with id {self._container.short_id}")
self._container.restart()
def pause(self):
if self._container:
logger.debug(f"Pausing container with id {self._container.short_id}")
self._container.pause()
def unpause(self):
if self._container:
logger.debug(f"Unpause container with id {self._container.short_id}")
self._container.unpause()
chore: RLN relay tests (#30) * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: move RLN related code into separate class * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: reformated with pre-commit * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: rebase onto master * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * test: re-test again after rebase * fix: wait longer for credential store * test: try again with Discord report off * fix: enable Discord - delete test workflow
2024-05-07 08:31:12 +08:00
def ensure_ready(self, timeout_duration=10):
@retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(0.1), reraise=True)
def check_healthy(node=self):
self.health_response = node.health()
if self.health_response == b"Node is healthy":
logger.info("Node is healthy !!")
return
try:
self.health_response = json.loads(self.health_response)
except Exception as ex:
raise AttributeError(f"Unknown health response format {ex}")
if self.health_response.get("nodeHealth") != "Ready":
raise AssertionError("Waiting for the node health status: Ready")
for p in self.health_response.get("protocolsHealth"):
if p.get("Rln Relay") != "Ready":
raise AssertionError("Waiting for the Rln relay status: Ready")
logger.info("Node protocols are initialized !!")
@retry(stop=stop_after_delay(timeout_duration), wait=wait_fixed(0.1), reraise=True)
chore: RLN relay tests (#30) * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: move RLN related code into separate class * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: reformated with pre-commit * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: rebase onto master * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * test: re-test again after rebase * fix: wait longer for credential store * test: try again with Discord report off * fix: enable Discord - delete test workflow
2024-05-07 08:31:12 +08:00
def check_ready(node=self):
node.info_response = node.info()
logger.info("REST service is ready !!")
if self.is_nwaku():
check_healthy()
chore: RLN relay tests (#30) * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: move RLN related code into separate class * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: reformated with pre-commit * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: rebase onto master * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * test: re-test again after rebase * fix: wait longer for credential store * test: try again with Discord report off * fix: enable Discord - delete test workflow
2024-05-07 08:31:12 +08:00
check_ready()
def get_id(self):
try:
return self.info_response["listenAddresses"][0].split("/")[-1]
except Exception as ex:
raise AttributeError(f"Could not find ID in the info call because of error: {str(ex)}")
def get_enr_uri(self):
try:
return self.info_response["enrUri"]
except Exception as ex:
raise AttributeError(f"Could not find enrUri in the info call because of error: {str(ex)}")
def get_multiaddr_with_id(self):
addresses = self.info_response.get("listenAddresses", [])
ws_address = next((addr for addr in addresses if "/ws" not in addr), None)
if ws_address:
identifier = ws_address.split("/p2p/")[-1]
2024-08-30 14:15:45 +03:00
new_address = f"{self.get_tcp_address()}/p2p/{identifier}"
return new_address
else:
raise AttributeError("No '/ws' address found")
2024-08-30 14:15:45 +03:00
def get_tcp_address(self):
return f"/ip4/{self._ext_ip}/tcp/{self._tcp_port}"
2023-11-01 14:02:29 +02:00
def info(self):
2023-11-03 17:01:00 +02:00
return self._api.info()
2023-11-01 14:02:29 +02:00
chore: RLN relay tests (#30) * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: move RLN related code into separate class * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: reformated with pre-commit * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * fix: add get_multiaddr_with_id step - temporarily use local docker images * fix: discard containers used for RLN registration * fix: switch to use cluster ID 1 for RLN * test: publish at slow and spam rate * fix: shorten test data set * fix: rebase onto master * fix: use send only publish function - add spam and alternate rate tests * fix: use math.trunc instead of rounding * fix: first message without delay * fix: add one more second to messages with delay * fix: add methods to setup non default RLN nodes * fix: rewrite tests using steps rather than fixtures - prepare for non default settings for RLN * test: random epoch with valid_payloads_at_slow_rate * test: random user message limit with valid payloads * fix: skip test "random user message limit with valid payloads" * fix: mark flaky "at variable_rate with valid payloads" * fix: rename tests for easier debugging * fix: mark valid_payloads_dynamic_at_slow_rate to skip * fix: forgot to add actual file * test: valid payloads dynamic(on chain) at spam rate - extend timeout for ensure_ready() to 600s - add ensure_healthy() for future use - add text content based rest call - remove NODE1, NODE2 imports * fix: revert env_vars to source images from Harbor * fix: reuse setup first and second rln relay node for setup_main_rln_relay_nodes * fix: reuse register_rln_single_node for register_main_rln_relay_nodes * fix: start using src.steps.common - removed RLN test class inheritance from StepsRelay * fix: test using whole data set at test payloads_at_slow_rate * fix: switch to send msg and check for slow rate tests * fix: add comment for skip check at first message * fix: refactor payloads_at_variable_rate to use only one payload pattern * fix: remove the plural from payloads_at_variable_rate * fix: multiple class inheritance for TestRelayRLN * test: node1 with rln node2 without rln at spam rate * test: mixed epoch at slow rate * test: add lightpush methods * test: send valid payloads lightpush at spam rate * fix: node1 to act as light push receiving node - add setup lightpush node to spin off node2 with lightpush support * fix: use NODE1 NODE2 instead of DEFAULT_NWAKU * fix: no lightpush param required for plain RLN relay * fix: comment for lightpush * fix: comment for lightpush - wait for implementation * fix: comment on chain tests * fix: add lightpush case to publish_message * fix: remove check_light_pushed_message_reaches_receiving_peer from StepsRLN * fix: change comment for mixed_epoch_at_slow_rate * test: happy and common case with 5 nodes * fix: add all required fixtures explicitly * fix: add timeout param to ensure_ready * fix: skip RLN tests for go-waku * fix: uncomment skip for debugging * fix: put the skip back * fix: change comment for on chain tests * fix: run RLN tests in serial - add grouping of tests to runner - use smaller dataset for spam rate tests * test: Nim to Nim workflow * test: check also additional nodes for go-waku * test: all nodes are nwaku * fix: string quotes * fix: remove additional nodes * fix: re-arrange skip conditions * test: RLN only * fix: change default additional nodes to nwaku only * fix: change additional nodes rather at top level workflow * fix: enable all tests * test: problems with current workdir * test: rln only * test: correct typo * test: re-enable all tests - remove current dir debug * fix: nwaku additional nodes for nim to nim worklfow * fix: re-able discord notification - delete test workflow * test: re-test again after rebase * fix: wait longer for credential store * test: try again with Discord report off * fix: enable Discord - delete test workflow
2024-05-07 08:31:12 +08:00
def health(self):
return self._api.health()
def get_peers(self):
return self._api.get_peers()
def add_peers(self, peers):
return self._api.add_peers(peers)
def set_relay_subscriptions(self, pubsub_topics):
return self._api.set_relay_subscriptions(pubsub_topics)
2023-11-01 14:02:29 +02:00
def set_relay_auto_subscriptions(self, content_topics):
return self._api.set_relay_auto_subscriptions(content_topics)
def delete_relay_subscriptions(self, pubsub_topics):
return self._api.delete_relay_subscriptions(pubsub_topics)
def delete_relay_auto_subscriptions(self, content_topics):
return self._api.delete_relay_auto_subscriptions(content_topics)
def send_relay_message(self, message, pubsub_topic):
return self._api.send_relay_message(message, pubsub_topic)
def send_relay_auto_message(self, message):
return self._api.send_relay_auto_message(message)
def send_light_push_message(self, payload):
return self._api.send_light_push_message(payload)
def get_relay_messages(self, pubsub_topic):
return self._api.get_relay_messages(pubsub_topic)
def get_relay_auto_messages(self, content_topic):
return self._api.get_relay_auto_messages(content_topic)
def set_filter_subscriptions(self, subscription):
return self._api.set_filter_subscriptions(subscription)
def update_filter_subscriptions(self, subscription):
return self._api.update_filter_subscriptions(subscription)
2023-11-01 14:02:29 +02:00
def delete_filter_subscriptions(self, subscription):
return self._api.delete_filter_subscriptions(subscription)
def delete_all_filter_subscriptions(self, request_id):
return self._api.delete_all_filter_subscriptions(request_id)
def ping_filter_subscriptions(self, request_id):
return self._api.ping_filter_subscriptions(request_id)
def get_filter_messages(self, content_topic, pubsub_topic=None):
return self._api.get_filter_messages(content_topic, pubsub_topic)
def get_store_messages(
self,
peer_addr=None,
include_data=None,
pubsub_topic=None,
content_topics=None,
start_time=None,
end_time=None,
hashes=None,
cursor=None,
page_size=None,
ascending=None,
store_v="v3",
**kwargs,
):
return self._api.get_store_messages(
peer_addr=peer_addr,
include_data=include_data,
pubsub_topic=pubsub_topic,
content_topics=content_topics,
start_time=start_time,
end_time=end_time,
hashes=hashes,
cursor=cursor,
page_size=page_size,
ascending=ascending,
store_v=store_v,
**kwargs,
)
def get_metrics(self):
if self.is_nwaku():
metrics = requests.get(f"http://localhost:{self._metrics_port}/metrics")
metrics.raise_for_status()
return metrics.content.decode("utf-8")
else:
pytest.skip(f"This method doesn't exist for node {self.type()}")
@property
def image(self):
return self._image_name
def type(self):
if self.is_nwaku():
return "nwaku"
elif self.is_gowaku():
return "gowaku"
else:
raise ValueError("Unknown node type!!!")
def is_nwaku(self):
return "nwaku" in self.image
def is_gowaku(self):
return "go-waku" in self.image
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
def parse_rln_credentials(self, default_args, is_registration):
rln_args = {}
keystore_path = None
rln_creds_source = default_args["rln-creds-source"]
selected_id = default_args["rln-creds-id"]
if rln_creds_source is None or selected_id is None:
logger.debug(f"RLN credentials were not set")
return rln_args, False, keystore_path
imported_creds = json.loads(rln_creds_source)
if len(imported_creds) < 4 or any(value is None for value in imported_creds.values()):
logger.warn(f"One or more of required RLN credentials were not set properly")
return rln_args, False, keystore_path
eth_private_key = select_private_key(imported_creds, selected_id)
chore: RLNv2 tests update (#62) * test: node startup time for valid_payloads_dynamic_at_slow_rate * fix: remove timing debug info * fix: reuse existing keystore file * fix: remove skip marks for PR2612 * fix: remove skip marks for Issue 2837 * test: change valid_payloads_at_slow_rate to send 102 messages * fix: remove existing keystore before new registration * test: magical 20 messages * fix: omit RLN params for static mode - update test_valid_payloads_at_slow_rate - update test_valid_payloads_at_spam_rate * fix: condition check for rln-relay-dynamic * fix: update static tests - update test_valid_payloads_dynamic_at_slow_rate * fix: add rln-relay-user-message-limit to registration * fix: on-chain tests * fix: valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate * fix: rename lrn method for lightpush setup - delete test_valid_payloads_mixed_epoch_at_slow_rate * fix: test_valid_payloads_lightpush_at_spam_rate * fix: run registration only when necessary * fix: reorder tests - lightpush first - test workflow * fix: use touch instead of unlink * test: single test only test_valid_payloads_lightpush_at_spam_rate * test: run 2 tests * fix: remove reporting part from test workflow * fix: all tests * fix: use rmtree on keystore dir_path * fix: use external rm * fix: enable all RLN tests * fix: further optimize number or registrations * test: single on chain test * test: two on chain tests * test: swap order of tests * test: reduce test logging and output docker log * fix: rewrite keystore path related logic * fix: use cache for keystore prefixes * fix: index in setup_optional_rln_relay_nodes * fix: delete test workflows - revert env_vars
2024-08-09 16:13:17 +08:00
cwd = os.getcwd()
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
if self.is_nwaku():
if is_registration:
rln_args.update(
{
"generateRlnKeystore": None,
"--execute": None,
chore: RLNv2 tests update (#62) * test: node startup time for valid_payloads_dynamic_at_slow_rate * fix: remove timing debug info * fix: reuse existing keystore file * fix: remove skip marks for PR2612 * fix: remove skip marks for Issue 2837 * test: change valid_payloads_at_slow_rate to send 102 messages * fix: remove existing keystore before new registration * test: magical 20 messages * fix: omit RLN params for static mode - update test_valid_payloads_at_slow_rate - update test_valid_payloads_at_spam_rate * fix: condition check for rln-relay-dynamic * fix: update static tests - update test_valid_payloads_dynamic_at_slow_rate * fix: add rln-relay-user-message-limit to registration * fix: on-chain tests * fix: valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate * fix: rename lrn method for lightpush setup - delete test_valid_payloads_mixed_epoch_at_slow_rate * fix: test_valid_payloads_lightpush_at_spam_rate * fix: run registration only when necessary * fix: reorder tests - lightpush first - test workflow * fix: use touch instead of unlink * test: single test only test_valid_payloads_lightpush_at_spam_rate * test: run 2 tests * fix: remove reporting part from test workflow * fix: all tests * fix: use rmtree on keystore dir_path * fix: use external rm * fix: enable all RLN tests * fix: further optimize number or registrations * test: single on chain test * test: two on chain tests * test: swap order of tests * test: reduce test logging and output docker log * fix: rewrite keystore path related logic * fix: use cache for keystore prefixes * fix: index in setup_optional_rln_relay_nodes * fix: delete test workflows - revert env_vars
2024-08-09 16:13:17 +08:00
"rln-relay-user-message-limit": default_args["rln-relay-user-message-limit-registration"],
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
}
)
else:
rln_args.update(
{
"rln-relay": "true",
}
)
chore: RLNv2 tests update (#62) * test: node startup time for valid_payloads_dynamic_at_slow_rate * fix: remove timing debug info * fix: reuse existing keystore file * fix: remove skip marks for PR2612 * fix: remove skip marks for Issue 2837 * test: change valid_payloads_at_slow_rate to send 102 messages * fix: remove existing keystore before new registration * test: magical 20 messages * fix: omit RLN params for static mode - update test_valid_payloads_at_slow_rate - update test_valid_payloads_at_spam_rate * fix: condition check for rln-relay-dynamic * fix: update static tests - update test_valid_payloads_dynamic_at_slow_rate * fix: add rln-relay-user-message-limit to registration * fix: on-chain tests * fix: valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate * fix: rename lrn method for lightpush setup - delete test_valid_payloads_mixed_epoch_at_slow_rate * fix: test_valid_payloads_lightpush_at_spam_rate * fix: run registration only when necessary * fix: reorder tests - lightpush first - test workflow * fix: use touch instead of unlink * test: single test only test_valid_payloads_lightpush_at_spam_rate * test: run 2 tests * fix: remove reporting part from test workflow * fix: all tests * fix: use rmtree on keystore dir_path * fix: use external rm * fix: enable all RLN tests * fix: further optimize number or registrations * test: single on chain test * test: two on chain tests * test: swap order of tests * test: reduce test logging and output docker log * fix: rewrite keystore path related logic * fix: use cache for keystore prefixes * fix: index in setup_optional_rln_relay_nodes * fix: delete test workflows - revert env_vars
2024-08-09 16:13:17 +08:00
if not default_args.get("rln-relay-dynamic") and not is_registration:
rln_args.update(
{
"rln-relay-cred-path": "/keystore/keystore.json",
"rln-relay-cred-password": imported_creds["rln-relay-cred-password"],
}
)
else:
rln_args.update(
{
"rln-relay-cred-path": "/keystore/keystore.json",
"rln-relay-cred-password": imported_creds["rln-relay-cred-password"],
"rln-relay-eth-client-address": imported_creds["rln-relay-eth-client-address"],
"rln-relay-eth-contract-address": imported_creds["rln-relay-eth-contract-address"],
"rln-relay-eth-private-key": imported_creds[eth_private_key],
}
)
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
chore: RLNv2 tests update (#62) * test: node startup time for valid_payloads_dynamic_at_slow_rate * fix: remove timing debug info * fix: reuse existing keystore file * fix: remove skip marks for PR2612 * fix: remove skip marks for Issue 2837 * test: change valid_payloads_at_slow_rate to send 102 messages * fix: remove existing keystore before new registration * test: magical 20 messages * fix: omit RLN params for static mode - update test_valid_payloads_at_slow_rate - update test_valid_payloads_at_spam_rate * fix: condition check for rln-relay-dynamic * fix: update static tests - update test_valid_payloads_dynamic_at_slow_rate * fix: add rln-relay-user-message-limit to registration * fix: on-chain tests * fix: valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate * fix: rename lrn method for lightpush setup - delete test_valid_payloads_mixed_epoch_at_slow_rate * fix: test_valid_payloads_lightpush_at_spam_rate * fix: run registration only when necessary * fix: reorder tests - lightpush first - test workflow * fix: use touch instead of unlink * test: single test only test_valid_payloads_lightpush_at_spam_rate * test: run 2 tests * fix: remove reporting part from test workflow * fix: all tests * fix: use rmtree on keystore dir_path * fix: use external rm * fix: enable all RLN tests * fix: further optimize number or registrations * test: single on chain test * test: two on chain tests * test: swap order of tests * test: reduce test logging and output docker log * fix: rewrite keystore path related logic * fix: use cache for keystore prefixes * fix: index in setup_optional_rln_relay_nodes * fix: delete test workflows - revert env_vars
2024-08-09 16:13:17 +08:00
keystore_path = cwd + "/keystore_" + default_args["rln-keystore-prefix"] + "_" + selected_id + "/keystore.json"
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
self._volumes.extend(
[
chore: RLNv2 tests update (#62) * test: node startup time for valid_payloads_dynamic_at_slow_rate * fix: remove timing debug info * fix: reuse existing keystore file * fix: remove skip marks for PR2612 * fix: remove skip marks for Issue 2837 * test: change valid_payloads_at_slow_rate to send 102 messages * fix: remove existing keystore before new registration * test: magical 20 messages * fix: omit RLN params for static mode - update test_valid_payloads_at_slow_rate - update test_valid_payloads_at_spam_rate * fix: condition check for rln-relay-dynamic * fix: update static tests - update test_valid_payloads_dynamic_at_slow_rate * fix: add rln-relay-user-message-limit to registration * fix: on-chain tests * fix: valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate * fix: rename lrn method for lightpush setup - delete test_valid_payloads_mixed_epoch_at_slow_rate * fix: test_valid_payloads_lightpush_at_spam_rate * fix: run registration only when necessary * fix: reorder tests - lightpush first - test workflow * fix: use touch instead of unlink * test: single test only test_valid_payloads_lightpush_at_spam_rate * test: run 2 tests * fix: remove reporting part from test workflow * fix: all tests * fix: use rmtree on keystore dir_path * fix: use external rm * fix: enable all RLN tests * fix: further optimize number or registrations * test: single on chain test * test: two on chain tests * test: swap order of tests * test: reduce test logging and output docker log * fix: rewrite keystore path related logic * fix: use cache for keystore prefixes * fix: index in setup_optional_rln_relay_nodes * fix: delete test workflows - revert env_vars
2024-08-09 16:13:17 +08:00
cwd + "/rln_tree_" + default_args["rln-keystore-prefix"] + "_" + selected_id + ":/etc/rln_tree",
cwd + "/keystore_" + default_args["rln-keystore-prefix"] + "_" + selected_id + ":/keystore",
chore: RLN registration support (#16) * chore: parameters and volumes for RLN relay * chore: add startup test for RLN * fix: remove redundant rln_enabled from WakuNode * fix: - and _ magic in rln parameters * fix: key 'eth_testnet_key' -> 'eth_client_private_key' * fix: rln-register_only -> rln-register-only * fix: use extend instead of append for the volumes list * fix: use absolute path for the volumes names - mark volumes shared across containers * fix: remove :z attr from volumes * fix: remove filename from volume path * fix: remove request for ENR * test: plain RLN registration * fix: remove subscribe * fix: remove ENR related params * test: add run_container func to Docker Mananger * fix: remove run_container func from Docker Mananger - no need for exec * fix: pass exec commands instead of specialized docker exec func * fix: exclude RLN arguments from others * fix: separate RLN volumes by implementation * test: registration with nwaku * test: registration over existing credentials * test: add RLN Relay node startup * test: RLN credentials reuse for relay node startup * fix: clean up unnecessary commands * fix: clean up unnecessary commands for non RLN relay too * test: regression by sending one valid message * fix: add forgotten call to get enr_uri * fix: check RLN credentials set properly * fix: parenthesis in eval expression * fix: better check for RLN credentials * fix: update to new flags - gowaku - separate private key for go/nwaku * test: register RLN * fix: RLN credentials check * fix: remove enable rln-relay flag from registration * test: reorder commands to check go-waku registration * fix: restructure if statements for RLN registration * fix: different set of flag for RLN registration and operation * fix: forgotten "eth" in eth-contract-address * fix: remove redundant None from get_env_var call * fix: refactor rln credentials parsing from start function * fix: missed second return value * test: call to parse_rln_credentials * fix: remove redundant self in call to parse_rln_credentials * fix: remove rln related values if not valid * fix: refactored to accept multiple private keys - JSON source for RLN credentials - removed go-waku support for RLN * test: register RLN with 2 nwaku nodes * fix: missing open file, key errors * fix: return effective keystore_path * fix: cleanup unused env variables * fix: cleanup unused env variables from relay * fix: wait longer for credentials file to be written to disk * test: remove waiting for credentials file to be written to disk * fix: add select_private_key() * fix: merge parse_rln_credentials and parse_rln_registration_credentials * test: wait for filesystem cache * test: try with os.sync to flush cache * test: stop container to clear cache * fix: 15 sec wait + stop container to clear cache * test: RLN registration test with fixture and cred file check * test: added allure.step - RLN registration for single node - corresponding test to register all keys * fix: f-strings in the test * fix: sync naming for register_main_rln_relay_nodes * fix: add WARN message to log unset and expected RLN credentials * fix: pytest.skip added to exit tests when non nwaku image is used * fix: swap NODE2 for DEFAULT_NWAKU * fix: let rln_credential_store_ready to raise exception for retry * fix: let register_rln to raise exception too, when credential fine still not available * fix: remove container stop * fix: tune down retry timeouts * fix: remove unnecessary f-string * test: reduce unnecessary variables init * test: undo reduce unnecessary variables init * test: increase timeout for rln_credential_store_ready * test: refactor kwargs handling into sanitize_docker_flags * fix: created RLN registration check - changed rln_credential_store_ready to function * fix: delete unnecessary ports from register_rln init * fix: remove wait for registration entirely * test: RLN_CREDENTIALS env var example * fix: check_rln_registration to raise exception * fix: use f-string at check_rln_registration * fix: add gen_step_id function * fix: RLN_CREDENTIALS as loaded from .env * fix: RLN_CREDENTIALS example, skipping test if not set * test: RLN with actions * fix: tune up RLN timeouts for Github runners * test: filesystem write to / * fix: change RLN data to be stored at working directory * fix: catch exception instead of "if not" - print out container log * fix: wrap logs into debug msg * fix: print log file * fix: remove additional logging * fix: exit RLN cred parsing sooner when not used - delete proper keys from default_args * fix: Allure report * fix: Discord notifications * fix: remove f-string * fix: delete test workflow
2024-02-13 22:01:30 +08:00
]
)
else:
raise NotImplementedError("Not implemented for type other than Nim Waku ")
return rln_args, True, keystore_path
def parse_peer_persistence_config(self, kwargs):
if kwargs.get("peer_persistence") == "true":
if self.is_gowaku():
kwargs["persist_peers"] = kwargs["peer_persistence"]
del kwargs["peer_persistence"]
cwd = os.getcwd()
# Please note, as of now, peerdb is stored directly at / which is not shareable between containers.
# Volume related code is usable after https://github.com/waku-org/nwaku/issues/2792 would be resolved.
self._volumes.extend(
[
cwd + "/peerdb" + ":/shared",
]
)
shutil.rmtree(cwd + "/peerdb")
return kwargs
@property
def container(self):
return self._container
2024-08-20 14:11:36 +03:00
def generate_random_nodekey(self):
# Define the set of hexadecimal characters
hex_chars = string.hexdigits.lower()
# Generate a random 64-character string from the hex characters
random_key = "".join(random.choice(hex_chars) for _ in range(64))
return random_key
def search_waku_log_for_string(self, search_pattern, use_regex=False):
return self._docker_manager.search_log_for_keywords(self._log_path, [search_pattern], use_regex)
def check_waku_log_errors(self, whitelist=None):
keywords = LOG_ERROR_KEYWORDS
# If a whitelist is provided, remove those keywords from the keywords list
if whitelist:
keywords = [keyword for keyword in keywords if keyword not in whitelist]
matches = self._docker_manager.search_log_for_keywords(self._log_path, keywords, False)
assert not matches, f"Found errors {matches}"