Skip to content

Commit be82380

Browse files
authored
write builder tx in flashblocks (#20)
* move things around a little to get what's going on * add step to add the builder tx
1 parent 7da3183 commit be82380

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

src/main.rs

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -147,28 +147,37 @@ fn build_flashblocks_pipeline(
147147
// in limits
148148
let max_flashblocks = Arc::new(AtomicU64::new(0));
149149

150+
let flashblock_building_pipeline_steps = (
151+
AppendOrders::from_pool(pool).with_ok_on_limit(),
152+
OrderByPriorityFee::default(),
153+
RemoveRevertedTransactions::default(),
154+
BreakAfterDeadline,
155+
)
156+
.into_pipeline();
157+
158+
let flashblock_building_pipeline_steps =
159+
if let Some(ref signer) = cli_args.builder_signer {
160+
flashblock_building_pipeline_steps
161+
.with_epilogue(BuilderEpilogue::with_signer(signer.clone().into()))
162+
} else {
163+
flashblock_building_pipeline_steps
164+
};
165+
166+
let flashblock_building_pipeline = flashblock_building_pipeline_steps
167+
.with_epilogue(PublishFlashblock::new(
168+
&ws,
169+
cli_args.flashblocks_args.calculate_state_root,
170+
max_flashblocks.clone(),
171+
))
172+
.with_limits(FlashblockLimits::new(interval, max_flashblocks));
173+
174+
let block_building_pipeline = Pipeline::default()
175+
.with_pipeline(Loop, flashblock_building_pipeline)
176+
.with_step(BreakAfterDeadline);
177+
150178
let pipeline = Pipeline::<Flashblocks>::named("flashblocks")
151179
.with_prologue(OptimismPrologue)
152-
.with_pipeline(
153-
Loop,
154-
Pipeline::default()
155-
.with_pipeline(
156-
Loop,
157-
(
158-
AppendOrders::from_pool(pool).with_ok_on_limit(),
159-
OrderByPriorityFee::default(),
160-
RemoveRevertedTransactions::default(),
161-
BreakAfterDeadline,
162-
)
163-
.with_epilogue(PublishFlashblock::new(
164-
&ws,
165-
cli_args.flashblocks_args.calculate_state_root,
166-
max_flashblocks.clone(),
167-
))
168-
.with_limits(FlashblockLimits::new(interval, max_flashblocks)),
169-
)
170-
.with_step(BreakAfterDeadline),
171-
)
180+
.with_pipeline(Loop, block_building_pipeline)
172181
.with_limits(Scaled::default().deadline(total_building_time));
173182
ws.watch_shutdown(&pipeline);
174183

0 commit comments

Comments
 (0)