Skip to content

Commit

Permalink
feat(blinded_relay): add cancellation parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
PatStiles committed Aug 17, 2023
1 parent 9d88a23 commit cfe6a54
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions mev-rs/src/blinded_block_relayer/api/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ impl BlindedBlockRelayer for Client {
async fn submit_bid(
&self,
signed_submission: &SignedBidSubmission,
cancellation_enabled: bool,
) -> Result<SignedBidReceipt, Error> {
let response = self.api.http_post("/relay/v1/builder/blocks", signed_submission).await?;
let receipt: ApiResult<SignedBidReceipt> = response.json().await.map_err(ApiError::from)?;
Expand Down
5 changes: 3 additions & 2 deletions mev-rs/src/blinded_block_relayer/api/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
types::{ProposerSchedule, SignedBidReceipt, SignedBidSubmission},
};
use axum::{
extract::{Json, State},
extract::{Json, Query, State},
routing::{get, post, IntoMakeService},
Router,
};
Expand All @@ -24,10 +24,11 @@ async fn handle_get_proposal_schedule<R: BlindedBlockRelayer>(

async fn handle_submit_bid<R: BlindedBlockRelayer>(
State(relayer): State<R>,
Query(enable_cancellation): Query<bool>,
Json(signed_bid_submission): Json<SignedBidSubmission>,
) -> Result<Json<SignedBidReceipt>, Error> {
tracing::info!("handling bid submission");
Ok(Json(relayer.submit_bid(&signed_bid_submission).await?))
Ok(Json(relayer.submit_bid(&signed_bid_submission, enable_cancellation).await?))
}

pub struct Server<R: BlindedBlockRelayer> {
Expand Down
1 change: 1 addition & 0 deletions mev-rs/src/blinded_block_relayer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ pub trait BlindedBlockRelayer {
async fn submit_bid(
&self,
signed_submission: &SignedBidSubmission,
enable_cancellations: bool,
) -> Result<SignedBidReceipt, Error>;
}

0 comments on commit cfe6a54

Please sign in to comment.