Skip to content

Conversation

@ZanCorDX
Copy link
Collaborator

πŸ“ Summary

The bidding service client used to trigger an ugly kill process, now it just triggers the proper shutdown.

βœ… I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

@ZanCorDX ZanCorDX requested a review from dvush as a code owner January 23, 2026 19:36
@claude
Copy link

claude bot commented Jan 23, 2026

Claude finished @ZanCorDX's task in 2m 5s β€”β€” View job


Code Review

Summary

This PR improves the shutdown behavior of the bidding service client by replacing the ProcessKiller mechanism with proper cancellation token signaling. This is a cleaner approach that integrates better with Tokio's cooperative cancellation pattern.

What Changed

  1. Removed ProcessKiller dependency - The process_killer module import and parameter are removed from both BiddingServiceClientAdapter and flashbots_config.rs
  2. Unified error handling - Instead of calling process_killer.kill() on each RPC error, errors are now collected and handled in a single location at the end of the match block
  3. Return early on error - The task now cancels the token and returns immediately when an error occurs, preventing further command processing
  4. Simplified function signatures - create_slot_bidder now returns tonic::Result directly instead of handling errors internally

Detailed Review

Positive aspects:

  • The code is cleaner and more idiomatic Rust - using CancellationToken directly rather than wrapping it in a ProcessKiller abstraction
  • Error handling is centralized in one location (lines 235-239), making the control flow easier to understand
  • The removal of handle_error helper function reduces indirection
  • Good documentation update on line 141: /// cancellation_token is signaled on protocol error so rbuilder restarts.

Potential considerations:

  1. DestroySlotBidder side effect ordering (lines 226-233): The session cleanup (session_id_to_slot_bidder.lock().remove()) happens regardless of whether the RPC call succeeded or failed. This is probably intentional (we want to clean up the local state even if the remote call fails), but it's worth confirming this is the desired behavior. The previous code had the same behavior, so this is not a regression.

  2. No logging for non-error case: The previous code logged errors via handle_error. The new code still logs errors on line 236, so this is preserved.

  3. Early return behavior: When an RPC error occurs, the task returns immediately (line 238). This means any pending commands in the channel will be dropped. This seems correct since we're shutting down anyway, but worth noting.

Code Quality

  • Clean removal of unused imports (process_killer::ProcessKiller)
  • Consistent use of cancellation_token.clone() where ownership is needed
  • The refactoring reduces total lines of code (-58 deleted, +30 added) while maintaining functionality

Security

No security concerns identified. The change uses the existing CancellationToken mechanism which is a standard Tokio pattern for cooperative shutdown.

Performance

No performance impact expected. The change simplifies the code path slightly by removing one level of function call indirection (handle_error).

Verdict

This PR looks good to merge. The change is a straightforward improvement that replaces an ad-hoc process killing mechanism with proper cancellation token usage. The code is cleaner, easier to follow, and maintains the same error-handling semantics.

One minor suggestion: consider adding a brief comment explaining why we remove from session_id_to_slot_bidder unconditionally in DestroySlotBidder even if the RPC fails - though this is pre-existing behavior and optional.


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