Skip to content

Conversation

thedevbirb
Copy link
Contributor

@thedevbirb thedevbirb commented Oct 10, 2025

📝 Summary

Modifies the rbuilder-primitives crate so that it is possible to decode bundles specifying a signer lookup, to save on signature recovery compute.

💡 Motivation and Context

Most bundles received contain transactions already heard, as such we can reduce a lot of compute from the hot path.

Summary of the changes:

  • RawBundle now feature a decode_with_signer_lookup that allows to specify a closure to check whether the signer is already known for a certain hash.
    • It calls an underlying RawBundle::decode_inner that takes this the closure as an Option.
  • Inside RawBundle::decode_inner, an helper struct RawTransactionDecodable (naming can be improved) that contains the raw bytes, the TxEncoding and the optional signer lookup is used for decoding. Transaction decoding and recovering can't really be decoupled from bundle decoding because it's required for parsing refunds data.
  • A RawBundleMetadata struct has been introduced to simplify a bit the code and for separation of concerns.

✅ I have completed the following steps:

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

Copy link
Collaborator

@mempirate mempirate left a comment

Choose a reason for hiding this comment

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

Initial pass

@thedevbirb thedevbirb force-pushed the lore/feat/decode-bundles-signer-unchecked branch from 319e844 to daddfa2 Compare October 13, 2025 10:37
@thedevbirb thedevbirb marked this pull request as ready for review October 13, 2025 12:07
@Copilot Copilot AI review requested due to automatic review settings October 13, 2025 12:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Enhances the rbuilder-primitives crate to support bundle decoding with signer lookups, allowing reuse of known transaction signers to reduce signature recovery computation in the hot path.

  • Adds decode_with_signer_lookup method to RawBundle for specifying signer lookup closures
  • Introduces RawTransactionDecodable struct to handle transaction decoding with optional signer lookup
  • Refactors RawBundle structure by extracting metadata into separate RawBundleMetadata struct

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
rust-toolchain.toml Updates Rust toolchain configuration format
crates/rbuilder/src/live_builder/order_input/txpool_fetcher.rs Updates transaction decoding to use new RawTransactionDecodable API
crates/rbuilder/src/backtest/store.rs Updates test code to use new RawBundleMetadata structure
crates/rbuilder/src/backtest/results_store.rs Refactors slice creation for consistency
crates/rbuilder/src/backtest/backtest_build_range.rs Refactors slice creation for consistency
crates/rbuilder-primitives/src/serialize.rs Implements core signer lookup functionality and bundle metadata refactoring
crates/rbuilder-primitives/src/lib.rs Adds RawTransactionDecodable struct and related transaction decoding improvements

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Collaborator

@efbig efbig left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Collaborator

@mempirate mempirate left a comment

Choose a reason for hiding this comment

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

lgtm

@dvush dvush merged commit 89f68c6 into flashbots:develop Oct 13, 2025
3 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.

4 participants