Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lag behind a block in invariance checks #1679

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions scripts/invariant_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ async def main(argv: Sequence[str] | None = None) -> None:
log_to_rollbar = initialize_rollbar(rollbar_environment_name)

# Keeps track of the last time we executed an invariant check
batch_check_start_block = chain.block_number()
# There are issues with chains where sometimes the block_number
# returned here isn't a valid block, so we lag behind a block.
batch_check_start_block = chain.block_number() - 1

# Check pools on first iteration
logging.info("Checking for new pools...")
Expand All @@ -301,7 +303,10 @@ async def main(argv: Sequence[str] | None = None) -> None:
while True:
# The batch_check_end_block is inclusive
# (i.e., we do batch_check_end_block + 1 in the loop range)
batch_check_end_block = chain.block_number()

# There are issues with chains where sometimes the block_number
# returned here isn't a valid block, so we lag behind a block.
batch_check_end_block = chain.block_number() - 1

# If a block hasn't ticked, we sleep
if batch_check_start_block > batch_check_end_block:
Expand Down
Loading