Skip to content
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

Add enable_cancellation flag to submit_bid() of blinded_block_relay #115

Conversation

PatStiles
Copy link

Adds cancellation parameter to submit_bid() trait method and adds a Query() extractor to the server handler to deserialize the query parameter.

Closes #114

Copy link
Owner

@ralexstokes ralexstokes left a comment

Choose a reason for hiding this comment

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

nice! left a few comments

mev-rs/src/blinded_block_relayer/api/client.rs Outdated Show resolved Hide resolved
@@ -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?;
Copy link
Owner

Choose a reason for hiding this comment

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

want to round this out on the client?

I really like that you added this to the server part

we can optionally add a query param according to the spec: https://flashbots.github.io/relay-specs/#/Builder/submitBlock

here's an example to add the param: https://github.com/ralexstokes/beacon-api-client/blob/d838d930f80fdfcadfe32147bcb2e805aec074bc/src/api_client.rs#L233

Copy link
Author

Choose a reason for hiding this comment

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

Yeah! Sounds like a great time.

Copy link
Author

@PatStiles PatStiles Aug 18, 2023

Choose a reason for hiding this comment

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

@ralexstokes BeaconApiClient doesn't publicly expose the underlying reqwest::Client. We'd need to upstream or create a new reqwest::Client to add an additional query parameter. Want to make sure I have the right idea before I continue.

Copy link
Owner

Choose a reason for hiding this comment

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

yeah good point...

do you want to make a PR to beacon-api-client to just make endpoint and client pub?

then you can update the dep here and just do it directly here, rather than use the exported functions on Client

I took a look but think this probably best rather than trying to make another POST method that also takes query params

Copy link
Author

Choose a reason for hiding this comment

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

Sounds good opened a pr ralexstokes/beacon-api-client#77

@@ -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>,
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
Query(enable_cancellation): Query<bool>,
Query(with_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?))
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
Ok(Json(relayer.submit_bid(&signed_bid_submission, enable_cancellation).await?))
Ok(Json(relayer.submit_bid(&signed_bid_submission, with_cancellation).await?))

@@ -18,5 +18,6 @@ pub trait BlindedBlockRelayer {
async fn submit_bid(
&self,
signed_submission: &SignedBidSubmission,
enable_cancellations: bool,
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
enable_cancellations: bool,
with_cancellation: bool,

@PatStiles
Copy link
Author

Closing in favor of #119

@PatStiles PatStiles closed this Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support cancellation ability in the BlindedBlockRelayer trait
2 participants