-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add enable_cancellation
flag to submit_bid()
of blinded_block_relay
#115
Conversation
There was a problem hiding this 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
@@ -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?; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enable_cancellations: bool, | |
with_cancellation: bool, |
Closing in favor of #119 |
Adds cancellation parameter to
submit_bid()
trait method and adds aQuery()
extractor to the server handler to deserialize the query parameter.Closes #114