11//! Implements the Optimism engine API RPC methods.
22
33use alloy_eips:: eip7685:: Requests ;
4- use alloy_primitives:: { BlockHash , B256 , U64 } ;
4+ use alloy_primitives:: { BlockHash , B256 , B64 , U64 } ;
55use alloy_rpc_types_engine:: {
66 ClientVersionV1 , ExecutionPayloadBodiesV1 , ExecutionPayloadInputV2 , ExecutionPayloadV3 ,
77 ForkchoiceState , ForkchoiceUpdated , PayloadId , PayloadStatus ,
@@ -10,16 +10,16 @@ use derive_more::Constructor;
1010use jsonrpsee:: proc_macros:: rpc;
1111use jsonrpsee_core:: { server:: RpcModule , RpcResult } ;
1212use op_alloy_rpc_types_engine:: {
13- OpExecutionData , OpExecutionPayloadV4 , ProtocolVersion , SuperchainSignal ,
13+ OpExecutionData , OpExecutionPayloadV4 , ProtocolVersion , ProtocolVersionFormatV0 ,
14+ SuperchainSignal ,
1415} ;
1516use reth_chainspec:: EthereumHardforks ;
1617use reth_node_api:: { EngineTypes , EngineValidator } ;
1718use reth_rpc_api:: IntoEngineApiRpcModule ;
1819use reth_rpc_engine_api:: EngineApi ;
19- use reth_rpc_server_types:: result:: internal_rpc_err;
2020use reth_storage_api:: { BlockReader , HeaderProvider , StateProviderFactory } ;
2121use reth_transaction_pool:: TransactionPool ;
22- use tracing:: trace;
22+ use tracing:: { info , trace} ;
2323
2424/// The list of all supported Engine capabilities available over the engine endpoint.
2525///
@@ -40,6 +40,16 @@ pub const OP_ENGINE_CAPABILITIES: &[&str] = &[
4040 "engine_signalSuperchainV1" ,
4141] ;
4242
43+ /// OP Stack protocol version
44+ /// See also: <https://github.com/ethereum-optimism/op-geth/blob/c3a989eb882d150a936df27bcfa791838b474d55/params/superchain.go#L13-L13>
45+ pub const OP_STACK_SUPPORT : ProtocolVersion = ProtocolVersion :: V0 ( ProtocolVersionFormatV0 {
46+ build : B64 :: ZERO ,
47+ major : 9 ,
48+ minor : 0 ,
49+ patch : 0 ,
50+ pre_release : 0 ,
51+ } ) ;
52+
4353/// Extension trait that gives access to Optimism engine API RPC methods.
4454///
4555/// Note:
@@ -335,9 +345,16 @@ where
335345 Ok ( self . inner . get_payload_bodies_by_range_v1_metered ( start. to ( ) , count. to ( ) ) . await ?)
336346 }
337347
338- async fn signal_superchain_v1 ( & self , _signal : SuperchainSignal ) -> RpcResult < ProtocolVersion > {
348+ async fn signal_superchain_v1 ( & self , signal : SuperchainSignal ) -> RpcResult < ProtocolVersion > {
339349 trace ! ( target: "rpc::engine" , "Serving signal_superchain_v1" ) ;
340- Err ( internal_rpc_err ( "unimplemented" ) )
350+ info ! (
351+ target: "rpc::engine" ,
352+ "Received superchain version signal local={:?} required={:?} recommended={:?}" ,
353+ OP_STACK_SUPPORT ,
354+ signal. required,
355+ signal. recommended
356+ ) ;
357+ Ok ( OP_STACK_SUPPORT )
341358 }
342359
343360 async fn get_client_version_v1 (
0 commit comments