mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-28 16:48:13 -05:00
feat: add submitblock request (#5815)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
use crate::{
|
||||
beacon::{BlsPublicKey, BlsSignature},
|
||||
engine::{BlobsBundleV1, ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3},
|
||||
ExecutionPayload,
|
||||
};
|
||||
use alloy_primitives::{Address, B256, U256};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -105,6 +106,36 @@ pub struct SignedBidSubmissionV3 {
|
||||
pub signature: BlsSignature,
|
||||
}
|
||||
|
||||
/// SubmitBlockRequest is the request from the builder to submit a block.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct SubmitBlockRequest {
|
||||
pub message: BidTrace,
|
||||
#[serde(with = "crate::beacon::payload::beacon_payload")]
|
||||
pub execution_payload: ExecutionPayload,
|
||||
pub signature: BlsSignature,
|
||||
}
|
||||
|
||||
/// 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)]
|
||||
pub struct BuilderBlockValidationRequest {
|
||||
#[serde(flatten)]
|
||||
pub request: SubmitBlockRequest,
|
||||
#[serde_as(as = "DisplayFromStr")]
|
||||
pub registered_gas_limit: u64,
|
||||
}
|
||||
|
||||
/// A Request to validate a [SubmitBlockRequest] <https://github.com/flashbots/builder/blob/03ee71cf0a344397204f65ff6d3a917ee8e06724/eth/block-validation/api.go#L204-L204>
|
||||
#[serde_as]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct BuilderBlockValidationRequestV2 {
|
||||
#[serde(flatten)]
|
||||
pub request: SubmitBlockRequest,
|
||||
#[serde_as(as = "DisplayFromStr")]
|
||||
pub registered_gas_limit: u64,
|
||||
pub withdrawals_root: B256,
|
||||
}
|
||||
|
||||
/// Query for the GET `/relay/v1/data/bidtraces/proposer_payload_delivered`
|
||||
///
|
||||
/// Provides [BidTrace]s for payloads that were delivered to proposers.
|
||||
@@ -289,4 +320,13 @@ mod tests {
|
||||
let bid = SignedBidSubmissionV2::from_ssz_bytes(&bytes).unwrap();
|
||||
assert_eq!(bytes, bid.as_ssz_bytes());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_can_parse_validation_request_body() {
|
||||
const VALIDATION_REQUEST_BODY: &str =
|
||||
include_str!("../test_data/relay/single_payload.json");
|
||||
|
||||
let _validation_request_body: BuilderBlockValidationRequest =
|
||||
serde_json::from_str(VALIDATION_REQUEST_BODY).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
246
crates/rpc/rpc-types/test_data/relay/single_payload.json
Normal file
246
crates/rpc/rpc-types/test_data/relay/single_payload.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user