-
Notifications
You must be signed in to change notification settings - Fork 208
Add optimistic collateral #885
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -138,7 +138,7 @@ struct BuiltBlockInfo { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// How submission works: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// 0. We divide relays into optimistic and non-optimistic (defined in config file) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// 1. We schedule submissions with non-optimistic key for all non-optimistic relays. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// 1.1 If "optimistic_enabled" is false or bid_value >= "optimistic_max_bid_value" we schedule submissions with non-optimistic key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// 1.1 If "optimistic_enabled" is false or bid_value >= "optimistic_v3_max_bid_eth" we schedule submissions with non-optimistic key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The doc comment still says
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// returns the best bid made | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[allow(clippy::too_many_arguments)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async fn run_submit_to_relays_job( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -427,21 +427,32 @@ fn submit_block_to_relays( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let mut optimistic_v3 = None; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if relay.optimistic_v3() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if let Some(config) = optimistic_v3_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| optimistic_v3 = create_optimistic_v3_request( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| &config.builder_url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| request.as_ref(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| maybe_adjustment_data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| relay.optimistic_v3_bid_adjustment_required(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map(|request| (config.clone(), SubmitHeaderRequestWithMetadata { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| submission: request, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metadata: bid_metadata.clone() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .inspect_err(|error| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| error!(parent: submission_span, ?error, "Unable to create optimistic V3 request"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .ok(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if relay | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .optimistic_v3_max_bid() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .is_some_and(|cap| bid_value > cap) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| info!( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+430
to
+434
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two items still open from previous reviews:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bid_value = format_ether(bid_value), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cap = format_ether(relay.optimistic_v3_max_bid().unwrap()), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Optimistic V3 disabled: bid exceeds max bid cap" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two issues here:
if let Some(cap) = relay.optimistic_v3_max_bid() {
if bid_value > cap {
debug!(
bid_value = format_ether(bid_value),
cap = format_ether(cap),
"Optimistic V3 disabled: bid exceeds max bid cap"
);
} else if let Some(config) = optimistic_v3_config {
// ... existing logic
}
} else if let Some(config) = optimistic_v3_config {
// ... existing logic
}Or keep the current structure but bind the cap: if let Some(cap) = relay.optimistic_v3_max_bid().filter(|&cap| bid_value > cap) {
debug!(
bid_value = format_ether(bid_value),
cap = format_ether(cap),
"Optimistic V3 disabled: bid exceeds max bid cap"
);
} else if let Some(config) = optimistic_v3_config { |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if let Some(config) = optimistic_v3_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| optimistic_v3 = create_optimistic_v3_request( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| &config.builder_url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| request.as_ref(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| maybe_adjustment_data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| relay.optimistic_v3_bid_adjustment_required(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .map(|request| (config.clone(), SubmitHeaderRequestWithMetadata { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| submission: request, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metadata: bid_metadata.clone() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| })) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .inspect_err(|error| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| error!(parent: submission_span, ?error, "Unable to create optimistic V3 request"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .ok(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Minor: this doc comment says
>=but the actual code on line 432 uses>(strictly greater). Since this PR touched this line to rename the field, it would be a good opportunity to fix the inconsistency.