-
Notifications
You must be signed in to change notification settings - Fork 29
Add builder txn to Flashblocks #89
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 all 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 |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ use std::{sync::Arc, time::Instant}; | |
| use super::{config::FlashblocksConfig, wspub::WebSocketPublisher}; | ||
| use crate::{ | ||
| builders::{ | ||
| context::OpPayloadBuilderCtx, | ||
| context::{estimate_gas_for_builder_tx, OpPayloadBuilderCtx}, | ||
| flashblocks::config::FlashBlocksConfigExt, | ||
| generator::{BlockCell, BuildArguments}, | ||
| BuilderConfig, | ||
|
|
@@ -257,6 +257,13 @@ where | |
| } | ||
| }); | ||
|
|
||
| let message = format!("Block Number: {}", ctx.block_number()) | ||
| .as_bytes() | ||
| .to_vec(); | ||
| let builder_tx_gas = ctx | ||
| .builder_signer() | ||
| .map_or(0, |_| estimate_gas_for_builder_tx(message.clone())); | ||
|
|
||
| // Process flashblocks in a blocking loop | ||
| loop { | ||
| // Block on receiving a message, break on cancellation or closed channel | ||
|
|
@@ -340,6 +347,12 @@ where | |
| return Ok(()); | ||
| } | ||
|
|
||
| // If it is the last flashblocks, add the builder txn to the block if enabled | ||
| if flashblock_count == self.config.flashblocks_per_block() - 1 { | ||
| // TODO: Account for DA size limits | ||
|
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. Important note. It does not account neither yet for DA limits nor for gas limits. It is still a bit of an heuristic we have to figure out how to split gas limit and DA limit in flashblocks. 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. I thought we want a builder tx for every flashblock? |
||
| ctx.add_builder_tx(&mut info, &mut db, builder_tx_gas, message.clone()); | ||
| } | ||
|
|
||
| let total_block_built_duration = Instant::now(); | ||
| let build_result = build_block(db, &ctx, &mut info); | ||
| ctx.metrics | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,7 +147,7 @@ where | |
| builder_signer: args.builder_signer, | ||
| revert_protection: args.enable_revert_protection, | ||
| block_time: Duration::from_millis(args.chain_block_time), | ||
| block_time_leeway: Duration::from_millis(500), | ||
| block_time_leeway: Duration::from_secs(args.extra_block_deadline_secs), | ||
|
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. This was missing, the flag extra-block-deadline-secs was not being used |
||
| da_config: Default::default(), | ||
| specific: S::try_from(args)?, | ||
| }) | ||
|
|
||
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.
I am changing this flag too so that all of them have the same prefix