Skip to content

Commit

Permalink
Delete unnused rpc endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
IAvecilla committed Mar 7, 2024
1 parent c366ecc commit f3569cd
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 78 deletions.
1 change: 0 additions & 1 deletion node/libs/roles/src/validator/messages/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use super::{
};
use crate::validator;
use bit_vec::BitVec;
use serde::Serialize;
use std::{
collections::{BTreeMap, BTreeSet},
fmt,
Expand Down
6 changes: 2 additions & 4 deletions node/tools/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,9 @@ async fn main() -> anyhow::Result<()> {
rpc_addr.set_port(rpc_addr.port() + 100);
}

// Create the RPC server with the executor's storage.
let node_storage = executor.block_store.clone();

// cloning configuration to let RPCServer show it
// TODO this should be queried in real time instead, to reflect any possible change in config
let rpc_server = RPCServer::new(rpc_addr, configs.app.clone(), node_storage);
let rpc_server = RPCServer::new(rpc_addr, node_storage);

// Initialize the storage.
scope::run!(ctx, |ctx, s| async {
Expand Down
22 changes: 0 additions & 22 deletions node/tools/src/rpc/methods/config.rs

This file was deleted.

2 changes: 0 additions & 2 deletions node/tools/src/rpc/methods/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
pub mod config;
pub mod health_check;
pub mod last_view;
pub mod peers;
33 changes: 0 additions & 33 deletions node/tools/src/rpc/methods/peers.rs

This file was deleted.

18 changes: 2 additions & 16 deletions node/tools/src/rpc/server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use crate::AppConfig;

use super::methods::{config, health_check, last_view, peers};
use super::methods::{health_check, last_view};
use jsonrpsee::server::{middleware::http::ProxyGetRequestLayer, RpcModule, Server};
use std::{net::SocketAddr, sync::Arc};
use zksync_concurrency::{ctx, scope};
Expand All @@ -10,17 +8,14 @@ use zksync_consensus_storage::BlockStore;
pub struct RPCServer {
/// IP address to bind to.
ip_address: SocketAddr,
/// AppConfig
config: AppConfig,
/// Node storage.
node_storage: Arc<BlockStore>,
}

impl RPCServer {
pub fn new(ip_address: SocketAddr, config: AppConfig, node_storage: Arc<BlockStore>) -> Self {
pub fn new(ip_address: SocketAddr, node_storage: Arc<BlockStore>) -> Self {
Self {
ip_address,
config,
node_storage,
}
}
Expand All @@ -34,8 +29,6 @@ impl RPCServer {
health_check::path(),
health_check::method(),
)?)
.layer(ProxyGetRequestLayer::new(peers::path(), peers::method())?)
.layer(ProxyGetRequestLayer::new(config::path(), config::method())?)
.layer(ProxyGetRequestLayer::new(
last_view::path(),
last_view::method(),
Expand All @@ -45,13 +38,6 @@ impl RPCServer {
module.register_method(health_check::method(), |_params, _| {
health_check::callback()
})?;
module.register_method(peers::method(), |_params, _| peers::callback())?;

// TODO find a better way to implement this as I had to clone the clone and move it to pass the borrow checker
let config = self.config.clone();
module.register_method(config::method(), move |_params, _| {
config::callback(config.clone())
})?;

let node_storage = self.node_storage.clone();
module.register_method(last_view::method(), move |_params, _| {
Expand Down

0 comments on commit f3569cd

Please sign in to comment.