Skip to content

Commit

Permalink
fix: add status code to UnattestableError
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed Sep 22, 2023
1 parent 15e22db commit 91366e3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion graph-gateway/src/client_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ async fn handle_indexer_query_inner(
weight: 35,
});
tracing::info!(%error, "penalizing for unattestable error");
return Err(IndexerError::UnattestableError);
return Err(IndexerError::UnattestableError(StatusCode::OK));
}
}

Expand Down
5 changes: 3 additions & 2 deletions graph-gateway/src/indexer_client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::sync::Arc;

use alloy_primitives::B256;
use axum::http::StatusCode;
use serde::{Deserialize, Serialize};

use indexer_selection::{Selection, UnresolvedBlock};
Expand All @@ -21,7 +22,7 @@ pub struct ResponsePayload {
pub enum IndexerError {
NoAllocation,
NoAttestation,
UnattestableError,
UnattestableError(StatusCode),
Timeout,
UnexpectedPayload,
UnresolvedBlock,
Expand Down Expand Up @@ -91,7 +92,7 @@ impl IndexerClient {
tracing::trace!(response_status = ?err.status());
return match err.status() {
Some(status) if status.is_server_error() => {
Err(IndexerError::UnattestableError)
Err(IndexerError::UnattestableError(status))
}
_ => Err(IndexerError::Other(err.to_string())),
};
Expand Down
2 changes: 1 addition & 1 deletion graph-gateway/src/reports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ pub fn indexer_attempt_status_code(result: &Result<ResponsePayload, IndexerError
// prefix 0x0, followed by the HTTP status code
Ok(_) => (0x0, 200_u32.to_be()),
Err(IndexerError::NoAttestation) => (0x1, 0x0),
Err(IndexerError::UnattestableError) => (0x2, 0x0),
Err(IndexerError::UnattestableError(_)) => (0x2, 0x0),
Err(IndexerError::Timeout) => (0x3, 0x0),
Err(IndexerError::UnexpectedPayload) => (0x4, 0x0),
Err(IndexerError::UnresolvedBlock) => (0x5, 0x0),
Expand Down

0 comments on commit 91366e3

Please sign in to comment.