Skip to content

Commit ffa5156

Browse files
authored
chore: revert block request removal from BidObserver (#710)
## 📝 Summary Revert block request removal from `BidObserver`. Regression was introduced in #702 ## ✅ I have completed the following steps: * [x] Run `make lint` * [x] Run `make test` * [ ] Added tests (if applicable)
1 parent fbf6e02 commit ffa5156

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

crates/rbuilder/src/live_builder/block_output/bid_observer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ impl BidObserver for NullBidObserver {
2525
&self,
2626
_slot_data: &MevBoostSlotData,
2727
_sealed_block: &SealedBlock,
28+
_submit_block_request: &SubmitBlockRequest,
2829
_built_block_trace: &BuiltBlockTrace,
2930
_builder_name: String,
3031
_best_bid_value: U256,

crates/rbuilder/src/live_builder/block_output/bid_observer_multiplexer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ impl BidObserver for BidObserverMultiplexer {
2727
&self,
2828
slot_data: &MevBoostSlotData,
2929
sealed_block: &SealedBlock,
30+
submit_block_request: &SubmitBlockRequest,
3031
built_block_trace: &BuiltBlockTrace,
3132
builder_name: String,
3233
best_bid_value: alloy_primitives::U256,

crates/rbuilder/src/live_builder/block_output/bidding_service_interface.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use tokio_util::sync::CancellationToken;
1010
use crate::{
1111
building::{builders::block_building_helper::BiddableUnfinishedBlock, BuiltBlockTrace},
1212
live_builder::payload_events::MevBoostSlotData,
13+
mev_boost::submission::SubmitBlockRequest,
1314
};
1415

1516
/// Trait that receives every bid made by us to the relays.
@@ -19,6 +20,7 @@ pub trait BidObserver: std::fmt::Debug {
1920
&self,
2021
slot_data: &MevBoostSlotData,
2122
sealed_block: &SealedBlock,
23+
submit_block_request: &SubmitBlockRequest,
2224
built_block_trace: &BuiltBlockTrace,
2325
builder_name: String,
2426
best_bid_value: U256,
@@ -33,6 +35,7 @@ impl BidObserver for NullBidObserver {
3335
&self,
3436
_slot_data: &MevBoostSlotData,
3537
_sealed_block: &SealedBlock,
38+
_submit_block_request: &SubmitBlockRequest,
3639
_built_block_trace: &BuiltBlockTrace,
3740
_builder_name: String,
3841
_best_bid_value: U256,

crates/rbuilder/src/live_builder/block_output/relay_submit.rs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ async fn run_submit_to_relays_job(
298298
&cancel,
299299
);
300300

301-
if let Some((optimistic_signed_block, _)) = optimistic_signed_block {
301+
let signed_block = if let Some((optimistic_signed_block, _)) = optimistic_signed_block {
302302
submit_block_to_relays(
303303
&config.chain_spec,
304304
&optimistic_signed_block,
@@ -311,6 +311,7 @@ async fn run_submit_to_relays_job(
311311
&submission_span,
312312
&cancel,
313313
);
314+
optimistic_signed_block
314315
} else {
315316
// non-optimistic submission to optimistic relays
316317
submit_block_to_relays(
@@ -325,18 +326,27 @@ async fn run_submit_to_relays_job(
325326
&submission_span,
326327
&cancel,
327328
);
328-
}
329+
normal_signed_block
330+
};
329331

330-
submission_span.in_scope(|| {
331-
// NOTE: we only notify normal submission here because they have the same contents but different pubkeys
332-
config.bid_observer.block_submitted(
333-
&slot_data,
334-
&block.sealed_block,
335-
&block.trace,
336-
builder_name,
337-
bid_metadata.value.top_competitor_bid.unwrap_or_default(),
338-
);
339-
})
332+
match signed_block.into_request(&config.chain_spec, None) {
333+
Ok(request) => {
334+
submission_span.in_scope(|| {
335+
// NOTE: we only notify normal submission here because they have the same contents but different pubkeys
336+
config.bid_observer.block_submitted(
337+
&slot_data,
338+
&block.sealed_block,
339+
&request,
340+
&block.trace,
341+
builder_name,
342+
bid_metadata.value.top_competitor_bid.unwrap_or_default(),
343+
);
344+
})
345+
}
346+
Err(err) => {
347+
error!(parent: &submission_span, err = ?err, "Error converting request for bid observer");
348+
}
349+
};
340350
}
341351
}
342352

0 commit comments

Comments
 (0)