Skip to content

Commit

Permalink
fix over eager v2 demotions
Browse files Browse the repository at this point in the history
  • Loading branch information
gd-0 committed Feb 2, 2024
1 parent 3d7e4a7 commit 40a4212
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions crates/api/src/builder/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,18 +561,6 @@ where
// Decode the incoming request body into a payload
let (payload, _) = decode_payload(req, &mut trace, &request_id).await?;

// Verify the payload is for the current slot
if payload.slot() <= head_slot {
warn!(
request_id = %request_id,
"submission is for a past slot",
);
return Err(BuilderApiError::SubmissionForPastSlot {
current_slot: head_slot,
submission_slot: payload.slot(),
});
}

let builder_pub_key = payload.builder_public_key().clone();
let block_hash = payload.message().block_hash.clone();
debug!(
Expand All @@ -593,6 +581,18 @@ where
.await
.map_err(|_| BuilderApiError::InternalError)?;

// Verify the payload is for the current slot
if payload.slot() <= head_slot {
warn!(
request_id = %request_id,
"submission is for a past slot",
);
return Err(BuilderApiError::SubmissionForPastSlot {
current_slot: head_slot,
submission_slot: payload.slot(),
});
}

// Fetch builder info
let builder_info = api.fetch_builder_info(payload.builder_public_key()).await;

Expand Down

0 comments on commit 40a4212

Please sign in to comment.