Skip to content

Commit

Permalink
Fix node_rotation_test
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaStebaev committed May 3, 2024
1 parent 7c8f23b commit d77c607
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
6 changes: 4 additions & 2 deletions skale/contracts/manager/node_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ def get_leaving_history(self, node_id: NodeId) -> List[RotationSwap]:
return history

def get_schain_finish_ts(self, node_id: NodeId, schain_name: SchainName) -> int | None:
raw_history = self.contract.functions.getLeavingHistory(node_id).call()
history = self.get_leaving_history(node_id)
schain_id = self.skale.schains.name_to_id(schain_name)
finish_ts = next(
(schain[1] for schain in raw_history if '0x' + schain[0].hex() == schain_id), None)
(swap['finished_rotation'] for swap in history if swap['schain_id'] == schain_id),
None
)
if not finish_ts:
return None
return int(finish_ts)
Expand Down
22 changes: 12 additions & 10 deletions tests/rotation_history/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,21 @@ def init_skale_from_wallet(wallet) -> Skale:
def send_broadcasts(nodes, skale_instances, group_index, skip_node_index=None, rotation_id=0):
for i, node in enumerate(nodes):
if i != skip_node_index:
verification_vector = [
G2Point(*[
Fp2Point(*fp2_point) for fp2_point in g2_point
])
for g2_point in TEST_DKG_DATA['test_verification_vectors'][i]
]
secret_key_contribution = [
KeyShare(tuple(key_share[0]), key_share[1])
for key_share in TEST_DKG_DATA['test_encrypted_secret_key_contributions'][i]
]
skale_instances[i].dkg.broadcast(
group_index,
node['node_id'],
[
G2Point(*[
Fp2Point(*fp2_point) for fp2_point in g2_point
])
for g2_point in TEST_DKG_DATA['test_verification_vectors'][i]
],
[
KeyShare(tuple(key_share[0]), key_share[1])
for key_share in TEST_DKG_DATA['test_encrypted_secret_key_contributions'][i]
],
verification_vector,
secret_key_contribution,
rotation_id
)
else:
Expand Down

0 comments on commit d77c607

Please sign in to comment.