-
Notifications
You must be signed in to change notification settings - Fork 179
Refactor: fix docs, clean up code quality #843
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
base: develop
Are you sure you want to change the base?
Conversation
1ea2cbd to
bc4a166
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
This PR refactors the live_builder order_input code with a focus on improving documentation, code quality, and idiomatic Rust patterns. The PR includes documentation improvements for OrderPool propagation, adding Copy trait implementations, cleaning up unnecessary clones, refactoring BlobTypeOrderFilter API from free functions to associated functions, and improving resource management with Weak pointers.
- Improved documentation for
OrderPooland related components to clarify order propagation behavior - Added
Copytrait implementations for types that support it (e.g.,ReplacementData<KeyType>,ValidBundleState,BundleReplacementState) - Refactored
BlobTypeOrderFilterAPI from free functions to idiomatic associated functions
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rbuilder/src/live_builder/order_input/orderpool.rs | Enhanced documentation for OrderPool and related structures; changed process_commands to use generic iterator; removed unnecessary .clone() calls |
| crates/rbuilder/src/live_builder/order_input/order_replacement_manager.rs | Improved documentation; added Copy trait to ValidBundleState and BundleReplacementState; removed .clone() calls in tests |
| crates/rbuilder/src/live_builder/order_input/mod.rs | Changed handles storage from Vec to FuturesUnordered for parallel reaping; updated AutoRemovingOrderPoolSubscriptionId to use Weak pointer; enhanced documentation |
| crates/rbuilder/src/live_builder/order_input/blob_type_order_filter.rs | Refactored from free functions to associated functions; added rule_name field; added trace event for filtered orders; changed filter logic |
| crates/rbuilder/src/live_builder/order_flow_tracing/order_flow_tracer.rs | Utilized new From trait implementations to remove .clone() calls; improved documentation |
| crates/rbuilder/src/live_builder/order_flow_tracing/events.rs | Added From trait implementations for ReplaceableOrderEvent |
| crates/rbuilder/src/live_builder/building/mod.rs | Updated to use new BlobTypeOrderFilter associated functions |
| crates/rbuilder-primitives/src/test_data_generator.rs | Removed unnecessary .clone() calls |
| crates/rbuilder-primitives/src/lib.rs | Added Copy impl for ReplacementData<KeyType>; removed unnecessary .clone() in replacement_key_and_sequence_number |
| crates/rbuilder-primitives/benches/ssz_proof.rs | Removed unnecessary default() calls and .clone() for unit-like structs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Cancels are treated as highest-priority, and after that we must always | ||
| /// honor the replacement with highest `sequence_number`. | ||
| /// | ||
| /// Although all the structs and fields say "bundle" we always refer to Bundle |
Copilot
AI
Dec 30, 2025
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.
Spelling error: "reefer" should be "refer"
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.
copilot this error is fixeeed in the diff
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
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/rbuilder/src/live_builder/order_input/blob_type_order_filter.rs
Outdated
Show resolved
Hide resolved
crates/rbuilder/src/live_builder/order_input/blob_type_order_filter.rs
Outdated
Show resolved
Hide resolved
crates/rbuilder/src/live_builder/order_input/blob_type_order_filter.rs
Outdated
Show resolved
Hide resolved
| /// [EIP-7594]: https://eips.ethereum.org/EIPS/eip-7594 | ||
| pub const fn new_pre_fusaka(sink: Box<dyn ReplaceableOrderSink>) -> Self { | ||
| fn pre_fusaka(tx: &TransactionSignedEcRecoveredWithBlobs) -> bool { | ||
| !tx.as_ref().is_eip4844() || tx.blobs_sidecar.is_eip4844() |
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.
this logic relies on 4844 validity condition that transactions cannot have 0 blobs
See:
https://eips.ethereum.org/EIPS/eip-4844#blob-transaction:~:text=Execution%20layer%20validation,-On
| /// Don't like the fact that blobs_sidecar exists no matter if | ||
| /// [`Recovered<TransactionSigned>`] contains a non blob tx. | ||
| /// | ||
| /// Great effort was put in avoiding simple access to the internal tx so we |
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.
is this comment accurate? there is an AsRef<Recovered<TransactionSigned>> implementation that allows direct access to the internal tx
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
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// events (Orders and cancellations) for a particular block even if the orders arrived in the past. | ||
| /// Since by infra restrictions bundle cancellations don't have an associated block so we store them for a while and asume | ||
| /// they are valid for all in progress sinks | ||
| /// Repository of ALL orders and cancellations that arrives us via |
Copilot
AI
Dec 30, 2025
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.
Grammar issue: "arrives us via" should be "arrive to us via" or simply "that arrive via".
| /// Repository of ALL orders and cancellations that arrives us via | |
| /// Repository of ALL orders and cancellations that arrive via |
| #[derive(Debug)] | ||
| #[derive(Debug, Copy, Clone)] | ||
| struct ValidBundleState { | ||
| /// Current valid sequence_number (larges we've seen) |
Copilot
AI
Dec 30, 2025
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.
Typo: "larges" should be "largest".
| /// Current valid sequence_number (larges we've seen) | |
| /// Current valid sequence_number (largest we've seen) |
📝 Summary
No longer based on #842, which has been closed
Improves and corrects documentation in the live_builder, particularly around Order propagation through the OrderPool. Functionality does not change. Most significant API change is around
BlobTypeOrderFilter, by moving constructors from free functions to assoc functionsOrderPooldocumentationCopyimpl forReplacementData<KeyType>Copyimpl forNonceKeyBlobTypeOrderFilterconstruction idiomatic for Rusttrace!event toBlobTypeOrderFilterwhen filtering an orderrule_nametoBlobTypeOrderFilterto ensure behavior is clear in tracing eventFromimpls forReplaceableOrderEvent, and remove some relevant.cloneinvocationsAutoRemovingOrderPoolSubscriptionIdto useWeakto prevent them from holdingOrderPoolmemory alloc for dying subscriptionsFuturesUnorderedinstead ofVec<JoinHandle<()>>in the order pool to ensure parallelization of handle reaping✅ I have completed the following steps:
make lintmake test