Skip to content

Commit

Permalink
refactor(op-rbuilder): simplify OpRbuilderPayloadBuilder implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
bendanzhentan committed Dec 25, 2024
1 parent f131f2f commit 6fa1104
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
7 changes: 4 additions & 3 deletions crates/op-rbuilder/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,10 @@ impl OpRbuilderPayloadServiceBuilder {

Evm: ConfigureEvm<Header = Header>,
{
let payload_builder =
op_rbuilder_payload_builder::OpRbuilderPayloadBuilder::new(evm_config)
.set_compute_pending_block(self.compute_pending_block);
let payload_builder = op_rbuilder_payload_builder::OpRbuilderPayloadBuilder::new(
evm_config,
self.compute_pending_block,
);
let conf = ctx.payload_builder_config();

let payload_job_config = BasicPayloadJobGeneratorConfig::default()
Expand Down
20 changes: 2 additions & 18 deletions crates/op-rbuilder/payload_builder/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,12 @@ pub struct OpRbuilderPayloadBuilder<EvmConfig> {
}

impl<EvmConfig> OpRbuilderPayloadBuilder<EvmConfig> {
pub const fn new(evm_config: EvmConfig) -> Self {
pub const fn new(evm_config: EvmConfig, compute_pending_block: bool) -> Self {
Self {
compute_pending_block: true,
evm_config,
compute_pending_block,
}
}

/// Sets the rollup's compute pending block configuration option.
pub const fn set_compute_pending_block(mut self, compute_pending_block: bool) -> Self {
self.compute_pending_block = compute_pending_block;
self
}

/// Enables the rollup's compute pending block configuration option.
pub const fn compute_pending_block(self) -> Self {
self.set_compute_pending_block(true)
}

/// Returns the rollup's compute pending block configuration option.
pub const fn is_compute_pending_block(&self) -> bool {
self.compute_pending_block
}
}

impl<EvmConfig> OpRbuilderPayloadBuilder<EvmConfig>
Expand Down

0 comments on commit 6fa1104

Please sign in to comment.