Skip to content

Commit

Permalink
Log all non-integer block numbers in function get_start_block
Browse files Browse the repository at this point in the history
  • Loading branch information
barak manos committed Jan 19, 2024
1 parent 2e13a2b commit 9ba736e
Show file tree
Hide file tree
Showing 2 changed files with 14 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"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
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"get_start_block (non-tenderly): {non_int_values}")
return (
(
max(block["last_updated_block"] for block in mgr.pool_data)
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 9ba736e

Please sign in to comment.