Skip to content

Commit c4b4a4c

Browse files
committed
chore(network): add debug logging
Signed-off-by: Joseph Livesey <[email protected]>
1 parent e6ce396 commit c4b4a4c

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

src/indexer_client.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,20 @@ impl IndexerClient {
5555
tracing::debug!(
5656
url = %deployment_url,
5757
auth_header = auth_key,
58+
auth_value_length = auth_value.len(),
5859
query_length = query.len(),
5960
"sending HTTP POST request to indexer"
6061
);
6162

63+
// CRITICAL DEBUG: Log if TAP receipt header is being set
64+
if auth_key == "tap-receipt" {
65+
tracing::warn!(
66+
url = %deployment_url,
67+
auth_value_preview = &auth_value[..auth_value.len().min(50)],
68+
"TAP RECEIPT HEADER BEING SENT TO INDEXER"
69+
);
70+
}
71+
6272
let result = self
6373
.client
6474
.post(deployment_url.clone())

src/network/pre_processing.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,19 @@ pub fn into_internal_deployments_raw_info<'a>(
142142
.fold(HashMap::new(), |mut acc, deployment_raw_info| {
143143
let deployment_id = deployment_raw_info.id;
144144

145+
// Debug logging for deployment processing
146+
tracing::debug!(
147+
?deployment_id,
148+
subgraphs_count = deployment_raw_info.subgraphs.len(),
149+
allocations_count = deployment_raw_info.allocations.len(),
150+
"processing deployment in pre_processing pipeline"
151+
);
152+
145153
// If the deployment info is not present, insert it
146154
let deployment = match acc.entry(deployment_id) {
147155
Entry::Occupied(entry) => entry.into_mut(),
148156
Entry::Vacant(entry) => {
157+
tracing::debug!(?deployment_id, "inserting new deployment into registry");
149158
entry.insert(deployment_raw_info.clone());
150159
return acc;
151160
}

src/network/service.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,24 @@ impl NetworkService {
128128
) -> Result<Option<ResolvedSubgraphInfo>, DeploymentError> {
129129
let network = self.network.borrow();
130130

131+
// Debug logging for deployment resolution
132+
tracing::debug!(
133+
?id,
134+
total_deployments = network.deployments.len(),
135+
"attempting to resolve deployment ID"
136+
);
137+
138+
// Log first few deployment IDs for comparison
139+
for (dep_id, _) in network.deployments.iter().take(3) {
140+
tracing::debug!(?dep_id, "available deployment in registry");
141+
}
142+
131143
// Resolve the deployment information
132144
let deployment = match network.deployments.get(id) {
133-
None => return Ok(None),
145+
None => {
146+
tracing::warn!(?id, "deployment ID not found in registry");
147+
return Ok(None);
148+
}
134149
Some(Err(err)) => return Err(err.to_owned()),
135150
Some(Ok(deployment)) => deployment,
136151
};

src/receipts.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::time::SystemTime;
22

3+
use base64::{Engine as _, engine::general_purpose};
4+
use prost::Message;
35
use rand::RngCore;
46
use serde::Serialize;
57
use thegraph_core::{
@@ -28,9 +30,16 @@ impl Receipt {
2830
self.0.message.collection_id.into()
2931
}
3032

31-
/// Serialize the receipt to JSON string
33+
/// Serialize the receipt to base64-encoded protobuf format for V2 compatibility
3234
pub fn serialize(&self) -> String {
33-
serde_json::to_string(&self.0).unwrap()
35+
// Convert tap_graph::v2::SignedReceipt to protobuf format
36+
let protobuf_receipt: tap_aggregator::grpc::v2::SignedReceipt = self.0.clone().into();
37+
38+
// Encode to protobuf bytes
39+
let bytes = protobuf_receipt.encode_to_vec();
40+
41+
// Base64 encode the bytes
42+
general_purpose::STANDARD.encode(&bytes)
3443
}
3544
}
3645

0 commit comments

Comments
 (0)