From 7c284ed827012a9f833c2546c50a27f524d6d3fc Mon Sep 17 00:00:00 2001 From: Moray Grieve Date: Tue, 12 Nov 2024 13:17:40 +0000 Subject: [PATCH] Log every ten tx receipts in performance 005 (#375) * Twice a day * Up the gas, log every ten --- .github/workflows/local_run_tests.yml | 2 +- tests/ten/ten_per_005/Input/storage_client.py | 13 +++++++++++-- tests/ten/ten_per_005/run.py | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/local_run_tests.yml b/.github/workflows/local_run_tests.yml index 8381a1de..87c279da 100644 --- a/.github/workflows/local_run_tests.yml +++ b/.github/workflows/local_run_tests.yml @@ -4,7 +4,7 @@ name: '[locally] Run local tests' run-name: Run local tests (${{ github.event_name }}) on: schedule: - - cron: '0 */6 * * *' + - cron: '0 */12 * * *' workflow_dispatch: inputs: target_branch: diff --git a/tests/ten/ten_per_005/Input/storage_client.py b/tests/ten/ten_per_005/Input/storage_client.py index 605b329f..0dd93e34 100644 --- a/tests/ten/ten_per_005/Input/storage_client.py +++ b/tests/ten/ten_per_005/Input/storage_client.py @@ -17,6 +17,14 @@ def create_signed_tx(name, account, nonce, contract, gas_price, gas_limit, chain return account.sign_transaction(build_tx) +def tenths(list): + every_tenth = list[9::10] + last_element = list[-1] + if last_element not in every_tenth: + return every_tenth + [last_element] + return every_tenth + + def run(name, chainId, web3, account, contract, num_iterations, gas_limit): """Run a loop of bulk loading transactions into the mempool, draining, and collating results. """ logging.info('Creating and signing %d transactions', num_iterations) @@ -40,8 +48,9 @@ def run(name, chainId, web3, account, contract, num_iterations, gas_limit): stats[1] += 1 logging.warning('Ratio failures = %.2f', float(stats[1]) / sum(stats)) - logging.info('Waiting for last transaction %s', receipts[-1][0].hex()) - web3.eth.wait_for_transaction_receipt(receipts[-1][0], timeout=900) + for receipt in tenths(receipts): + logging.info('Waiting for transaction receipt number %s', receipt[1]) + web3.eth.wait_for_transaction_receipt(receipt[0], timeout=900) logging.info('Retrieved value for %s is %d', name, contract.functions.getItem(name).call()) logging.info('Constructing binned data from the transaction receipts') diff --git a/tests/ten/ten_per_005/run.py b/tests/ten/ten_per_005/run.py index dbf0a93c..1a7cb6e1 100644 --- a/tests/ten/ten_per_005/run.py +++ b/tests/ten/ten_per_005/run.py @@ -27,7 +27,7 @@ def execute(self): self.chain_id = network.chain_id() self.gas_price = web3.eth.gas_price params = {'from': account.address, 'chainId': web3.eth.chain_id, 'gasPrice': self.gas_price} - self.gas_limit = storage.contract.functions.setItem('test', 1).estimate_gas(params) + self.gas_limit = 4*storage.contract.functions.setItem('test', 1).estimate_gas(params) funds_needed = 1.1 * self.ITERATIONS * (self.gas_price*self.gas_limit) # run the clients