Skip to content

Commit 6784328

Browse files
authored
feat: add ability to restrict submissions to rproxies only (#805)
## πŸ“ Summary Add a flag that would allow restricting submissions to bloxroute rproxies only. ## βœ… I have completed the following steps: * [x] Run `make lint` * [x] Run `make test` * [ ] Added tests (if applicable)
1 parent f02a06a commit 6784328

File tree

5 files changed

+42
-3
lines changed

5 files changed

+42
-3
lines changed

β€Žcrates/rbuilder/src/integration/playground.rsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ impl Playground {
161161
Vec::new(),
162162
false,
163163
false,
164+
false,
164165
);
165166

166167
let payload = client

β€Žcrates/rbuilder/src/live_builder/block_output/relay_submit.rsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ async fn submit_bid_to_the_relay(
650650
Err(SubmitBlockErr::InvalidUrl(error)) => {
651651
error!(err = ?error, "Error parsing URL");
652652
}
653+
Err(SubmitBlockErr::NoRproxyAvailable) => {} // noop
653654
}
654655
}
655656

β€Žcrates/rbuilder/src/live_builder/config.rsβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ impl L1Config {
306306
relay_config.api_token_header.clone(),
307307
relay_config.is_bloxroute,
308308
relay_config.bloxroute_rproxy_regions.clone(),
309+
relay_config.bloxroute_rproxy_only,
309310
relay_config
310311
.ask_for_filtering_validators
311312
.unwrap_or(DEFAULT_ASK_FOR_FILTERING_VALIDATORS),
@@ -951,6 +952,7 @@ lazy_static! {
951952
adjustment_fee_payer: None,
952953
is_bloxroute: false,
953954
bloxroute_rproxy_regions: Vec::new(),
955+
bloxroute_rproxy_only: false,
954956
ask_for_filtering_validators: None,
955957
can_ignore_gas_limit: None,
956958
},
@@ -978,6 +980,7 @@ lazy_static! {
978980
adjustment_fee_payer: None,
979981
is_bloxroute: false,
980982
bloxroute_rproxy_regions: Vec::new(),
983+
bloxroute_rproxy_only: false,
981984
ask_for_filtering_validators: None,
982985
can_ignore_gas_limit: None,
983986
},
@@ -1005,6 +1008,7 @@ lazy_static! {
10051008
adjustment_fee_payer: None,
10061009
is_bloxroute: false,
10071010
bloxroute_rproxy_regions: Vec::new(),
1011+
bloxroute_rproxy_only: false,
10081012
ask_for_filtering_validators: None,
10091013
can_ignore_gas_limit: None,
10101014
},
@@ -1032,6 +1036,7 @@ lazy_static! {
10321036
adjustment_fee_payer: None,
10331037
is_bloxroute: false,
10341038
bloxroute_rproxy_regions: Vec::new(),
1039+
bloxroute_rproxy_only: false,
10351040
ask_for_filtering_validators: None,
10361041
can_ignore_gas_limit: None,
10371042
},
@@ -1059,6 +1064,7 @@ lazy_static! {
10591064
adjustment_fee_payer: None,
10601065
is_bloxroute: false,
10611066
bloxroute_rproxy_regions: Vec::new(),
1067+
bloxroute_rproxy_only: false,
10621068
ask_for_filtering_validators: None,
10631069
can_ignore_gas_limit: None,
10641070
},

β€Žcrates/rbuilder/src/mev_boost/mod.rsβ€Ž

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ pub struct RelayConfig {
9898
/// The list of bloxroute rproxy regions to send to order by preference.
9999
#[serde(default)]
100100
pub bloxroute_rproxy_regions: Vec<String>,
101+
/// Flag indicating whether the builder should only submit to rproxy endpoinds if available.
102+
#[serde(default)]
103+
pub bloxroute_rproxy_only: bool,
101104
/// Adds "filtering=true" as query to the call relay/v1/builder/validators to get all validators (including those filtering OFAC)
102105
/// On 2025/06/24 (my birthday!) only supported by ultrasound.
103106
/// None -> false
@@ -162,6 +165,8 @@ pub struct RelayClient {
162165
is_bloxroute: bool,
163166
/// Bloxroute rproxy regions.
164167
bloxroute_rproxy_regions: Vec<String>,
168+
/// Flag indicating whether rproxy regions are required.
169+
bloxroute_rproxy_only: bool,
165170
/// Adds "filtering=true" as query
166171
ask_for_filtering_validators: bool,
167172
/// If we submit a block with a different gas than the one the validator registered with in this relay the relay does not mind.
@@ -177,6 +182,7 @@ impl RelayClient {
177182
api_token_header: Option<String>,
178183
is_bloxroute: bool,
179184
bloxroute_rproxy_regions: Vec<String>,
185+
bloxroute_rproxy_only: bool,
180186
ask_for_filtering_validators: bool,
181187
can_ignore_gas_limit: bool,
182188
) -> Self {
@@ -189,6 +195,7 @@ impl RelayClient {
189195
api_token_header,
190196
is_bloxroute,
191197
bloxroute_rproxy_regions,
198+
bloxroute_rproxy_only,
192199
ask_for_filtering_validators,
193200
can_ignore_gas_limit,
194201
}
@@ -204,6 +211,7 @@ impl RelayClient {
204211
Vec::new(),
205212
false,
206213
false,
214+
false,
207215
)
208216
}
209217

@@ -523,6 +531,8 @@ pub enum SubmitBlockErr {
523531
InvalidHeader,
524532
#[error("Block known")]
525533
BlockKnown,
534+
#[error("No rproxy available")]
535+
NoRproxyAvailable,
526536
#[error("gRPC error")]
527537
Grpc(#[from] Box<tonic::Status>),
528538
}
@@ -937,6 +947,8 @@ impl RelayClient {
937947
error!(?error, url = %regional.http_endpoint, "Error parsing rproxy URL");
938948
SubmitBlockErr::InvalidUrl(error)
939949
});
950+
} else if self.bloxroute_rproxy_only {
951+
return Err(SubmitBlockErr::NoRproxyAvailable);
940952
}
941953

942954
if self.is_bloxroute {
@@ -1254,8 +1266,17 @@ mod tests {
12541266
let mut generator = TestDataGenerator::default();
12551267

12561268
let relay_url = Url::from_str(&srv.endpoint()).unwrap();
1257-
let relay =
1258-
RelayClient::from_url(relay_url, None, None, None, false, Vec::new(), false, false);
1269+
let relay = RelayClient::from_url(
1270+
relay_url,
1271+
None,
1272+
None,
1273+
None,
1274+
false,
1275+
Vec::new(),
1276+
false,
1277+
false,
1278+
false,
1279+
);
12591280
let submission = SubmitBlockRequest {
12601281
request: Arc::new(generator.create_deneb_submit_block_request()),
12611282
adjustment_data: None,

β€Žcrates/test-relay/src/main.rsβ€Ž

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,17 @@ async fn main() -> eyre::Result<()> {
101101

102102
let relay = {
103103
let url: Url = cli.relay.parse()?;
104-
let client = RelayClient::from_url(url, None, None, None, false, Vec::new(), false, false);
104+
let client = RelayClient::from_url(
105+
url,
106+
None,
107+
None,
108+
None,
109+
false,
110+
Vec::new(),
111+
false,
112+
false,
113+
false,
114+
);
105115
MevBoostRelaySlotInfoProvider::new(client, "relay".to_string())
106116
};
107117

0 commit comments

Comments
Β (0)