Skip to content

fix: Break loop on invalid chainsync response#96

Open
gonzalezzfelipe wants to merge 2 commits intotxpipe:mainfrom
gonzalezzfelipe:fix/break-loop-on-invalid-chainsync-response
Open

fix: Break loop on invalid chainsync response#96
gonzalezzfelipe wants to merge 2 commits intotxpipe:mainfrom
gonzalezzfelipe:fix/break-loop-on-invalid-chainsync-response

Conversation

@gonzalezzfelipe
Copy link
Contributor

@gonzalezzfelipe gonzalezzfelipe commented Feb 25, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling: operations now abort and report an explicit error when a follow-up response is missing or invalid, replacing the previous behavior that logged a warning and continued. This prevents silent failures and ensures upstream callers receive a clear failure signal for safer, more reliable execution.

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

The chainsync driver's handling of a follow_tip None response was changed: instead of logging a warning and continuing, the code now logs an error and returns Error::Driver, aborting the operation on invalid follow_tip responses.

Changes

Cohort / File(s) Summary
Error Handling in follow_tip
balius-runtime/src/drivers/chainsync.rs
Updated TipEvent::FollowTip None branch to log an error and return Err(Error::Driver("Invalid response from follow_tip")) instead of logging a warning and continuing; converts non-fatal path into a hard failure.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I hopped along the code so bright,
A None once whispered in the night,
No longer hushed with caution mild,
I thumped my paw — the driver cried. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Break loop on invalid chainsync response' accurately describes the main change: converting a non-fatal warning into a hard failure that breaks the operation when follow_tip returns None.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@balius-runtime/src/drivers/chainsync.rs`:
- Around line 59-62: The log message in chainsync.rs is misleading: change the
tracing::error!("Received None response from follow_tip, skipping") call to
reflect that the function is aborting/returning an error (e.g., "Received None
response from follow_tip, aborting") so the runtime behavior of follow_tip
(which immediately returns Err(Error::Driver(...))) matches the log; update the
log text near the follow_tip handling to accurately state abort/return instead
of "skipping".

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23d08fa and d61d868.

📒 Files selected for processing (1)
  • balius-runtime/src/drivers/chainsync.rs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
balius-runtime/src/drivers/chainsync.rs (1)

6-6: Optional: import error alongside info and warn for consistency.

tracing::error! on line 59 uses the full path while info and warn are imported directly. Consider pulling error into the same import.

♻️ Proposed fix
-use tracing::{info, warn};
+use tracing::{error, info, warn};

Then on line 59:

-                tracing::error!("Received None response from follow_tip");
+                error!("Received None response from follow_tip");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@balius-runtime/src/drivers/chainsync.rs` at line 6, The import currently
pulls in info and warn only; add error to the same tracing import (use
tracing::{info, warn, error};) and replace the full-path usage tracing::error!
in the chainsync code with the imported error! macro so all tracing macros are
consistently imported (locate the tracing::error! call and change it to error!).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@balius-runtime/src/drivers/chainsync.rs`:
- Line 6: The import currently pulls in info and warn only; add error to the
same tracing import (use tracing::{info, warn, error};) and replace the
full-path usage tracing::error! in the chainsync code with the imported error!
macro so all tracing macros are consistently imported (locate the
tracing::error! call and change it to error!).

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d61d868 and bb3acfc.

📒 Files selected for processing (1)
  • balius-runtime/src/drivers/chainsync.rs

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.

1 participant