Skip to content

Commit b473f4e

Browse files
authored
remove ws publishing from synced flashblocks (#312)
1 parent 0019a7b commit b473f4e

File tree

3 files changed

+1
-28
lines changed

3 files changed

+1
-28
lines changed

crates/op-rbuilder/src/builders/flashblocks/ctx.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ impl OpPayloadSyncerCtx {
5656
self.max_gas_per_txn
5757
}
5858

59-
pub(super) fn metrics(&self) -> &Arc<OpRBuilderMetrics> {
60-
&self.metrics
61-
}
62-
6359
pub(super) fn into_op_payload_builder_ctx(
6460
self,
6561
payload_config: PayloadConfig<OpPayloadBuilderAttributes<OpTransactionSigned>>,

crates/op-rbuilder/src/builders/flashblocks/payload_handler.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::{
22
builders::flashblocks::{
33
ctx::OpPayloadSyncerCtx, p2p::Message, payload::FlashblocksExecutionInfo,
4-
wspub::WebSocketPublisher,
54
},
65
primitives::reth::ExecutionInfo,
76
traits::ClientBounds,
@@ -38,9 +37,6 @@ pub(crate) struct PayloadHandler<Client> {
3837
p2p_tx: mpsc::Sender<Message>,
3938
// sends a `Events::BuiltPayload` to the reth payload builder when a new payload is received.
4039
payload_events_handle: tokio::sync::broadcast::Sender<Events<OpEngineTypes>>,
41-
/// WebSocket publisher for broadcasting flashblocks
42-
/// to all connected subscribers.
43-
ws_pub: Arc<WebSocketPublisher>,
4440
// context required for execution of blocks during syncing
4541
ctx: OpPayloadSyncerCtx,
4642
// chain client
@@ -59,7 +55,6 @@ where
5955
p2p_tx: mpsc::Sender<Message>,
6056
payload_events_handle: tokio::sync::broadcast::Sender<Events<OpEngineTypes>>,
6157
ctx: OpPayloadSyncerCtx,
62-
ws_pub: Arc<WebSocketPublisher>,
6358
client: Client,
6459
cancel: tokio_util::sync::CancellationToken,
6560
) -> Self {
@@ -68,7 +63,6 @@ where
6863
p2p_rx,
6964
p2p_tx,
7065
payload_events_handle,
71-
ws_pub,
7266
ctx,
7367
client,
7468
cancel,
@@ -82,7 +76,6 @@ where
8276
p2p_tx,
8377
payload_events_handle,
8478
ctx,
85-
ws_pub,
8679
client,
8780
cancel,
8881
} = self;
@@ -105,38 +98,23 @@ where
10598
let ctx = ctx.clone();
10699
let client = client.clone();
107100
let payload_events_handle = payload_events_handle.clone();
108-
let ws_pub = ws_pub.clone();
109101
let cancel = cancel.clone();
110102

111103
// execute the flashblock on a thread where blocking is acceptable,
112104
// as it's potentially a heavy operation
113105
tokio::task::spawn_blocking(move || {
114-
let metrics = ctx.metrics().clone();
115106
let res = execute_flashblock(
116107
payload,
117108
ctx,
118109
client,
119110
cancel,
120111
);
121112
match res {
122-
Ok((payload, fb_payload)) => {
113+
Ok((payload, _)) => {
123114
tracing::info!(hash = payload.block().hash().to_string(), block_number = payload.block().header().number, "successfully executed received flashblock");
124115
if let Err(e) = payload_events_handle.send(Events::BuiltPayload(payload)) {
125116
warn!(e = ?e, "failed to send BuiltPayload event on synced block");
126117
}
127-
128-
match ws_pub
129-
.publish(&fb_payload) {
130-
Ok(flashblock_byte_size) => {
131-
metrics
132-
.flashblock_byte_size_histogram
133-
.record(flashblock_byte_size as f64);
134-
}
135-
Err(e) => {
136-
tracing::warn!(error = ?e, "failed to publish flashblock to websocket subscribers");
137-
}
138-
}
139-
140118
}
141119
Err(e) => {
142120
tracing::error!(error = ?e, "failed to execute received flashblock");

crates/op-rbuilder/src/builders/flashblocks/service.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ impl FlashblocksServiceBuilder {
150150
outgoing_message_tx,
151151
payload_service.payload_events_handle(),
152152
syncer_ctx,
153-
ws_pub,
154153
ctx.provider().clone(),
155154
cancel,
156155
);

0 commit comments

Comments
 (0)