11use crate :: primitives:: CustomNodePrimitives ;
2- use alloy_rpc_types_engine:: {
3- BlobsBundleV1 , ExecutionPayloadV1 , ExecutionPayloadV2 , ExecutionPayloadV3 ,
4- } ;
5- use op_alloy_rpc_types_engine:: {
6- OpExecutionData , OpExecutionPayload , OpExecutionPayloadEnvelopeV3 ,
7- OpExecutionPayloadEnvelopeV4 , OpExecutionPayloadV4 ,
8- } ;
2+ use op_alloy_rpc_types_engine:: { OpExecutionData , OpExecutionPayload } ;
93use reth_chain_state:: ExecutedBlockWithTrieUpdates ;
104use reth_node_api:: {
11- BuiltPayload , EngineTypes , ExecutionPayload , NodePrimitives , PayloadAttributes ,
12- PayloadBuilderAttributes , PayloadTypes ,
5+ BuiltPayload , ExecutionPayload , NodePrimitives , PayloadAttributes , PayloadBuilderAttributes ,
6+ PayloadTypes ,
137} ;
148use reth_optimism_node:: { OpBuiltPayload , OpPayloadAttributes , OpPayloadBuilderAttributes } ;
159use reth_optimism_primitives:: OpTransactionSigned ;
1610use reth_primitives_traits:: SealedBlock ;
1711use revm_primitives:: U256 ;
1812use serde:: { Deserialize , Serialize } ;
19- use std:: sync:: Arc ;
2013
2114#[ derive( Debug , Clone , Copy , Serialize , Deserialize ) ]
22- pub struct CustomEngineTypes ;
15+ pub struct CustomPayloadTypes ;
2316
2417#[ derive( Debug , Clone , Serialize , Deserialize ) ]
2518pub struct CustomExecutionData {
@@ -164,79 +157,7 @@ impl From<CustomBuiltPayload>
164157 }
165158}
166159
167- impl From < CustomBuiltPayload > for ExecutionPayloadV1 {
168- fn from ( value : CustomBuiltPayload ) -> Self {
169- Self :: from_block_unchecked ( value. block ( ) . hash ( ) , & value. into ( ) )
170- }
171- }
172-
173- impl From < CustomBuiltPayload > for ExecutionPayloadV2 {
174- fn from ( value : CustomBuiltPayload ) -> Self {
175- Self :: from_block_unchecked ( value. block ( ) . hash ( ) , & value. into ( ) )
176- }
177- }
178-
179- impl From < CustomBuiltPayload > for OpExecutionPayloadEnvelopeV3 {
180- fn from ( value : CustomBuiltPayload ) -> Self {
181- Self {
182- block_value : value. fees ( ) ,
183- // From the engine API spec:
184- //
185- // > Client software **MAY** use any heuristics to decide whether to set
186- // `shouldOverrideBuilder` flag or not. If client software does not implement any
187- // heuristic this flag **SHOULD** be set to `false`.
188- //
189- // Spec:
190- // <https://github.com/ethereum/execution-apis/blob/fe8e13c288c592ec154ce25c534e26cb7ce0530d/src/engine/cancun.md#specification-2>
191- should_override_builder : false ,
192- // No blobs for OP.
193- blobs_bundle : BlobsBundleV1 { blobs : vec ! [ ] , commitments : vec ! [ ] , proofs : vec ! [ ] } ,
194- parent_beacon_block_root : value. 0 . block ( ) . parent_beacon_block_root . unwrap_or_default ( ) ,
195- execution_payload : ExecutionPayloadV3 :: from_block_unchecked (
196- value. 0 . block ( ) . hash ( ) ,
197- & value. into ( ) ,
198- ) ,
199- }
200- }
201- }
202-
203- impl From < CustomBuiltPayload > for OpExecutionPayloadEnvelopeV4 {
204- fn from ( value : CustomBuiltPayload ) -> Self {
205- let fees = value. 0 . fees ( ) ;
206- let block = value. 0 . into_sealed_block ( ) ;
207-
208- let parent_beacon_block_root = block. parent_beacon_block_root . unwrap_or_default ( ) ;
209-
210- let l2_withdrawals_root = block. withdrawals_root . unwrap_or_default ( ) ;
211- let payload_v3 = ExecutionPayloadV3 :: from_block_unchecked (
212- block. hash ( ) ,
213- & Arc :: unwrap_or_clone ( block. into ( ) ) . into_block ( ) ,
214- ) ;
215-
216- Self {
217- execution_payload : OpExecutionPayloadV4 :: from_v3_with_withdrawals_root (
218- payload_v3,
219- l2_withdrawals_root,
220- ) ,
221- block_value : fees,
222- // From the engine API spec:
223- //
224- // > Client software **MAY** use any heuristics to decide whether to set
225- // `shouldOverrideBuilder` flag or not. If client software does not implement any
226- // heuristic this flag **SHOULD** be set to `false`.
227- //
228- // Spec:
229- // <https://github.com/ethereum/execution-apis/blob/fe8e13c288c592ec154ce25c534e26cb7ce0530d/src/engine/cancun.md#specification-2>
230- should_override_builder : false ,
231- // No blobs for OP.
232- blobs_bundle : BlobsBundleV1 { blobs : vec ! [ ] , commitments : vec ! [ ] , proofs : vec ! [ ] } ,
233- parent_beacon_block_root,
234- execution_requests : vec ! [ ] ,
235- }
236- }
237- }
238-
239- impl PayloadTypes for CustomEngineTypes {
160+ impl PayloadTypes for CustomPayloadTypes {
240161 type BuiltPayload = CustomBuiltPayload ;
241162 type PayloadAttributes = CustomPayloadAttributes ;
242163 type PayloadBuilderAttributes = CustomPayloadBuilderAttributes ;
@@ -254,10 +175,3 @@ impl PayloadTypes for CustomEngineTypes {
254175 CustomExecutionData { inner : OpExecutionData { payload, sidecar } , extension }
255176 }
256177}
257-
258- impl EngineTypes for CustomEngineTypes {
259- type ExecutionPayloadEnvelopeV1 = ExecutionPayloadV1 ;
260- type ExecutionPayloadEnvelopeV2 = ExecutionPayloadV2 ;
261- type ExecutionPayloadEnvelopeV3 = OpExecutionPayloadEnvelopeV3 ;
262- type ExecutionPayloadEnvelopeV4 = OpExecutionPayloadEnvelopeV4 ;
263- }
0 commit comments