-
Notifications
You must be signed in to change notification settings - Fork 69
Backrun bundles #389
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
Merged
Merged
Backrun bundles #389
Changes from 41 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
f50174a
wire backurn bundle pool
dvush 5fadf60
maintain pool stubs
dvush cb11535
separate per block pool and global pool
dvush 2ea14d7
work
dvush 299cac2
work
dvush 7983fb2
better backrun commit
dvush 45530c0
backrun metrics
dvush ea2611f
backrun bundles limits
dvush 5d2d587
backrun tests
dvush f55763b
dynamic selection of backruns at a callsite
dvush 77ef427
work
dvush 32a80f0
add replacment uuid to backruns on API
dvush 75e809c
logic for bundle replacements
dvush aadee97
backrun pool count metrics
dvush 275247f
limit iteration in a hot path
dvush f55f9e7
precompute da size
dvush 6f836e5
base fee estimation
dvush 16b0c07
backrun processing time metric
dvush 0420a7c
flashblock range
dvush 8b5240b
improve payload pool handling
dvush 468242f
aux tests
dvush 3fec789
fmt
dvush c3a467e
lint
dvush dfb3521
backrun module docs
dvush c9cd292
+docs
dvush ad8703e
Merge remote-tracking branch 'origin/main' into backrun-bundles
dvush b3858aa
review tweaks
dvush 31cb5eb
review fixes
dvush e836100
rename per_target -> per_transaction in args and some code
dvush 0b08afc
remove useless pub from TransactionBuilder
dvush bc77741
separate pub into pub and pub(super) for backrun pool
dvush d343058
RPC -> Rpc
dvush ee8d4f9
use correct async_trait
dvush ba3fced
comment MaybeFlashblockIndex trait
dvush c2f6bdf
import BTreeSet
dvush a6cde52
block_number -> block_number_min, fix block range on rpc
dvush f38423f
const defaults in backrun args
dvush ff75e58
change iter in payload_pool
dvush 561cd23
serde_with::skip_serializing_none
dvush b18b92e
use saturating_sub in rpc
dvush 6971cc8
use const in test
dvush 186915f
reject blob and deposit backrun transactions at RPC layer
dvush 0a9ab0e
filter backruns by remaining block gas in get_backruns
dvush 7e67c9e
move enabling backruns docs from mod.rs to args.rs
dvush 12e34c2
rename bundle_count gauge and add counters for bundle adds/removals
dvush c8e1229
shorten backrun module log target to backrun_bundle
dvush 99e804d
comments, rpc struct camel case
dvush 9e348d4
simplify payload pool
dvush 4a06dfc
more private structs
dvush 9eec46d
Merge remote-tracking branch 'origin/main' into backrun-bundles
dvush 0a5f30e
merge fixes
dvush File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| use clap::Args; | ||
|
|
||
| const DEFAULT_BACKRUNS_ENABLED: bool = false; | ||
| const DEFAULT_MAX_CONSIDERED_PER_BLOCK: usize = 100; | ||
| const DEFAULT_MAX_LANDED_PER_BLOCK: usize = 100; | ||
| const DEFAULT_MAX_CONSIDERED_PER_TRANSACTION: usize = 10; | ||
| const DEFAULT_MAX_LANDED_PER_TRANSACTION: usize = 1; | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Eq, Args)] | ||
| pub struct BackrunBundleArgs { | ||
| #[arg(long = "backruns.enabled", default_value_t = DEFAULT_BACKRUNS_ENABLED)] | ||
| pub backruns_enabled: bool, | ||
| #[arg( | ||
| long = "backruns.max_considered_backruns_per_block", | ||
| default_value_t = DEFAULT_MAX_CONSIDERED_PER_BLOCK | ||
| )] | ||
| pub max_considered_backruns_per_block: usize, | ||
| #[arg(long = "backruns.max_landed_backruns_per_block", default_value_t = DEFAULT_MAX_LANDED_PER_BLOCK)] | ||
| pub max_landed_backruns_per_block: usize, | ||
| #[arg( | ||
| long = "backruns.max_considered_backruns_per_transaction", | ||
| default_value_t = DEFAULT_MAX_CONSIDERED_PER_TRANSACTION | ||
| )] | ||
| pub max_considered_backruns_per_transaction: usize, | ||
| #[arg( | ||
| long = "backruns.max_landed_backruns_per_transaction", | ||
| default_value_t = DEFAULT_MAX_LANDED_PER_TRANSACTION | ||
| )] | ||
| pub max_landed_backruns_per_transaction: usize, | ||
| } | ||
|
|
||
| impl BackrunBundleArgs { | ||
| pub fn is_limit_reached( | ||
| &self, | ||
| block_backruns_considered: usize, | ||
| block_backruns_landed: usize, | ||
| tx_backruns_considered: usize, | ||
| tx_backruns_landed: usize, | ||
| ) -> bool { | ||
| tx_backruns_considered >= self.max_considered_backruns_per_transaction | ||
| || tx_backruns_landed >= self.max_landed_backruns_per_transaction | ||
| || block_backruns_considered >= self.max_considered_backruns_per_block | ||
| || block_backruns_landed >= self.max_landed_backruns_per_block | ||
| } | ||
| } | ||
|
|
||
| impl Default for BackrunBundleArgs { | ||
| fn default() -> Self { | ||
| Self { | ||
| backruns_enabled: DEFAULT_BACKRUNS_ENABLED, | ||
| max_considered_backruns_per_block: DEFAULT_MAX_CONSIDERED_PER_BLOCK, | ||
| max_landed_backruns_per_block: DEFAULT_MAX_LANDED_PER_BLOCK, | ||
| max_considered_backruns_per_transaction: DEFAULT_MAX_CONSIDERED_PER_TRANSACTION, | ||
| max_landed_backruns_per_transaction: DEFAULT_MAX_LANDED_PER_TRANSACTION, | ||
| } | ||
| } | ||
| } | ||
|
dvush marked this conversation as resolved.
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not too familiar with the performance considerations of evaluating backruns but will we always need caps on how many we consider or land? We could make these values optional and uncap them
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.
Backruns are inserted in the critical path of the builder so if you have too many backruns you will spend all you time trying them, its always good to have limits for that.
backruns_considered- this one is a strict cap on how many txs in the backrun path we try.backruns_landed_per_transaction- this one is also important, we might cap it for product reasons and also for performance reasons since we skip trying more backruns for tx after the first successful one.backruns_landed_per_blockis kind of previous one but per block and I can see it be useful to balance backruns and mempool txs.