diff --git a/tests/acceptance/test_veb_negative.py b/tests/acceptance/test_veb_negative.py index 773a4f3eb..b96a53cf4 100644 --- a/tests/acceptance/test_veb_negative.py +++ b/tests/acceptance/test_veb_negative.py @@ -221,13 +221,12 @@ def test_handle_consensus_report_data_wrong_module_id(contract, ref_slot): def test_handle_consensus_report_data_second_exit(contract, ref_slot): + unreachable_cl_validator_index = 100_000_000 no_global_index = (module_id, no_id) = (1, 33) - validator_id = 1 - validator_key = contracts.node_operators_registry.getSigningKey(no_id, validator_id)[0] + validator_key = contracts.node_operators_registry.getSigningKey(no_id, 1)[0] # set validator index to the next one to avoid NodeOpValidatorIndexMustIncrease error - last_requested_validator_index = contract.getLastRequestedValidatorIndices(module_id, [no_id])[0] - validator = LidoValidator(index=last_requested_validator_index + 1, pubkey=validator_key) + validator = LidoValidator(index=unreachable_cl_validator_index, pubkey=validator_key) contract_version = contract.getContractVersion() consensus_version = contract.getConsensusVersion() @@ -251,10 +250,6 @@ def test_handle_consensus_report_data_second_exit(contract, ref_slot): contract.submitReportData(report, contract_version, {"from": submitter}) - last_requested_validator_index_before = contracts.validators_exit_bus_oracle.getLastRequestedValidatorIndices( - module_id, [no_id] - ) - wait_to_next_available_report_time(contracts.hash_consensus_for_validators_exit_bus_oracle) ref_slot, _ = contracts.hash_consensus_for_validators_exit_bus_oracle.getCurrentFrame() @@ -281,8 +276,8 @@ def test_handle_consensus_report_data_second_exit(contract, ref_slot): ( module_id, no_id, - last_requested_validator_index_before[0], - last_requested_validator_index_before[0], + unreachable_cl_validator_index, + unreachable_cl_validator_index, ), ) ): @@ -290,16 +285,14 @@ def test_handle_consensus_report_data_second_exit(contract, ref_slot): def test_handle_consensus_report_data_invalid_request_order(contract, ref_slot): - module_id = 1 # CuratedModule - no_global_index = (_, no_id) = (module_id, 33) - validator_id = 1 - validator_key = contracts.node_operators_registry.getSigningKey(no_id, validator_id)[0] - validator_2_key = contracts.node_operators_registry.getSigningKey(no_id, validator_id + 1)[0] + unreachable_cl_validator_index = 100_000_000 + no_global_index = (module_id, no_id) = (1, 33) # Curated module + validator_key = contracts.node_operators_registry.getSigningKey(no_id, 1)[0] + validator_2_key = contracts.node_operators_registry.getSigningKey(no_id, 2)[0] # set validator index to the next one to avoid NodeOpValidatorIndexMustIncrease error - last_requested_validator_index = contract.getLastRequestedValidatorIndices(module_id, [no_id])[0] - validator = LidoValidator(index=last_requested_validator_index + 1, pubkey=validator_key) - validator_2 = LidoValidator(index=last_requested_validator_index + 1, pubkey=validator_2_key) + validator = LidoValidator(index=unreachable_cl_validator_index, pubkey=validator_key) + validator_2 = LidoValidator(index=unreachable_cl_validator_index + 1, pubkey=validator_2_key) contract_version = contract.getContractVersion() consensus_version = contract.getConsensusVersion() diff --git a/tests/regression/test_validator_exit_bus_happy_path.py b/tests/regression/test_validator_exit_bus_happy_path.py index 81a303dbf..c37af9c98 100644 --- a/tests/regression/test_validator_exit_bus_happy_path.py +++ b/tests/regression/test_validator_exit_bus_happy_path.py @@ -75,15 +75,11 @@ def test_send_zero_validators_to_exit(helpers): def test_send_validator_to_exit(helpers, web3): + unreachable_cl_validator_index = 100_000_000 no_global_index = (module_id, no_id) = (1, 33) - validator_id = 1 - validator_key = contracts.node_operators_registry.getSigningKey(no_id, validator_id)[0] + validator_key = contracts.node_operators_registry.getSigningKey(no_id, 1)[0] - # set validator index to the next one to avoid NodeOpValidatorIndexMustIncrease error - last_requested_validator_index = contracts.validators_exit_bus_oracle.getLastRequestedValidatorIndices( - module_id, [no_id] - )[0] - validator = LidoValidator(index=last_requested_validator_index + 1, pubkey=validator_key) + validator = LidoValidator(index=unreachable_cl_validator_index, pubkey=validator_key) ref_slot = _wait_for_next_ref_slot() report, report_hash = prepare_exit_bus_report([(no_global_index, validator)], ref_slot) @@ -112,7 +108,7 @@ def test_send_validator_to_exit(helpers, web3): { "stakingModuleId": module_id, "nodeOperatorId": no_id, - "validatorIndex": last_requested_validator_index + 1, + "validatorIndex": unreachable_cl_validator_index, "validatorPubkey": validator_key, "timestamp": web3.eth.get_block(web3.eth.block_number).timestamp, }, @@ -120,7 +116,7 @@ def test_send_validator_to_exit(helpers, web3): assert total_requests_after == total_requests_before + 1 - assert last_requested_validator_index_after == (last_requested_validator_index + 1,) + assert last_requested_validator_index_after == (unreachable_cl_validator_index,) assert last_processing_ref_slot_after != last_processing_ref_slot_before assert last_processing_ref_slot_after == ref_slot @@ -136,6 +132,7 @@ def test_send_multiple_validators_to_exit(helpers, web3, stranger): """ The same as test above but with multiple validators on different node operators and modules """ + unreachable_cl_validator_index = 100_000_000 # Fill SDVT simple_dvt_add_node_operators( contracts.simple_dvt, stranger, [("SDVT Operator", f"0xab{'1' * 38}", f"0xcd{'1' * 38}")] @@ -149,15 +146,9 @@ def test_send_multiple_validators_to_exit(helpers, web3, stranger): first_validator_id = 2 second_validator_id = 3 third_validator_id = 0 - first_validator_index = ( - contracts.validators_exit_bus_oracle.getLastRequestedValidatorIndices(first_module_id, [first_no_id])[0] + 1 - ) - second_validator_index = ( - contracts.validators_exit_bus_oracle.getLastRequestedValidatorIndices(second_module_id, [second_no_id])[0] + 1 - ) - third_validator_index = ( - contracts.validators_exit_bus_oracle.getLastRequestedValidatorIndices(third_module_id, [third_no_id])[0] + 1 - ) + first_validator_index = unreachable_cl_validator_index + second_validator_index = unreachable_cl_validator_index + 1 + third_validator_index = unreachable_cl_validator_index + 2 first_validator_key = contracts.node_operators_registry.getSigningKey(first_no_id, first_validator_id)[0] second_validator_key = contracts.node_operators_registry.getSigningKey(second_no_id, second_validator_id)[0] diff --git a/utils/test/simple_dvt_helpers.py b/utils/test/simple_dvt_helpers.py index 3c8a99ce8..b7c102253 100644 --- a/utils/test/simple_dvt_helpers.py +++ b/utils/test/simple_dvt_helpers.py @@ -1,4 +1,4 @@ -from brownie import chain, accounts, interface +from brownie import accounts, interface, web3 from utils.config import ( contracts, EASYTRACK_SIMPLE_DVT_TRUSTED_CALLER, @@ -130,6 +130,11 @@ def simple_dvt_add_keys(simple_dvt, node_operator_id, keys_count=1): unused_signing_keys_count_before = simple_dvt.getUnusedSigningKeyCount(node_operator_id) node_operator_before = simple_dvt.getNodeOperator(node_operator_id, False) + reward_address = node_operator_before["rewardAddress"] + if accounts.at(reward_address, force=True).balance() == 0: + web3.provider.make_request("evm_setAccountBalance", [reward_address, "0x152D02C7E14AF6800000"]) + web3.provider.make_request("hardhat_setBalance", [reward_address, "0x152D02C7E14AF6800000"]) + tx = simple_dvt.addSigningKeys( node_operator_id, batch_size,