From 9ba736ecf99d8594f551bd03c303c52196ddc36c Mon Sep 17 00:00:00 2001 From: barak manos <> Date: Sat, 20 Jan 2024 00:54:47 +0200 Subject: [PATCH 1/3] Log all non-integer block numbers in function `get_start_block` --- fastlane_bot/events/utils.py | 14 ++++++++++++++ main.py | 6 ------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/fastlane_bot/events/utils.py b/fastlane_bot/events/utils.py index 322e1887a..46f027211 100644 --- a/fastlane_bot/events/utils.py +++ b/fastlane_bot/events/utils.py @@ -1341,6 +1341,13 @@ def get_start_block( elif mgr.tenderly_fork_id: # connect to the Tenderly fork and get the latest block number from_block = mgr.w3_tenderly.eth.block_number + # Log all non-integer block numbers + non_int_values = [ + (index, block["last_updated_block"], type(block["last_updated_block"])) + for index, block in enumerate(mgr.pool_data) if type(block["last_updated_block"]) is not int + ] + if non_int_values: + mgr.cfg.logger.info(f"get_start_block (tenderly {mgr.tenderly_fork_id}): {non_int_values}") return ( max(block["last_updated_block"] for block in mgr.pool_data) - reorg_delay if last_block != 0 @@ -1348,6 +1355,13 @@ def get_start_block( ), from_block else: current_block = mgr.web3.eth.block_number + # Log all non-integer block numbers + non_int_values = [ + (index, block["last_updated_block"], type(block["last_updated_block"])) + for index, block in enumerate(mgr.pool_data) if type(block["last_updated_block"]) is not int + ] + if non_int_values: + mgr.cfg.logger.info(f"get_start_block (non-tenderly): {non_int_values}") return ( ( max(block["last_updated_block"] for block in mgr.pool_data) diff --git a/main.py b/main.py index 16a63d93c..f09472278 100644 --- a/main.py +++ b/main.py @@ -618,12 +618,6 @@ def run( pool["last_updated_block"] = last_block_queried mgr.pool_data[idx] = pool - # Log the input passed to function `get_start_block` - mgr.cfg.logger.info( - "get_start_block input: " + - ", ".join([f"({x}, {type(x)})" for x in [alchemy_max_block_fetch, last_block, reorg_delay, replay_from_block]]) - ) - # Get current block number, then adjust to the block number reorg_delay blocks ago to avoid reorgs start_block, replay_from_block = get_start_block( alchemy_max_block_fetch, last_block, mgr, reorg_delay, replay_from_block From 2d45be25d58e6184375f0f36115a1818e137b047 Mon Sep 17 00:00:00 2001 From: barak manos <> Date: Sat, 20 Jan 2024 10:53:51 +0200 Subject: [PATCH 2/3] Log the gas price and the max priority --- fastlane_bot/helpers/txhelpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fastlane_bot/helpers/txhelpers.py b/fastlane_bot/helpers/txhelpers.py index eb0fff975..32c494f9e 100644 --- a/fastlane_bot/helpers/txhelpers.py +++ b/fastlane_bot/helpers/txhelpers.py @@ -627,6 +627,7 @@ def build_transaction_with_gas( ) return None else: + self.ConfigObj.logger.info(f"gas_price = {gas_price}, max_priority = {max_priority}") self.ConfigObj.logger.warning( f"[helpers.txhelpers.build_transaction_with_gas] (***2***) \n" f"Error when building transaction, this is expected to happen occasionally, discarding. Exception: {e.__class__.__name__} {e}" From a960bf3c0e3778518b6222068c956ad81f3763a7 Mon Sep 17 00:00:00 2001 From: NIXBNT <88088888+NIXBNT@users.noreply.github.com> Date: Mon, 22 Jan 2024 09:56:29 +1100 Subject: [PATCH 3/3] formatting of error message --- fastlane_bot/events/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastlane_bot/events/utils.py b/fastlane_bot/events/utils.py index 46f027211..2d35eb85f 100644 --- a/fastlane_bot/events/utils.py +++ b/fastlane_bot/events/utils.py @@ -1347,7 +1347,7 @@ def get_start_block( for index, block in enumerate(mgr.pool_data) if type(block["last_updated_block"]) is not int ] if non_int_values: - mgr.cfg.logger.info(f"get_start_block (tenderly {mgr.tenderly_fork_id}): {non_int_values}") + mgr.cfg.logger.info(f"[events.utils.get_start_block] non_int_values: {non_int_values}") return ( max(block["last_updated_block"] for block in mgr.pool_data) - reorg_delay if last_block != 0 @@ -1361,7 +1361,7 @@ def get_start_block( for index, block in enumerate(mgr.pool_data) if type(block["last_updated_block"]) is not int ] if non_int_values: - mgr.cfg.logger.info(f"get_start_block (non-tenderly): {non_int_values}") + mgr.cfg.logger.info(f"[events.utils.get_start_block] non_int_values: {non_int_values}") return ( ( max(block["last_updated_block"] for block in mgr.pool_data)