Skip to content

Commit

Permalink
Update the stress tools
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypan committed Nov 6, 2024
1 parent 29b319e commit 9bc88d9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/stress_delegator_multi_collators_evm.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,17 @@ def main(): # noqa: C901
# Leave the delegators
try:
evm_receipt = delegator_leave_delegators(w3, eth_chain_id, kps[0]['kp'])
print('Leave delegators successfully')
if evm_receipt['status'] != 1:
print('Leave delegators failed')
raise IOError('Leave delegators failed')
except ValueError:
except ValueError as e:
print(f'Leave delegators failed {e}')
pass

for i in range(10000):
print('Setup delegators start {}'.format(i))
setup_delegators(substrate, w3, contract, eth_chain_id, kps, validators, collator_nums, args.number)
setup_delegators(substrate, w3, eth_chain_id, kps, validators, collator_nums, args.number)

if not check_delegator_number(substrate, kps[0]['substrate'], args.number):
print('Delegator number not found')
Expand Down
28 changes: 28 additions & 0 deletions tools/stress_delegator_multi_collators_substrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ def setup_delegators(substrate, kps, validators, number):
if number == 1:
return
print('Wait for one session')
# [TODO] Let us skip this, only need to enable in Krest/Peaq docker env
# batch = ExtrinsicBatch(substrate, KP_GLOBAL_SUDO)
# batch.compose_sudo_call(
# 'ParachainStaking',
# 'force_new_round',
# {}
# )
# receipt = batch.execute()
# if not receipt.is_success:
# print('Force new round failed')
# raise IOError('Force new round failed')

wait_next_session(substrate, receipt.block_hash)

# Delegate
Expand All @@ -117,6 +129,11 @@ def setup_delegators(substrate, kps, validators, number):
validator,
get_collator_stake(substrate, validator))
print(f'Setup delegators for {validator} successfully, {idx} / {len(validators)}')
# [TODO] Let us skip this, only need to enable in Krest/Peaq docker env
# receipt = batch.execute()
# if not receipt.is_success:
# print('Force new round failed')
# raise IOError('Force new round failed')
wait_next_session(substrate, receipt.block_hash)


Expand Down Expand Up @@ -158,6 +175,17 @@ def main():
return

print(f'Number of validators are {len(validators)}')
# [TODO] Let us skip this, only need to enable in Krest/Peaq docker env
# batch = ExtrinsicBatch(substrate, KP_GLOBAL_SUDO)
# batch.compose_sudo_call(
# 'ParachainStaking',
# 'force_new_round',
# {}
# )
# receipt = batch.execute()
# if not receipt.is_success:
# print('Force new round failed')
# raise IOError('Force new round failed')

kps = [Keypair.create_from_mnemonic('trumpet depth hidden success nominee twenty erode mixture pond bread easily cycle')]
for i in range(10000):
Expand Down

0 comments on commit 9bc88d9

Please sign in to comment.