@@ -7,7 +7,7 @@ use axum::extract::MatchedPath;
77use axum:: extract:: Request as ExtractRequest ;
88use axum:: http:: { Method , Request } ;
99use axum:: {
10- response:: { IntoResponse , Response } ,
10+ response:: IntoResponse ,
1111 routing:: { get, post} ,
1212 Json , Router ,
1313} ;
@@ -16,19 +16,17 @@ use build_info::BuildInfo;
1616use indexer_attestation:: AttestationSigner ;
1717use indexer_monitor:: {
1818 attestation_signers, dispute_manager, escrow_accounts, indexer_allocations, DeploymentDetails ,
19- EscrowAccounts , EscrowAccountsError , SubgraphClient ,
19+ EscrowAccounts , SubgraphClient ,
2020} ;
2121use prometheus:: TextEncoder ;
2222use reqwest:: StatusCode ;
2323use serde:: Serialize ;
2424use sqlx:: postgres:: PgPoolOptions ;
2525use std:: {
26- collections:: HashMap , error:: Error , fmt:: Debug , net:: SocketAddr , path:: PathBuf , sync:: Arc ,
27- time:: Duration ,
26+ collections:: HashMap , error:: Error , net:: SocketAddr , path:: PathBuf , sync:: Arc , time:: Duration ,
2827} ;
2928use tap_core:: { manager:: Manager , receipt:: checks:: CheckList , tap_eip712_domain} ;
3029use thegraph_core:: { Address , Attestation } ;
31- use thiserror:: Error ;
3230use tokio:: net:: TcpListener ;
3331use tokio:: signal;
3432use tokio:: sync:: watch:: Receiver ;
@@ -38,7 +36,6 @@ use tower_http::{cors, cors::CorsLayer, normalize_path::NormalizePath, trace::Tr
3836use tracing:: warn;
3937use tracing:: { error, info, info_span} ;
4038
41- use crate :: error:: SubgraphServiceError ;
4239use crate :: routes:: health;
4340use crate :: routes:: request_handler;
4441use crate :: routes:: static_subgraph_request_handler;
@@ -62,62 +59,6 @@ pub enum AttestationOutput {
6259 Attestable ,
6360}
6461
65- #[ derive( Debug , Error ) ]
66- pub enum IndexerServiceError {
67- #[ error( "Issues with provided receipt: {0}" ) ]
68- ReceiptError ( tap_core:: Error ) ,
69- #[ error( "No attestation signer found for allocation `{0}`" ) ]
70- NoSignerForAllocation ( Address ) ,
71- #[ error( "Invalid request body: {0}" ) ]
72- InvalidRequest ( anyhow:: Error ) ,
73- #[ error( "Error while processing the request: {0}" ) ]
74- ProcessingError ( SubgraphServiceError ) ,
75- #[ error( "No valid receipt or free query auth token provided" ) ]
76- Unauthorized ,
77- #[ error( "Invalid free query auth token" ) ]
78- InvalidFreeQueryAuthToken ,
79- #[ error( "Failed to sign attestation" ) ]
80- FailedToSignAttestation ,
81-
82- #[ error( "Could not decode signer: {0}" ) ]
83- CouldNotDecodeSigner ( tap_core:: Error ) ,
84-
85- #[ error( "There was an error while accessing escrow account: {0}" ) ]
86- EscrowAccount ( EscrowAccountsError ) ,
87- }
88-
89- impl IntoResponse for IndexerServiceError {
90- fn into_response ( self ) -> Response {
91- use IndexerServiceError :: * ;
92-
93- #[ derive( Serialize ) ]
94- struct ErrorResponse {
95- message : String ,
96- }
97-
98- let status = match self {
99- Unauthorized => StatusCode :: UNAUTHORIZED ,
100-
101- NoSignerForAllocation ( _) | FailedToSignAttestation => StatusCode :: INTERNAL_SERVER_ERROR ,
102-
103- ReceiptError ( _)
104- | InvalidRequest ( _)
105- | InvalidFreeQueryAuthToken
106- | CouldNotDecodeSigner ( _)
107- | EscrowAccount ( _)
108- | ProcessingError ( _) => StatusCode :: BAD_REQUEST ,
109- } ;
110- tracing:: error!( %self , "An IndexerServiceError occoured." ) ;
111- (
112- status,
113- Json ( ErrorResponse {
114- message : self . to_string ( ) ,
115- } ) ,
116- )
117- . into_response ( )
118- }
119- }
120-
12162#[ derive( Clone , Serialize ) ]
12263pub struct IndexerServiceRelease {
12364 version : String ,
0 commit comments