Skip to content

Commit ddd6532

Browse files
authored
test(integration-tests): use graphtally collector in test rav gen (#815)
* test(integration-tests): use graphtally collector in test rav gen * test(integration-tests): use network subgraph id in indexer url * fix(integration-tests): fix collection in fund escrow script
1 parent 9528ef2 commit ddd6532

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

integration-tests/fund_escrow.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,27 @@ fi
124124
echo ""
125125
echo "========== FUNDING V2 ESCROW =========="
126126

127+
# Query the network subgraph to find the current allocation ID
128+
echo "Querying network subgraph for current allocation ID..."
129+
ALLOCATION_QUERY_RESULT=$(curl -s -X POST http://localhost:8000/subgraphs/name/graph-network \
130+
-H "Content-Type: application/json" \
131+
-d '{"query": "{ allocations(where: { status: Active }) { id indexer { id } subgraphDeployment { id } } }"}')
132+
133+
# Extract allocation ID from the JSON response
134+
CURRENT_ALLOCATION_ID=$(echo "$ALLOCATION_QUERY_RESULT" | jq -r '.data.allocations[0].id')
135+
136+
if [ "$CURRENT_ALLOCATION_ID" == "null" ] || [ -z "$CURRENT_ALLOCATION_ID" ]; then
137+
echo "❌ Failed to find current allocation ID from network subgraph"
138+
echo "Response: $ALLOCATION_QUERY_RESULT"
139+
exit 1
140+
fi
141+
142+
echo "✅ Found current allocation ID: $CURRENT_ALLOCATION_ID"
143+
127144
# For V2, we need to specify payer, collector, and receiver
128-
# Payer is the test account, but receiver must be the indexer address
145+
# Payer is the test account, collector is the allocation ID, receiver is the indexer
129146
PAYER=$SENDER_ADDRESS
130-
COLLECTOR=$SENDER_ADDRESS
147+
COLLECTOR=$CURRENT_ALLOCATION_ID
131148
RECEIVER="0xf4EF6650E48d099a4972ea5B414daB86e1998Bd3" # This must be the indexer address
132149

133150
# Check current V2 escrow balance before funding

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 = "QmV4R5g7Go94bVFmKTVFG7vaMTb1ztUUWb45mNrsc7Yyqs";
27+
pub const SUBGRAPH_ID: &str = "Qmc2CbqucMvaS4GFvt2QUZWvRwSZ3K5ipeGvbC6UUBf616";
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ 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_URL, INDEXER_URL,
14-
MAX_RECEIPT_VALUE, SUBGRAPH_ID, TAP_AGENT_METRICS_URL, TAP_VERIFIER_CONTRACT,
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,
1516
},
1617
utils::{
1718
create_request, create_tap_receipt, create_tap_receipt_v2, encode_v2_receipt,
@@ -264,7 +265,7 @@ pub async fn test_tap_rav_v2() -> Result<()> {
264265
let receipt = create_tap_receipt_v2(
265266
MAX_RECEIPT_VALUE,
266267
&allocation_id,
267-
TAP_VERIFIER_CONTRACT,
268+
GRAPH_TALLY_COLLECTOR_CONTRACT,
268269
CHAIN_ID,
269270
&wallet,
270271
&payer,
@@ -336,7 +337,7 @@ pub async fn test_tap_rav_v2() -> Result<()> {
336337
let receipt = create_tap_receipt_v2(
337338
MAX_RECEIPT_VALUE / 10, // Smaller value for trigger receipts
338339
&allocation_id,
339-
TAP_VERIFIER_CONTRACT,
340+
GRAPH_TALLY_COLLECTOR_CONTRACT,
340341
CHAIN_ID,
341342
&wallet,
342343
&payer,

0 commit comments

Comments
 (0)