mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat(rpc): relax VaidationApi and EngineApi (#13241)
This commit is contained in:
@ -12,7 +12,7 @@ use reth_node_api::{
|
||||
EngineObjectValidationError, MessageValidationKind, PayloadOrAttributes, PayloadTypes,
|
||||
VersionSpecificValidationError,
|
||||
},
|
||||
validate_version_specific_fields, EngineTypes, EngineValidator,
|
||||
validate_version_specific_fields, EngineTypes, EngineValidator, PayloadValidator,
|
||||
};
|
||||
use reth_optimism_chainspec::OpChainSpec;
|
||||
use reth_optimism_forks::{OpHardfork, OpHardforks};
|
||||
@ -77,12 +77,22 @@ impl OpEngineValidator {
|
||||
}
|
||||
}
|
||||
|
||||
impl PayloadValidator for OpEngineValidator {
|
||||
type Block = Block;
|
||||
|
||||
fn ensure_well_formed_payload(
|
||||
&self,
|
||||
payload: ExecutionPayload,
|
||||
sidecar: ExecutionPayloadSidecar,
|
||||
) -> Result<SealedBlockFor<Self::Block>, PayloadError> {
|
||||
self.inner.ensure_well_formed_payload(payload, sidecar)
|
||||
}
|
||||
}
|
||||
|
||||
impl<Types> EngineValidator<Types> for OpEngineValidator
|
||||
where
|
||||
Types: EngineTypes<PayloadAttributes = OpPayloadAttributes>,
|
||||
{
|
||||
type Block = Block;
|
||||
|
||||
fn validate_version_specific_fields(
|
||||
&self,
|
||||
version: EngineApiMessageVersion,
|
||||
@ -136,14 +146,6 @@ where
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn ensure_well_formed_payload(
|
||||
&self,
|
||||
payload: ExecutionPayload,
|
||||
sidecar: ExecutionPayloadSidecar,
|
||||
) -> Result<SealedBlockFor<Self::Block>, PayloadError> {
|
||||
self.inner.ensure_well_formed_payload(payload, sidecar)
|
||||
}
|
||||
}
|
||||
|
||||
/// Validates the presence of the `withdrawals` field according to the payload timestamp.
|
||||
|
||||
@ -238,7 +238,12 @@ impl<N: FullNodeComponents<Types: NodeTypes<Primitives = OpPrimitives>>> OpAddOn
|
||||
impl<N> NodeAddOns<N> for OpAddOns<N>
|
||||
where
|
||||
N: FullNodeComponents<
|
||||
Types: NodeTypes<ChainSpec = OpChainSpec, Primitives = OpPrimitives, Storage = OpStorage>,
|
||||
Types: NodeTypesWithEngine<
|
||||
ChainSpec = OpChainSpec,
|
||||
Primitives = OpPrimitives,
|
||||
Storage = OpStorage,
|
||||
Engine = OpEngineTypes,
|
||||
>,
|
||||
>,
|
||||
OpEngineValidator: EngineValidator<<N::Types as NodeTypesWithEngine>::Engine>,
|
||||
{
|
||||
@ -283,7 +288,12 @@ where
|
||||
impl<N> RethRpcAddOns<N> for OpAddOns<N>
|
||||
where
|
||||
N: FullNodeComponents<
|
||||
Types: NodeTypes<ChainSpec = OpChainSpec, Primitives = OpPrimitives, Storage = OpStorage>,
|
||||
Types: NodeTypesWithEngine<
|
||||
ChainSpec = OpChainSpec,
|
||||
Primitives = OpPrimitives,
|
||||
Storage = OpStorage,
|
||||
Engine = OpEngineTypes,
|
||||
>,
|
||||
>,
|
||||
OpEngineValidator: EngineValidator<<N::Types as NodeTypesWithEngine>::Engine>,
|
||||
{
|
||||
@ -296,8 +306,13 @@ where
|
||||
|
||||
impl<N> EngineValidatorAddOn<N> for OpAddOns<N>
|
||||
where
|
||||
N: FullNodeComponents<Types: NodeTypes<ChainSpec = OpChainSpec>>,
|
||||
OpEngineValidator: EngineValidator<<N::Types as NodeTypesWithEngine>::Engine>,
|
||||
N: FullNodeComponents<
|
||||
Types: NodeTypesWithEngine<
|
||||
ChainSpec = OpChainSpec,
|
||||
Primitives = OpPrimitives,
|
||||
Engine = OpEngineTypes,
|
||||
>,
|
||||
>,
|
||||
{
|
||||
type Validator = OpEngineValidator;
|
||||
|
||||
@ -674,9 +689,12 @@ pub struct OpEngineValidatorBuilder;
|
||||
|
||||
impl<Node, Types> EngineValidatorBuilder<Node> for OpEngineValidatorBuilder
|
||||
where
|
||||
Types: NodeTypesWithEngine<ChainSpec = OpChainSpec>,
|
||||
Types: NodeTypesWithEngine<
|
||||
ChainSpec = OpChainSpec,
|
||||
Primitives = OpPrimitives,
|
||||
Engine = OpEngineTypes,
|
||||
>,
|
||||
Node: FullNodeComponents<Types = Types>,
|
||||
OpEngineValidator: EngineValidator<Types::Engine>,
|
||||
{
|
||||
type Validator = OpEngineValidator;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user