Skip to content

Commit

Permalink
Merge pull request #316 from bancorprotocol/log-all-non-integer-block…
Browse files Browse the repository at this point in the history
…-numbers

Log all non-integer block numbers in function `get_start_block`
  • Loading branch information
zavelevsky authored Jan 22, 2024
2 parents 2e13a2b + a960bf3 commit 54191e4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
14 changes: 14 additions & 0 deletions fastlane_bot/events/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1341,13 +1341,27 @@ 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"[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
else from_block - reorg_delay - alchemy_max_block_fetch
), 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"[events.utils.get_start_block] non_int_values: {non_int_values}")
return (
(
max(block["last_updated_block"] for block in mgr.pool_data)
Expand Down
1 change: 1 addition & 0 deletions fastlane_bot/helpers/txhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
6 changes: 0 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 54191e4

Please sign in to comment.