-
Notifications
You must be signed in to change notification settings - Fork 171
feat(primitives): decoding with signer lookups #760
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
feat(primitives): decoding with signer lookups #760
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial pass
319e844
to
daddfa2
Compare
There was a problem hiding this 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 toRawBundle
for specifying signer lookup closures - Introduces
RawTransactionDecodable
struct to handle transaction decoding with optional signer lookup - Refactors
RawBundle
structure by extracting metadata into separateRawBundleMetadata
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
📝 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 adecode_with_signer_lookup
that allows to specify a closure to check whether the signer is already known for a certain hash.RawBundle::decode_inner
that takes this the closure as anOption
.RawBundle::decode_inner
, an helper structRawTransactionDecodable
(naming can be improved) that contains the raw bytes, theTxEncoding
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.RawBundleMetadata
struct has been introduced to simplify a bit the code and for separation of concerns.✅ I have completed the following steps:
make lint
make test