Skip to content

Call execution_mode only once in get_payload #245

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

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,11 @@ impl RollupBoostServer {
version: Version,
) -> RpcResult<OpExecutionPayloadEnvelope> {
let l2_fut = self.l2_client.get_payload(payload_id, version);
let execution_mode = self.execution_mode();

// If execution mode is disabled, return the l2 payload without sending
// the request to the builder
if self.execution_mode().is_disabled() {
if execution_mode.is_disabled() {
return match l2_fut.await {
Ok(payload) => {
self.probes.set_health(Health::Healthy);
Expand Down Expand Up @@ -654,7 +655,7 @@ impl RollupBoostServer {
self.probes.set_health(Health::Healthy);

if let Ok(Some(payload)) = builder_payload {
if self.execution_mode().is_dry_run() {
if execution_mode.is_dry_run() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an edge case here where execution mode is enabled when this function is invoked but later switched to DryRun before receiving the payloads. In this case, the builder block will be selected. If this is an acceptable edge case then lgtm.

(l2_payload, PayloadSource::L2)
} else {
(payload, PayloadSource::Builder)
Expand Down
Loading