From 057f5b550bc2be83977999511e693010a02ac86f Mon Sep 17 00:00:00 2001 From: George Avsetsin Date: Thu, 21 Nov 2024 15:35:58 +0300 Subject: [PATCH 1/2] fix: event timestamp for test_validator_exit_bus_happy_path tests --- tests/regression/test_validator_exit_bus_happy_path.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/regression/test_validator_exit_bus_happy_path.py b/tests/regression/test_validator_exit_bus_happy_path.py index c37af9c9..3adfc4b9 100644 --- a/tests/regression/test_validator_exit_bus_happy_path.py +++ b/tests/regression/test_validator_exit_bus_happy_path.py @@ -110,7 +110,7 @@ def test_send_validator_to_exit(helpers, web3): "nodeOperatorId": no_id, "validatorIndex": unreachable_cl_validator_index, "validatorPubkey": validator_key, - "timestamp": web3.eth.get_block(web3.eth.block_number).timestamp, + "timestamp": web3.eth.get_block(tx.block_number).timestamp, }, ) @@ -192,27 +192,28 @@ def test_send_multiple_validators_to_exit(helpers, web3, stranger): # Asserts helpers.assert_single_event_named("ProcessingStarted", tx, {"refSlot": ref_slot, "hash": report_hash_hex}) events = helpers.filter_events_from(tx.receiver, tx.events["ValidatorExitRequest"]) + timestamp = web3.eth.get_block(tx.block_number).timestamp assert len(events) == 3 assert dict(events[0]) == { "stakingModuleId": first_module_id, "nodeOperatorId": first_no_id, "validatorIndex": first_validator_index, "validatorPubkey": first_validator_key, - "timestamp": web3.eth.get_block(web3.eth.block_number).timestamp, + "timestamp": timestamp, } assert dict(events[1]) == { "stakingModuleId": second_module_id, "nodeOperatorId": second_no_id, "validatorIndex": second_validator_index, "validatorPubkey": second_validator_key, - "timestamp": web3.eth.get_block(web3.eth.block_number).timestamp, + "timestamp": timestamp, } assert dict(events[2]) == { "stakingModuleId": third_module_id, "nodeOperatorId": third_no_id, "validatorIndex": third_validator_index, "validatorPubkey": third_validator_key, - "timestamp": web3.eth.get_block(web3.eth.block_number).timestamp, + "timestamp": timestamp, } assert total_requests_after == total_requests_before + 3 From b35244891c0621590f0a7af0ea4ae6feef482b4c Mon Sep 17 00:00:00 2001 From: George Avsetsin Date: Thu, 21 Nov 2024 18:59:38 +0300 Subject: [PATCH 2/2] 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,