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

Fix edge case where existing range end block causes crashes #121

Conversation

iuwqyir
Copy link
Collaborator

@iuwqyir iuwqyir commented Dec 3, 2024

TL;DR

Improved error handling and logging for blockchain polling operations

What changed?

  • Added a new ErrNoNewBlocks error type to explicitly handle cases when no new blocks are available
  • Updated error logging to suppress errors when no new blocks are found
  • Enhanced the reachedPollLimit function to handle nil block numbers
  • Modified getNextBlockRange to return ErrNoNewBlocks instead of nil when no blocks are available

How to test?

  1. Run the poller with a blockchain that has no new blocks
  2. Verify that no error messages appear in the logs
  3. Test with nil block numbers to ensure proper handling
  4. Verify that polling continues normally when new blocks become available

Why make this change?

The previous implementation would log errors for expected scenarios (like no new blocks being available), creating unnecessary noise in the logs. This change provides clearer error handling and better distinguishes between actual errors and expected states, making the system easier to monitor and debug.

Copy link
Collaborator Author

iuwqyir commented Dec 3, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

@iuwqyir iuwqyir mentioned this pull request Dec 3, 2024
@iuwqyir iuwqyir changed the title fix edge case where existing range end block causes crashes Fix edge case where existing range end block causes crashes Dec 3, 2024
@iuwqyir iuwqyir marked this pull request as ready for review December 3, 2024 20:34
Copy link
Collaborator Author

iuwqyir commented Dec 4, 2024

Merge activity

  • Dec 4, 4:15 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Dec 4, 4:18 AM EST: Graphite rebased this pull request as part of a merge.
  • Dec 4, 4:19 AM EST: A user merged this pull request with Graphite.

@iuwqyir iuwqyir changed the base branch from 12-03-use_lightweight_deletes to graphite-base/121 December 4, 2024 09:15
@iuwqyir iuwqyir changed the base branch from graphite-base/121 to main December 4, 2024 09:15
@iuwqyir iuwqyir force-pushed the 12-03-fix_edge_case_where_existing_range_end_block_causes_crashes branch from 0157b17 to da8a524 Compare December 4, 2024 09:17
@iuwqyir iuwqyir merged commit fa85f6b into main Dec 4, 2024
5 checks passed
@iuwqyir iuwqyir deleted the 12-03-fix_edge_case_where_existing_range_end_block_causes_crashes branch December 4, 2024 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants