Skip to content

Commit 99f8a65

Browse files
Merge branch 'master' into feat/core-integrations
2 parents 329156a + 51bb48a commit 99f8a65

File tree

4 files changed

+37
-32
lines changed

4 files changed

+37
-32
lines changed

tests/acceptance/test_simple_dvt_module.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ def test_simple_dvt_state(contract):
131131
assert (
132132
node_operator_summary["isTargetLimitActive"] is True
133133
), f"isTargetLimitActive is inactive for node {id}"
134+
135+
assert node_operator_summary["depositableValidatorsCount"] == 0
134136
else:
135137
assert node_operator_summary["isTargetLimitActive"] is False, f"isTargetLimitActive is active for node {id}"
136138
assert node_operator_summary["targetValidatorsCount"] == 0
@@ -150,11 +152,12 @@ def test_simple_dvt_state(contract):
150152
assert node_operator["totalExitedValidators"] == node_operator_summary["totalExitedValidators"]
151153
assert node_operator["totalDepositedValidators"] == node_operator_summary["totalDepositedValidators"]
152154

153-
no_depositable_validators_count = (
154-
node_operator["totalVettedValidators"] - node_operator["totalDepositedValidators"]
155-
)
156155

157-
assert node_operator_summary["depositableValidatorsCount"] == no_depositable_validators_count
156+
if node_operator_summary["isTargetLimitActive"] == False:
157+
no_depositable_validators_count = (
158+
node_operator["totalVettedValidators"] - node_operator["totalDepositedValidators"]
159+
)
160+
assert node_operator_summary["depositableValidatorsCount"] == no_depositable_validators_count
158161

159162

160163
def test_simple_dvt_permissions(contract):

tests/acceptance/test_withdrawals_negative.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ def test_wq_prefinalize(wq: Contract, steth_whale: Account):
109109
def test_request_to_finalize_to_close(wq: Contract, steth_whale: Account):
110110
wait_to_next_available_report_time(contracts.hash_consensus_for_accounting_oracle)
111111
fill_wq(wq, steth_whale, count=1)
112+
wd_status = wq.getWithdrawalStatus([wq.getLastRequestId()])
113+
wd_time = wd_status["statuses"][3]
112114

113-
with reverts(revert_pattern="IncorrectRequestFinalization: \\d*"):
115+
with reverts(encode_error("IncorrectRequestFinalization(uint256)", [wd_time])):
114116
oracle_report(
115117
withdrawalFinalizationBatches=[wq.getLastRequestId()],
116118
wait_to_next_report_time=False,

tests/regression/test_sdvt_rewards_happy_path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_rewards_distribution_happy_path(simple_dvt_module_id, cluster_participa
110110
assert cluster_rewards_before_report == 0
111111

112112
# oracle report
113-
oracle_report(cl_diff=ETH(100))
113+
oracle_report(cl_diff=ETH(500))
114114
cluster_rewards_after_report = lido.balanceOf(new_reward_address)
115115

116116
# check that cluster reward address balance increased

utils/test/simple_dvt_helpers.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
MIN_OP_KEYS_CNT = 10
1414
MIN_OPS_CNT = 3
15+
MAX_KEYS_BATCH_SIZE = 100
1516

1617

1718
def get_operator_name(id: int, group: int = 0):
@@ -115,35 +116,34 @@ def simple_dvt_add_node_operators(simple_dvt, stranger, input_params=[]):
115116
create_and_enact_motion(contracts.easy_track, trusted_caller, factory, calldata, stranger)
116117
node_operators_count_after = simple_dvt.getNodeOperatorsCount()
117118

118-
return (node_operators_count_before, node_operators_count_after)
119+
return node_operators_count_before, node_operators_count_after
119120

120121

121122
def simple_dvt_add_keys(simple_dvt, node_operator_id, keys_count=1):
122-
pubkeys_batch = random_pubkeys_batch(keys_count)
123-
signatures_batch = random_signatures_batch(keys_count)
124-
125-
total_signing_keys_count_before = simple_dvt.getTotalSigningKeyCount(node_operator_id)
126-
unused_signing_keys_count_before = simple_dvt.getUnusedSigningKeyCount(node_operator_id)
127-
node_operator_before = simple_dvt.getNodeOperator(node_operator_id, False)
128-
129-
web3.manager.request_blocking(
130-
"hardhat_setBalance", # type: ignore
131-
[
132-
node_operator_before["rewardAddress"],
133-
Web3.to_hex(90_000_000_000),
134-
],
135-
)
123+
remained_keys_count = keys_count
136124

137-
tx = simple_dvt.addSigningKeys(
138-
node_operator_id,
139-
keys_count,
140-
pubkeys_batch,
141-
signatures_batch,
142-
{"from": node_operator_before["rewardAddress"], "gas_price": 4},
143-
)
125+
while remained_keys_count > 0:
126+
batch_size = min(remained_keys_count, MAX_KEYS_BATCH_SIZE)
127+
128+
pubkeys_batch = random_pubkeys_batch(batch_size)
129+
signatures_batch = random_signatures_batch(batch_size)
130+
131+
total_signing_keys_count_before = simple_dvt.getTotalSigningKeyCount(node_operator_id)
132+
unused_signing_keys_count_before = simple_dvt.getUnusedSigningKeyCount(node_operator_id)
133+
node_operator_before = simple_dvt.getNodeOperator(node_operator_id, False)
134+
135+
tx = simple_dvt.addSigningKeys(
136+
node_operator_id,
137+
batch_size,
138+
pubkeys_batch,
139+
signatures_batch,
140+
{"from": node_operator_before["rewardAddress"]},
141+
)
142+
143+
total_signing_keys_count_after = simple_dvt.getTotalSigningKeyCount(node_operator_id)
144+
unused_signing_keys_count_after = simple_dvt.getUnusedSigningKeyCount(node_operator_id)
144145

145-
total_signing_keys_count_after = simple_dvt.getTotalSigningKeyCount(node_operator_id)
146-
unused_signing_keys_count_after = simple_dvt.getUnusedSigningKeyCount(node_operator_id)
146+
assert total_signing_keys_count_after == total_signing_keys_count_before + batch_size
147+
assert unused_signing_keys_count_after == unused_signing_keys_count_before + batch_size
147148

148-
assert total_signing_keys_count_after == total_signing_keys_count_before + keys_count
149-
assert unused_signing_keys_count_after == unused_signing_keys_count_before + keys_count
149+
remained_keys_count -= batch_size

0 commit comments

Comments
 (0)