Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions crates/node/rpc/src/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use jsonrpsee::{
use rollup_boost::Health;
use tokio::sync::{mpsc, oneshot};

use crate::jsonrpsee::HealthzApiServer;
use crate::jsonrpsee::{HealthzApiServer, RollupBoostHealthzApiServer};

/// Key for the rollup boost health status.
/// +----------------+-------------------------------+--------------------------------------+-------------------------------+
Expand Down Expand Up @@ -55,6 +55,11 @@ impl From<Health> for RollupBoostHealth {
pub struct HealthzResponse {
/// The application version.
pub version: String,
}

/// A healthcheck response for the rollup boost health.
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct RollupBoostHealthzResponse {
/// The rollup boost health.
pub rollup_boost_health: RollupBoostHealth,
}
Expand All @@ -67,7 +72,7 @@ pub struct RollupBoostHealthQuery {
}

/// The healthz rpc server.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct HealthzRpc {
/// The rollup boost health.
pub rollup_boost_health: mpsc::Sender<RollupBoostHealthQuery>,
Expand All @@ -83,6 +88,13 @@ impl HealthzRpc {
#[async_trait]
impl HealthzApiServer for HealthzRpc {
async fn healthz(&self) -> RpcResult<HealthzResponse> {
Ok(HealthzResponse { version: env!("CARGO_PKG_VERSION").to_string() })
}
}

#[async_trait]
impl RollupBoostHealthzApiServer for HealthzRpc {
async fn rollup_boost_healthz(&self) -> RpcResult<RollupBoostHealthzResponse> {
let (tx, rx) = oneshot::channel();

self.rollup_boost_health
Expand All @@ -93,6 +105,6 @@ impl HealthzApiServer for HealthzRpc {
let rollup_boost_health =
rx.await.map_err(|_| ErrorObject::from(ErrorCode::InternalError))?;

Ok(HealthzResponse { version: env!("CARGO_PKG_VERSION").to_string(), rollup_boost_health })
Ok(RollupBoostHealthzResponse { rollup_boost_health })
}
}
14 changes: 13 additions & 1 deletion crates/node/rpc/src/jsonrpsee.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! The Optimism RPC API using `jsonrpsee`

use crate::{OutputResponse, SafeHeadResponse, health::HealthzResponse};
use crate::{
OutputResponse, SafeHeadResponse,
health::{HealthzResponse, RollupBoostHealthzResponse},
};
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::B256;
use core::net::IpAddr;
Expand Down Expand Up @@ -220,3 +223,12 @@ pub trait HealthzApi {
#[method(name = "healthz")]
async fn healthz(&self) -> RpcResult<HealthzResponse>;
}

/// The rollup boost health namespace.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "kona-rollup-boost"))]
#[cfg_attr(feature = "client", rpc(server, client, namespace = "kona-rollup-boost"))]
pub trait RollupBoostHealthzApi {
/// Gets the rollup boost health.
#[method(name = "healthz")]
async fn rollup_boost_healthz(&self) -> RpcResult<RollupBoostHealthzResponse>;
}
7 changes: 5 additions & 2 deletions crates/node/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub use dev::DevEngineRpc;
mod jsonrpsee;
pub use jsonrpsee::{
AdminApiServer, DevEngineApiServer, HealthzApiServer, MinerApiExtServer, OpAdminApiServer,
OpP2PApiServer, RollupNodeApiServer, WsServer,
OpP2PApiServer, RollupBoostHealthzApiServer, RollupNodeApiServer, WsServer,
};

mod rollup;
Expand All @@ -48,4 +48,7 @@ mod ws;
pub use ws::WsRPC;

mod health;
pub use health::{HealthzResponse, HealthzRpc, RollupBoostHealth, RollupBoostHealthQuery};
pub use health::{
HealthzResponse, HealthzRpc, RollupBoostHealth, RollupBoostHealthQuery,
RollupBoostHealthzResponse,
};
13 changes: 9 additions & 4 deletions crates/node/service/src/actors/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use kona_gossip::P2pRpcRequest;
use kona_rpc::{
AdminApiServer, AdminRpc, DevEngineApiServer, DevEngineRpc, HealthzApiServer, HealthzRpc,
NetworkAdminQuery, OpP2PApiServer, RollupBoostAdminQuery, RollupBoostHealthQuery,
RollupNodeApiServer, SequencerAdminAPIClient, WsRPC, WsServer,
RollupBoostHealthzApiServer, RollupNodeApiServer, SequencerAdminAPIClient, WsRPC, WsServer,
};
use std::time::Duration;

Expand Down Expand Up @@ -93,8 +93,11 @@ async fn launch(
) -> Result<ServerHandle, std::io::Error> {
let middleware = tower::ServiceBuilder::new()
.layer(
ProxyGetRequestLayer::new([("/healthz", "healthz")])
.expect("Critical: Failed to build GET method proxy"),
ProxyGetRequestLayer::new([
("/healthz", "healthz"),
("/kona-rollup-boost/healthz", "kona-rollup-boost_healthz"),
])
.expect("Critical: Failed to build GET method proxy"),
)
.timeout(Duration::from_secs(2));
let server = Server::builder().set_http_middleware(middleware).build(config.socket).await?;
Expand Down Expand Up @@ -128,7 +131,9 @@ impl<S: SequencerAdminAPIClient + 'static> NodeActor for RpcActor<S> {
) -> Result<(), Self::Error> {
let mut modules = RpcModule::new(());

modules.merge(HealthzRpc::new(rollup_boost_health).into_rpc())?;
let healthz_rpc = HealthzRpc::new(rollup_boost_health);
modules.merge(HealthzApiServer::into_rpc(healthz_rpc.clone()))?;
modules.merge(RollupBoostHealthzApiServer::into_rpc(healthz_rpc))?;

// Build the p2p rpc module.
modules.merge(P2pRpc::new(p2p_network).into_rpc())?;
Expand Down
Loading