feat(op-rpc): finalize signal_superchain_v1 's endpoint (#15338)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Léa Narzis
2025-03-27 22:14:06 +01:00
committed by GitHub
parent 30c457843c
commit dd76b42916

View File

@@ -1,7 +1,7 @@
//! Implements the Optimism engine API RPC methods.
use alloy_eips::eip7685::Requests;
use alloy_primitives::{BlockHash, B256, U64};
use alloy_primitives::{BlockHash, B256, B64, U64};
use alloy_rpc_types_engine::{
ClientVersionV1, ExecutionPayloadBodiesV1, ExecutionPayloadInputV2, ExecutionPayloadV3,
ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus,
@@ -10,16 +10,16 @@ use derive_more::Constructor;
use jsonrpsee::proc_macros::rpc;
use jsonrpsee_core::{server::RpcModule, RpcResult};
use op_alloy_rpc_types_engine::{
OpExecutionData, OpExecutionPayloadV4, ProtocolVersion, SuperchainSignal,
OpExecutionData, OpExecutionPayloadV4, ProtocolVersion, ProtocolVersionFormatV0,
SuperchainSignal,
};
use reth_chainspec::EthereumHardforks;
use reth_node_api::{EngineTypes, EngineValidator};
use reth_rpc_api::IntoEngineApiRpcModule;
use reth_rpc_engine_api::EngineApi;
use reth_rpc_server_types::result::internal_rpc_err;
use reth_storage_api::{BlockReader, HeaderProvider, StateProviderFactory};
use reth_transaction_pool::TransactionPool;
use tracing::trace;
use tracing::{info, trace};
/// The list of all supported Engine capabilities available over the engine endpoint.
///
@@ -40,6 +40,16 @@ pub const OP_ENGINE_CAPABILITIES: &[&str] = &[
"engine_signalSuperchainV1",
];
/// OP Stack protocol version
/// See also: <https://github.com/ethereum-optimism/op-geth/blob/c3a989eb882d150a936df27bcfa791838b474d55/params/superchain.go#L13-L13>
pub const OP_STACK_SUPPORT: ProtocolVersion = ProtocolVersion::V0(ProtocolVersionFormatV0 {
build: B64::ZERO,
major: 9,
minor: 0,
patch: 0,
pre_release: 0,
});
/// Extension trait that gives access to Optimism engine API RPC methods.
///
/// Note:
@@ -335,9 +345,16 @@ where
Ok(self.inner.get_payload_bodies_by_range_v1_metered(start.to(), count.to()).await?)
}
async fn signal_superchain_v1(&self, _signal: SuperchainSignal) -> RpcResult<ProtocolVersion> {
async fn signal_superchain_v1(&self, signal: SuperchainSignal) -> RpcResult<ProtocolVersion> {
trace!(target: "rpc::engine", "Serving signal_superchain_v1");
Err(internal_rpc_err("unimplemented"))
info!(
target: "rpc::engine",
"Received superchain version signal local={:?} required={:?} recommended={:?}",
OP_STACK_SUPPORT,
signal.required,
signal.recommended
);
Ok(OP_STACK_SUPPORT)
}
async fn get_client_version_v1(