1- pub mod metrics;
2- pub mod p2p;
3- pub mod store;
4- pub mod validators;
51use actix_web:: { web, App , HttpRequest , HttpResponse , HttpServer , Responder } ;
62use alloy:: primitives:: utils:: Unit ;
73use alloy:: primitives:: { Address , U256 } ;
84use anyhow:: { Context , Result } ;
95use clap:: Parser ;
106use log:: { debug, LevelFilter } ;
117use log:: { error, info} ;
12- use metrics:: MetricsContext ;
13- use p2p:: P2PClient ;
148use serde_json:: json;
159use shared:: models:: api:: ApiResponse ;
1610use shared:: models:: node:: DiscoveryNode ;
@@ -24,14 +18,15 @@ use std::sync::atomic::{AtomicI64, Ordering};
2418use std:: sync:: Arc ;
2519use std:: time:: Duration ;
2620use std:: time:: { Instant , SystemTime , UNIX_EPOCH } ;
27- use store:: redis:: RedisStore ;
2821use tokio:: signal:: unix:: { signal, SignalKind } ;
2922use tokio_util:: sync:: CancellationToken ;
3023use url:: Url ;
31- use validators:: hardware:: HardwareValidator ;
32- use validators:: synthetic_data:: SyntheticDataValidator ;
3324
34- use crate :: validators:: synthetic_data:: types:: InvalidationType ;
25+ use validator:: {
26+ export_metrics, HardwareValidator , InvalidationType , MetricsContext , P2PClient , RedisStore ,
27+ SyntheticDataValidator ,
28+ } ;
29+
3530// Track the last time the validation loop ran
3631static LAST_VALIDATION_TIMESTAMP : AtomicI64 = AtomicI64 :: new ( 0 ) ;
3732// Maximum allowed time between validation loops (2 minutes)
@@ -407,7 +402,7 @@ async fn main() -> anyhow::Result<()> {
407402 . route (
408403 "/metrics" ,
409404 web:: get ( ) . to ( || async {
410- match metrics :: export_metrics ( ) {
405+ match export_metrics ( ) {
411406 Ok ( metrics) => {
412407 HttpResponse :: Ok ( ) . content_type ( "text/plain" ) . body ( metrics)
413408 }
@@ -634,20 +629,19 @@ async fn main() -> anyhow::Result<()> {
634629
635630#[ cfg( test) ]
636631mod tests {
637-
638632 use actix_web:: { test, App } ;
639633 use actix_web:: {
640634 web:: { self , post} ,
641635 HttpResponse , Scope ,
642636 } ;
643637 use shared:: models:: challenge:: { calc_matrix, ChallengeRequest , ChallengeResponse , FixedF64 } ;
644638
645- pub async fn handle_challenge ( challenge : web:: Json < ChallengeRequest > ) -> HttpResponse {
639+ async fn handle_challenge ( challenge : web:: Json < ChallengeRequest > ) -> HttpResponse {
646640 let result = calc_matrix ( & challenge) ;
647641 HttpResponse :: Ok ( ) . json ( result)
648642 }
649643
650- pub fn challenge_routes ( ) -> Scope {
644+ fn challenge_routes ( ) -> Scope {
651645 web:: scope ( "/challenge" )
652646 . route ( "" , post ( ) . to ( handle_challenge) )
653647 . route ( "/" , post ( ) . to ( handle_challenge) )
0 commit comments