-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rpc): Start to implement flashbots_validateBuilderSubmissionV3
* Currently just parses params and accepts all inputs. * Mainly so we can unblock kurtosis testing for pectra
- Loading branch information
1 parent
777417a
commit 92e67d0
Showing
7 changed files
with
117 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
use alloy_rpc_types_beacon::relay::{ | ||
BuilderBlockValidationRequest, BuilderBlockValidationRequestV2, BuilderBlockValidationRequestV3, | ||
}; | ||
use async_trait::async_trait; | ||
use jsonrpsee::core::RpcResult; | ||
use reth_chainspec::ChainSpecProvider; | ||
use reth_provider::{ | ||
AccountReader, BlockReaderIdExt, HeaderProvider, StateProviderFactory, WithdrawalsProvider, | ||
}; | ||
use reth_rpc_api::BlockSubmissionValidationApiServer; | ||
use std::sync::Arc; | ||
|
||
/// The type that implements the `validation` rpc namespace trait | ||
pub struct ValidationApi<Provider> { | ||
inner: Arc<ValidationApiInner<Provider>>, | ||
} | ||
|
||
impl<Provider> ValidationApi<Provider> | ||
where | ||
Provider: BlockReaderIdExt | ||
+ ChainSpecProvider | ||
+ StateProviderFactory | ||
+ HeaderProvider | ||
+ AccountReader | ||
+ WithdrawalsProvider | ||
+ Clone | ||
+ 'static, | ||
{ | ||
/// The provider that can interact with the chain. | ||
pub fn provider(&self) -> Provider { | ||
self.inner.provider.clone() | ||
} | ||
|
||
/// Create a new instance of the [`ValidationApi`] | ||
pub fn new(provider: Provider) -> Self { | ||
let inner = Arc::new(ValidationApiInner { provider }); | ||
Self { inner } | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl<Provider> BlockSubmissionValidationApiServer for ValidationApi<Provider> | ||
where | ||
Provider: BlockReaderIdExt | ||
+ ChainSpecProvider | ||
+ StateProviderFactory | ||
+ HeaderProvider | ||
+ AccountReader | ||
+ WithdrawalsProvider | ||
+ Clone | ||
+ 'static, | ||
{ | ||
async fn validate_builder_submission_v1( | ||
&self, | ||
_request: BuilderBlockValidationRequest, | ||
) -> RpcResult<()> { | ||
todo!() | ||
} | ||
|
||
async fn validate_builder_submission_v2( | ||
&self, | ||
_request: BuilderBlockValidationRequestV2, | ||
) -> RpcResult<()> { | ||
todo!() | ||
} | ||
|
||
/// Validates a block submitted to the relay | ||
async fn validate_builder_submission_v3( | ||
&self, | ||
request: BuilderBlockValidationRequestV3, | ||
) -> RpcResult<()> { | ||
Ok(()) | ||
} | ||
} | ||
|
||
impl<Provider> std::fmt::Debug for ValidationApi<Provider> { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
f.debug_struct("ValidationApi").finish_non_exhaustive() | ||
} | ||
} | ||
|
||
impl<Provider> Clone for ValidationApi<Provider> { | ||
fn clone(&self) -> Self { | ||
Self { inner: Arc::clone(&self.inner) } | ||
} | ||
} | ||
|
||
struct ValidationApiInner<Provider> { | ||
/// The provider that can interact with the chain. | ||
provider: Provider, | ||
} |