Skip to content

Commit cc3542b

Browse files
committed
chore: fix test subgraph endpoints
1 parent 581c2f0 commit cc3542b

File tree

2 files changed

+6
-41
lines changed

2 files changed

+6
-41
lines changed

integration-tests/src/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub const ACCOUNT0_SECRET: &str =
2424
"ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
2525
pub const CHAIN_ID: u64 = 1337;
2626

27-
pub const SUBGRAPH_ID: &str = "Qmc2CbqucMvaS4GFvt2QUZWvRwSZ3K5ipeGvbC6UUBf616";
27+
pub const SUBGRAPH_ID: &str = "QmRcucmbxAXLaAZkkCR8Bdj1X7QGPLjfRmQ5H6tFhGqiHX";
2828

2929
pub const GRAPH_URL: &str = "http://localhost:8000/subgraphs/name/graph-network";
3030

integration-tests/src/rav_tests.rs

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ use thegraph_core::alloy::{primitives::Address, signers::local::PrivateKeySigner
1010

1111
use crate::{
1212
constants::{
13-
ACCOUNT0_SECRET, CHAIN_ID, GATEWAY_API_KEY, GATEWAY_URL, GRAPH_TALLY_COLLECTOR_CONTRACT,
14-
GRAPH_URL, INDEXER_URL, MAX_RECEIPT_VALUE, SUBGRAPH_ID, TAP_AGENT_METRICS_URL,
15-
TAP_VERIFIER_CONTRACT,
16-
},
17-
utils::{
18-
create_request, create_tap_receipt, create_tap_receipt_v2, encode_v2_receipt,
19-
find_allocation,
13+
ACCOUNT0_SECRET, CHAIN_ID, GATEWAY_API_KEY, GATEWAY_URL, GRAPH_URL, INDEXER_URL,
14+
MAX_RECEIPT_VALUE, SUBGRAPH_ID, TAP_AGENT_METRICS_URL, TAP_VERIFIER_CONTRACT,
2015
},
16+
utils::{create_request, create_tap_receipt, find_allocation},
2117
MetricsChecker,
2218
};
2319

@@ -217,16 +213,11 @@ pub async fn test_invalid_chain_id() -> Result<()> {
217213
pub async fn test_tap_rav_v2() -> Result<()> {
218214
// Setup HTTP client
219215
let http_client = Arc::new(Client::new());
220-
let wallet: PrivateKeySigner = ACCOUNT0_SECRET.parse().unwrap();
221216

222217
// Query the network subgraph to find active allocations
223218
let allocation_id = find_allocation(http_client.clone(), GRAPH_URL).await?;
224219
let allocation_id = Address::from_str(&allocation_id)?;
225220

226-
// For V2, we need payer and service provider addresses
227-
let payer = wallet.address();
228-
let service_provider = allocation_id; // Using allocation_id as service provider for simplicity
229-
230221
// Create a metrics checker
231222
let metrics_checker =
232223
MetricsChecker::new(http_client.clone(), TAP_AGENT_METRICS_URL.to_string());
@@ -261,24 +252,11 @@ pub async fn test_tap_rav_v2() -> Result<()> {
261252
println!("Sending V2 batch {batch} of {BATCHES} with {NUM_RECEIPTS} receipts each...",);
262253

263254
for i in 0..NUM_RECEIPTS {
264-
// Create V2 receipt
265-
let receipt = create_tap_receipt_v2(
266-
MAX_RECEIPT_VALUE,
267-
&allocation_id,
268-
GRAPH_TALLY_COLLECTOR_CONTRACT,
269-
CHAIN_ID,
270-
&wallet,
271-
&payer,
272-
&service_provider,
273-
)?;
274-
275-
let receipt_encoded = encode_v2_receipt(&receipt)?;
276-
255+
// Send plain GraphQL query to gateway - let gateway generate V2 receipt
277256
let response = http_client
278257
.post(format!("{GATEWAY_URL}/api/subgraphs/id/{SUBGRAPH_ID}"))
279258
.header("Content-Type", "application/json")
280259
.header("Authorization", format!("Bearer {GATEWAY_API_KEY}"))
281-
.header("Tap-Receipt", receipt_encoded)
282260
.json(&json!({
283261
"query": "{ _meta { block { number } } }"
284262
}))
@@ -333,24 +311,11 @@ pub async fn test_tap_rav_v2() -> Result<()> {
333311
for i in 0..MAX_TRIGGERS {
334312
println!("Sending V2 trigger query {}/{}...", i + 1, MAX_TRIGGERS);
335313

336-
// Create V2 receipt
337-
let receipt = create_tap_receipt_v2(
338-
MAX_RECEIPT_VALUE / 10, // Smaller value for trigger receipts
339-
&allocation_id,
340-
GRAPH_TALLY_COLLECTOR_CONTRACT,
341-
CHAIN_ID,
342-
&wallet,
343-
&payer,
344-
&service_provider,
345-
)?;
346-
347-
let receipt_encoded = encode_v2_receipt(&receipt)?;
348-
314+
// Send plain GraphQL query to gateway - let gateway generate V2 receipt
349315
let response = http_client
350316
.post(format!("{GATEWAY_URL}/api/subgraphs/id/{SUBGRAPH_ID}"))
351317
.header("Content-Type", "application/json")
352318
.header("Authorization", format!("Bearer {GATEWAY_API_KEY}"))
353-
.header("Tap-Receipt", receipt_encoded)
354319
.json(&json!({
355320
"query": "{ _meta { block { number } } }"
356321
}))

0 commit comments

Comments
 (0)