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

feat: add submit block request query #995

Merged
merged 1 commit into from
Jun 30, 2024
Merged
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
18 changes: 17 additions & 1 deletion crates/rpc-types-beacon/src/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub struct ValidatorRegistration {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ValidatorRegistrationMessage {
/// The fee recipient's address.
#[serde(rename = "fee_recipient")]
pub fee_recipient: Address,

/// The gas limit for the registration.
Expand Down Expand Up @@ -150,6 +149,23 @@ pub struct SubmitBlockRequest {
pub signature: BlsSignature,
}

/// Query for the `/relay/v1/builder/blocks` endpoint
#[serde_as]
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SubmitBlockRequestQuery {
/// If set to 1, opt into bid cancellations.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde_as(as = "Option<serde_with::BoolFromInt>")]
pub cancellations: Option<bool>,
}

impl SubmitBlockRequestQuery {
/// Opt into bid cancellations.
pub const fn cancellations() -> Self {
Self { cancellations: Some(true) }
}
}

/// A Request to validate a [SubmitBlockRequest] <https://github.com/flashbots/builder/blob/03ee71cf0a344397204f65ff6d3a917ee8e06724/eth/block-validation/api.go#L132-L136>
#[serde_as]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
Expand Down