Skip to content

Commit

Permalink
test: fix negative report test cases
Browse files Browse the repository at this point in the history
The operators setup has been changed drastically.
Node Operator #1 is fully exited ATM.
  • Loading branch information
TheDZhon committed Oct 25, 2023
1 parent a68403d commit 13af5d4
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions tests/acceptance/test_accounting_oracle_negative.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ class TestSubmitReportExtraDataList:
def test_too_short_extra_data_item(self):
extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [2]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 2, [1], [2])[:36],
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2], [2]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 2, [2], [2])[:36],
)
)

Expand All @@ -189,8 +189,8 @@ def test_too_short_extra_data_item(self):

extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1, 2, 3, 4], [2]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 2, [1], [2]),
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2, 3, 4, 5], [2]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 2, [2], [2]),
)
)

Expand All @@ -200,7 +200,7 @@ def test_too_short_extra_data_item(self):
def test_nos_count_zero(self):
extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [2]),
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2], [2]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 2, [], [1]),
)
)
Expand All @@ -211,20 +211,19 @@ def test_nos_count_zero(self):
def test_module_id_zero(self):
extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [2]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 0, [1], [1]),
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2], [2]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 0, [2], [1]),
)
)

with reverts(encode_error("InvalidExtraDataItem(uint256)", [1])):
self.report(extra_data)

def test_unexpected_extra_data_index(self):

extra_data = b"".join(
(
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(2, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 2, [1], [1]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2], [1]),
build_extra_data_item(2, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 2, [2], [1]),
)
)

Expand All @@ -233,8 +232,8 @@ def test_unexpected_extra_data_index(self):

extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(3, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2], [1]),
build_extra_data_item(3, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2], [1]),
)
)

Expand All @@ -243,8 +242,8 @@ def test_unexpected_extra_data_index(self):

extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2], [1]),
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2], [1]),
)
)

Expand All @@ -265,8 +264,8 @@ def test_unsupported_extra_data_type(self):
def test_invalid_extra_data_sort_order(self):
extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [1], [1]),
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2], [1]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_STUCK_VALIDATORS, 1, [2], [1]),
)
)

Expand All @@ -280,8 +279,8 @@ def test_invalid_extra_data_sort_order(self):

extra_data = b"".join(
(
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_EXITED_VALIDATORS, 1, [1], [1]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_EXITED_VALIDATORS, 1, [1], [1]),
build_extra_data_item(0, ItemType.EXTRA_DATA_TYPE_EXITED_VALIDATORS, 1, [38], [1]),
build_extra_data_item(1, ItemType.EXTRA_DATA_TYPE_EXITED_VALIDATORS, 1, [38], [1]),
)
)

Expand All @@ -295,8 +294,8 @@ def test_invalid_extra_data_sort_order(self):

def test_unexpected_extra_data_item(self, extra_data_service: ExtraDataService) -> None:
extra_data = extra_data_service.collect(
{(1, 1): 1},
{(1, 1): 1},
{(1, 38): 1},
{(1, 38): 1},
MAX_ACCOUNTING_EXTRA_DATA_LIST_ITEMS_COUNT,
1,
)
Expand All @@ -322,8 +321,8 @@ def test_already_processed(
extra_data_service: ExtraDataService,
):
extra_data = extra_data_service.collect(
{(1, 1): 1},
{(1, 1): 1},
{(1, 38): 1},
{(1, 38): 1},
MAX_ACCOUNTING_EXTRA_DATA_LIST_ITEMS_COUNT,
1,
)
Expand Down

0 comments on commit 13af5d4

Please sign in to comment.