Skip to content

Commit

Permalink
fix: test for not started oracle report processing
Browse files Browse the repository at this point in the history
  • Loading branch information
avsetsin committed Nov 21, 2024
1 parent 057f5b5 commit b352448
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/acceptance/test_accounting_oracle_negative.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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},
)

Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit b352448

Please sign in to comment.