mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(api,rpc): improve engine API abstraction (#6871)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -48,8 +48,12 @@ use reth_payload_builder::{
|
||||
};
|
||||
use reth_primitives::{Address, ChainSpec, Genesis, Header, Withdrawals, B256};
|
||||
use reth_rpc_types::{
|
||||
engine::{PayloadAttributes as EthPayloadAttributes, PayloadId},
|
||||
engine::{
|
||||
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3,
|
||||
PayloadAttributes as EthPayloadAttributes, PayloadId,
|
||||
},
|
||||
withdrawal::Withdrawal,
|
||||
ExecutionPayloadV1,
|
||||
};
|
||||
use reth_tracing::{RethTracer, Tracer};
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -95,7 +99,9 @@ impl PayloadAttributes for CustomPayloadAttributes {
|
||||
|
||||
// custom validation logic - ensure that the custom field is not zero
|
||||
if self.custom == 0 {
|
||||
return Err(AttributesValidationError::invalid_params(CustomError::CustomFieldIsNotZero))
|
||||
return Err(AttributesValidationError::invalid_params(
|
||||
CustomError::CustomFieldIsNotZero,
|
||||
));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -153,7 +159,7 @@ impl PayloadBuilderAttributes for CustomPayloadBuilderAttributes {
|
||||
|
||||
/// Custom engine types - uses a custom payload attributes RPC type, but uses the default
|
||||
/// payload builder attributes type.
|
||||
#[derive(Clone, Debug, Default, Deserialize)]
|
||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||
#[non_exhaustive]
|
||||
pub struct CustomEngineTypes;
|
||||
|
||||
@ -161,6 +167,9 @@ impl EngineTypes for CustomEngineTypes {
|
||||
type PayloadAttributes = CustomPayloadAttributes;
|
||||
type PayloadBuilderAttributes = CustomPayloadBuilderAttributes;
|
||||
type BuiltPayload = EthBuiltPayload;
|
||||
type ExecutionPayloadV1 = ExecutionPayloadV1;
|
||||
type ExecutionPayloadV2 = ExecutionPayloadEnvelopeV2;
|
||||
type ExecutionPayloadV3 = ExecutionPayloadEnvelopeV3;
|
||||
|
||||
fn validate_version_specific_fields(
|
||||
chain_spec: &ChainSpec,
|
||||
|
||||
Reference in New Issue
Block a user