Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit eaf2d8d

Browse files
authored
fix unreachable_pub for discovery (#615)
* fix unreachable_pub for discovery
1 parent 2a19236 commit eaf2d8d

10 files changed

Lines changed: 38 additions & 32 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ mockito = "1.7.0"
3939
iroh = "0.34.1"
4040
rand_v8 = { package = "rand", version = "0.8.5", features = ["std"] }
4141
rand_core_v6 = { package = "rand_core", version = "0.6.4", features = ["std"] }
42+
4243
[workspace.package]
4344
version = "0.3.10"
4445
edition = "2021"
4546

46-
[workspace.features]
47-
default = []
48-
testnet = []
49-
5047
[workspace.lints.clippy]
5148
match_same_arms = "warn"
5249
unused_async = "warn"
5350
uninlined_format_args = "warn"
51+
52+
[workspace.lints.rust]
53+
unreachable_pub = "warn"

crates/discovery/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name = "discovery"
33
version.workspace = true
44
edition.workspace = true
55

6+
[lints]
7+
workspace = true
8+
69
[dependencies]
710
actix-web = { workspace = true }
811
alloy = { workspace = true }

crates/discovery/src/api/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pub mod routes;
2-
pub mod server;
1+
pub(crate) mod routes;
2+
pub(crate) mod server;

crates/discovery/src/api/routes/get_nodes.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use alloy::primitives::U256;
88
use shared::models::api::ApiResponse;
99
use shared::models::node::DiscoveryNode;
1010

11-
pub async fn get_nodes(data: Data<AppState>) -> HttpResponse {
11+
pub(crate) async fn get_nodes(data: Data<AppState>) -> HttpResponse {
1212
let nodes = data.node_store.get_nodes().await;
1313
match nodes {
1414
Ok(nodes) => {
@@ -43,7 +43,7 @@ fn filter_nodes_for_pool(nodes: Vec<DiscoveryNode>, pool_id: u32) -> Vec<Discove
4343
filtered
4444
}
4545

46-
pub async fn get_nodes_for_pool(
46+
pub(crate) async fn get_nodes_for_pool(
4747
data: Data<AppState>,
4848
pool_id: web::Path<String>,
4949
req: actix_web::HttpRequest,
@@ -123,7 +123,10 @@ pub async fn get_nodes_for_pool(
123123
}
124124
}
125125

126-
pub async fn get_node_by_subkey(node_id: web::Path<String>, data: Data<AppState>) -> HttpResponse {
126+
pub(crate) async fn get_node_by_subkey(
127+
node_id: web::Path<String>,
128+
data: Data<AppState>,
129+
) -> HttpResponse {
127130
let node = data.node_store.get_node_by_id(&node_id.to_string()).await;
128131

129132
match node {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pub mod get_nodes;
2-
pub mod node;
1+
pub(crate) mod get_nodes;
2+
pub(crate) mod node;

crates/discovery/src/api/routes/node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use shared::models::api::ApiResponse;
99
use shared::models::node::{ComputeRequirements, Node};
1010
use std::str::FromStr;
1111

12-
pub async fn register_node(
12+
pub(crate) async fn register_node(
1313
node: web::Json<Node>,
1414
data: Data<AppState>,
1515
req: actix_web::HttpRequest,
@@ -211,7 +211,7 @@ pub async fn register_node(
211211
}
212212
}
213213

214-
pub fn node_routes() -> Scope {
214+
pub(crate) fn node_routes() -> Scope {
215215
web::scope("/api/nodes").route("", put().to(register_node))
216216
}
217217

crates/discovery/src/api/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::time::{Duration, SystemTime};
2121
use tokio::sync::Mutex;
2222

2323
#[derive(Clone)]
24-
pub struct AppState {
24+
pub(crate) struct AppState {
2525
pub node_store: Arc<NodeStore>,
2626
pub contracts: Option<Contracts<RootProvider>>,
2727
pub last_chain_sync: Arc<Mutex<Option<SystemTime>>>,

crates/discovery/src/lib.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
pub mod api;
2-
pub mod chainsync;
3-
pub mod location_enrichment;
4-
pub mod location_service;
5-
pub mod store;
1+
mod api;
2+
mod chainsync;
3+
mod location_enrichment;
4+
mod location_service;
5+
mod store;
6+
7+
pub use api::server::start_server;
8+
pub use chainsync::ChainSync;
9+
pub use location_enrichment::LocationEnrichmentService;
10+
pub use location_service::LocationService;
11+
pub use store::node_store::NodeStore;
12+
pub use store::redis::RedisStore;

crates/discovery/src/main.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
mod api;
2-
mod chainsync;
3-
mod location_enrichment;
4-
mod location_service;
5-
mod store;
6-
use crate::api::server::start_server;
7-
use crate::chainsync::ChainSync;
8-
use crate::location_enrichment::LocationEnrichmentService;
9-
use crate::location_service::LocationService;
10-
use crate::store::node_store::NodeStore;
11-
use crate::store::redis::RedisStore;
121
use alloy::providers::RootProvider;
132
use anyhow::Result;
143
use clap::Parser;
@@ -20,6 +9,10 @@ use std::time::Duration;
209
use tokio::sync::Mutex;
2110
use tokio_util::sync::CancellationToken;
2211

12+
use discovery::{
13+
start_server, ChainSync, LocationEnrichmentService, LocationService, NodeStore, RedisStore,
14+
};
15+
2316
#[derive(Debug, Clone, Copy, PartialEq)]
2417
enum ServiceMode {
2518
Api,

crates/discovery/src/store/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pub mod node_store;
2-
pub mod redis;
1+
pub(crate) mod node_store;
2+
pub(crate) mod redis;

0 commit comments

Comments
 (0)