Skip to content

feat: combined callback#506

Merged
zeroXbrock merged 4 commits intoflashbots:mainfrom
0xl3on:feat/add-combined-callback
Apr 16, 2026
Merged

feat: combined callback#506
zeroXbrock merged 4 commits intoflashbots:mainfrom
0xl3on:feat/add-combined-callback

Conversation

@0xl3on
Copy link
Copy Markdown
Contributor

@0xl3on 0xl3on commented Apr 15, 2026

Motivation

Closes #326

Solution

Hey, here's a proposed solution to the issue:

Added a CombinedCallback<A, B> that pairs two callbacks and merges their handles, plus a with_callback builder on LogCallback:

  let callback = LogCallback::new(rpc)
      .send_fcu(true)
      .with_callback(MyCustomCallback);

Both sides run on every on_tx_sent / on_batch_sent, so custom callbacks get the DB caching for free. No trait changes, NilCallback and --ignore-receipts still behave the same

PR Checklist

  • Added Tests
  • Added Documentation
  • Ran cargo +nightly clippy --workspace --lib --examples --tests --benches --all-features --locked --fix
  • Ran cargo fmt --all
  • Note breaking changes in PR description, if applicable
  • update changelogs
    • Update CHANGELOG.md in each affected crate
    • add a high-level description in the root changelog

@0xl3on 0xl3on requested a review from zeroXbrock as a code owner April 15, 2026 03:07
Copy link
Copy Markdown
Member

@zeroXbrock zeroXbrock left a comment

Choose a reason for hiding this comment

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

thanks @0xl3on, this is great!
I just added a lil trait (IntoCombinedCallback) + generic impl to add a with_callback method to all impls of SpamCallback so any callback could easily chain more callbacks, making use of CombinedCallback in the background. Now lib users can just do something like mycallback.with_callback(another_callback), and as long as they implement SpamCallback it'll work 😎

@zeroXbrock zeroXbrock merged commit 445e669 into flashbots:main Apr 16, 2026
7 checks passed
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.

piggyback on LogCallback for default behavior & simpler callback impls

2 participants