|
12 | 12 |
|
13 | 13 | MIN_OP_KEYS_CNT = 10
|
14 | 14 | MIN_OPS_CNT = 3
|
| 15 | +MAX_KEYS_BATCH_SIZE = 100 |
15 | 16 |
|
16 | 17 |
|
17 | 18 | def get_operator_name(id: int, group: int = 0):
|
@@ -115,35 +116,34 @@ def simple_dvt_add_node_operators(simple_dvt, stranger, input_params=[]):
|
115 | 116 | create_and_enact_motion(contracts.easy_track, trusted_caller, factory, calldata, stranger)
|
116 | 117 | node_operators_count_after = simple_dvt.getNodeOperatorsCount()
|
117 | 118 |
|
118 |
| - return (node_operators_count_before, node_operators_count_after) |
| 119 | + return node_operators_count_before, node_operators_count_after |
119 | 120 |
|
120 | 121 |
|
121 | 122 | 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 |
136 | 124 |
|
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) |
144 | 145 |
|
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 |
147 | 148 |
|
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