From b35244891c0621590f0a7af0ea4ae6feef482b4c Mon Sep 17 00:00:00 2001 From: George Avsetsin Date: Thu, 21 Nov 2024 18:59:38 +0300 Subject: [PATCH] fix: test for not started oracle report processing --- tests/acceptance/test_accounting_oracle_negative.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/test_accounting_oracle_negative.py b/tests/acceptance/test_accounting_oracle_negative.py index 3d3f959e..c8aa20ed 100644 --- a/tests/acceptance/test_accounting_oracle_negative.py +++ b/tests/acceptance/test_accounting_oracle_negative.py @@ -43,8 +43,8 @@ def test_sender_not_allowed(accounting_oracle: Contract, oracle_version: int, st def test_submitConsensusReport(accounting_oracle: Contract, hash_consensus: Contract) -> None: + report_if_processing_not_started(accounting_oracle) last_processing_ref_slot = accounting_oracle.getLastProcessingRefSlot() - far_future = 172191406800 with reverts( encode_error( @@ -68,7 +68,7 @@ def test_submitConsensusReport(accounting_oracle: Contract, hash_consensus: Cont accounting_oracle.submitConsensusReport( NON_ZERO_HASH, last_processing_ref_slot, - far_future, + chain.time(), {"from": hash_consensus}, ) @@ -85,12 +85,13 @@ def test_submitConsensusReport(accounting_oracle: Contract, hash_consensus: Cont accounting_oracle.submitConsensusReport( ZERO_HASH, last_processing_ref_slot + 1, - far_future, + chain.time(), {"from": hash_consensus}, ) def test_discardConsensusReport(accounting_oracle: Contract, hash_consensus: Contract) -> None: + report_if_processing_not_started(accounting_oracle) last_processing_ref_slot = accounting_oracle.getLastProcessingRefSlot() with reverts( @@ -698,6 +699,12 @@ def wrapped(report: AccountingReport) -> None: # === Helpers === +def report_if_processing_not_started(accounting_oracle: Contract) -> None: + (_, _, _, is_processing_started) = accounting_oracle.getConsensusReport() + if not is_processing_started: + oracle_report() + + def build_extra_data_item( index: int, type_: ItemType,