feat(supervisor): support admin addL2RPC#2753
Conversation
|
Claude finished @dhyaniarun1993's task —— View job PR Review: feat(supervisor): support admin
|
Codecov Report❌ Patch coverage is ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| /// Indicates a service error occurred during processing the request. | ||
| #[error("service error: {0}")] | ||
| ServiceError(String), |
There was a problem hiding this comment.
seems this variant isn't used
There was a problem hiding this comment.
It's being used in oneshot::Sender
|
Claude finished @dhyaniarun1993's task —— View job PR Review: feat(supervisor): support admin
|
There was a problem hiding this comment.
Pull Request Overview
Adds administrative API support to the supervisor service to dynamically add L2 RPC nodes. The feature enables runtime management of managed nodes through a new admin namespace API when the admin flag is enabled.
- Introduces new admin RPC interface for managing L2 RPC nodes
- Refactors managed node initialization to support dynamic addition
- Implements comprehensive admin request handling with timeouts and error management
Reviewed Changes
Copilot reviewed 17 out of 20 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/supervisor/service/src/service.rs | Major refactoring to support dynamic managed node addition and admin API integration |
| crates/supervisor/service/src/actors/rpc.rs | Genericizes RPC actor to support modular RPC modules |
| crates/supervisor/rpc/src/jsonrpsee.rs | Adds SupervisorAdminApi trait with addL2RPC method |
| crates/supervisor/core/src/rpc/admin.rs | Implements admin RPC handler with request types and error handling |
| crates/supervisor/core/src/syncnode/client.rs | Simplifies ClientConfig to use JwtSecret directly instead of file paths |
| crates/supervisor/core/src/supervisor.rs | Adds dynamic managed node support with thread-safe storage |
| crates/supervisor/core/src/logindexer/indexer.rs | Refactors LogIndexer to support optional block providers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // todo: handle these errors more gracefully | ||
| AdminError::InvalidJwtSecret(_) => ErrorObjectOwned::from(ErrorCode::InvalidParams), | ||
| AdminError::SendFailed | | ||
| AdminError::SenderDropped | | ||
| AdminError::Timeout | | ||
| AdminError::ServiceError(_) => ErrorObjectOwned::from(ErrorCode::InternalError), |
There was a problem hiding this comment.
The TODO comment indicates incomplete error handling. The current implementation maps all admin errors to generic RPC error codes, which may not provide sufficient information to API consumers.
| // todo: handle these errors more gracefully | |
| AdminError::InvalidJwtSecret(_) => ErrorObjectOwned::from(ErrorCode::InvalidParams), | |
| AdminError::SendFailed | | |
| AdminError::SenderDropped | | |
| AdminError::Timeout | | |
| AdminError::ServiceError(_) => ErrorObjectOwned::from(ErrorCode::InternalError), | |
| AdminError::InvalidJwtSecret(msg) => ErrorObjectOwned::owned( | |
| ErrorCode::InvalidParams.code(), | |
| format!("Invalid JWT secret: {}", msg), | |
| None::<()>, | |
| ), | |
| AdminError::SendFailed => ErrorObjectOwned::owned( | |
| ErrorCode::InternalError.code(), | |
| "Failed to send admin request".to_string(), | |
| None::<()>, | |
| ), | |
| AdminError::SenderDropped => ErrorObjectOwned::owned( | |
| ErrorCode::InternalError.code(), | |
| "Admin request sender dropped".to_string(), | |
| None::<()>, | |
| ), | |
| AdminError::Timeout => ErrorObjectOwned::owned( | |
| ErrorCode::InternalError.code(), | |
| "Admin request timed out".to_string(), | |
| None::<()>, | |
| ), | |
| AdminError::ServiceError(msg) => ErrorObjectOwned::owned( | |
| ErrorCode::InternalError.code(), | |
| format!("Service error: {}", msg), | |
| None::<()>, | |
| ), |
addL2RPCaddL2RPC
| chain_id: ChainId, | ||
| /// Component that provides receipts for a given block hash. | ||
| block_provider: Arc<P>, | ||
| block_provider: Mutex<Option<Arc<P>>>, |
There was a problem hiding this comment.
Why do we need to initialize the log indexer if the block provider does not exist?
Is this for making the initialization independent? But I think it is still fine initiazing it with manage node because It doesn't have any other logic that works without the manage node.
There was a problem hiding this comment.
yea, I kept initialization same to make sure future clients can initialize the log indexer with the managed node(if one is available).
Closes #2742