Skip to content

Commit

Permalink
fix: test refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
krogla committed Feb 14, 2024
1 parent 419a260 commit b17f632
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions tests/regression/test_node_operators_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ def test_add_node_operator(nor, voting_eoa, reward_address, new_node_operator_id
# TODO: validate events


def random_pubkeys_batch(pubkeys_count: int, seed=None):
return random_hexstr(pubkeys_count * PUBKEY_LENGTH, seed)
def random_pubkeys_batch(pubkeys_count: int):
return random_hexstr(pubkeys_count * PUBKEY_LENGTH)


def random_signatures_batch(signautes_count: int, seed=None):
return random_hexstr(signautes_count * SIGNATURE_LENGTH, seed)
def random_signatures_batch(signautes_count: int):
return random_hexstr(signautes_count * SIGNATURE_LENGTH)


def parse_pubkeys_batch(pubkeys_batch: str):
Expand All @@ -270,9 +270,7 @@ def hex_chunks(hexstr: str, chunk_length: int):
return [prefix_0x(chunk) for chunk in textwrap.wrap(stripped_hexstr, 2 * chunk_length)]


def random_hexstr(length: int, seed=None):
if seed:
random.seed(seed)
def random_hexstr(length: int):
return prefix_0x(random.randbytes(length).hex())


Expand Down
4 changes: 2 additions & 2 deletions utils/test/simple_dvt_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def simple_dvt_add_node_operators(simple_dvt, stranger, input_params=[]):


def simple_dvt_add_keys(simple_dvt, node_operator_id, keys_count=1):
pubkeys_batch = random_pubkeys_batch(keys_count, "keys_" + str(node_operator_id))
signatures_batch = random_signatures_batch(keys_count, "signatures_" + str(node_operator_id))
pubkeys_batch = random_pubkeys_batch(keys_count)
signatures_batch = random_signatures_batch(keys_count)

total_signing_keys_count_before = simple_dvt.getTotalSigningKeyCount(node_operator_id)
unused_signing_keys_count_before = simple_dvt.getUnusedSigningKeyCount(node_operator_id)
Expand Down

0 comments on commit b17f632

Please sign in to comment.