From 7d3f6d2305e65877c5205eb0bf53aeab986842ea Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 7 Aug 2024 20:44:35 +0800 Subject: [PATCH] test: two on chain tests --- tests/relay/test_rln.py | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/relay/test_rln.py b/tests/relay/test_rln.py index 62ebda767b4..0359bf0db1e 100644 --- a/tests/relay/test_rln.py +++ b/tests/relay/test_rln.py @@ -152,28 +152,28 @@ def test_valid_payloads_dynamic_at_slow_rate(self): if i == message_limit - 1: break - # @pytest.mark.timeout(600) - # @pytest.mark.usefixtures("register_main_rln_relay_nodes") - # def test_valid_payloads_dynamic_at_spam_rate(self): - # message_limit = 100 - # epoch_sec = 600 - # self.setup_main_rln_relay_nodes( - # rln_relay_user_message_limit=message_limit, rln_relay_epoch_sec=epoch_sec, rln_relay_dynamic="true", wait_for_node_sec=600 - # ) - # self.subscribe_main_relay_nodes() - # start = math.trunc(time()) - # for i, payload in enumerate(self.SAMPLE_INPUTS_RLN): - # logger.debug(f'Running test with payload {payload["description"]}') - # message = self.create_message(payload=to_base64(payload["value"])) - # try: - # logger.debug(f"Sending message No. #{i + 1}") - # now = math.trunc(time()) - # self.publish_message(message) - # if i > message_limit and (now - start) <= epoch_sec: - # raise AssertionError("Publish with RLN enabled at spam rate worked!!!") - # except Exception as e: - # assert "RLN validation failed" or "NonceLimitReached" in str(e) - # + @pytest.mark.timeout(600) + @pytest.mark.usefixtures("register_main_rln_relay_nodes") + def test_valid_payloads_dynamic_at_spam_rate(self): + message_limit = 100 + epoch_sec = 600 + self.setup_main_rln_relay_nodes( + rln_relay_user_message_limit=message_limit, rln_relay_epoch_sec=epoch_sec, rln_relay_dynamic="true", wait_for_node_sec=600 + ) + self.subscribe_main_relay_nodes() + start = math.trunc(time()) + for i, payload in enumerate(self.SAMPLE_INPUTS_RLN): + logger.debug(f'Running test with payload {payload["description"]}') + message = self.create_message(payload=to_base64(payload["value"])) + try: + logger.debug(f"Sending message No. #{i + 1}") + now = math.trunc(time()) + self.publish_message(message) + if i > message_limit and (now - start) <= epoch_sec: + raise AssertionError("Publish with RLN enabled at spam rate worked!!!") + except Exception as e: + assert "RLN validation failed" or "NonceLimitReached" in str(e) + # def test_valid_payloads_n1_with_rln_n2_without_rln_at_spam_rate(self): # message_limit = 1 # epoch_sec = 1