From 622323d7c077d4aef366ef3f77b6c65dda8989ae Mon Sep 17 00:00:00 2001 From: Filippo Costa Date: Sun, 15 Dec 2024 19:09:59 +0100 Subject: [PATCH] Fix all broken tests with updated deployments and indexers Signed-off-by: Filippo Costa --- crates/graphix_lib/src/test_utils/mod.rs | 14 ++++++++ .../graphix_lib/tests/it_indexing_statuses.rs | 6 ++-- .../tests/it_proofs_of_indexing.rs | 33 +++++++++++-------- crates/network_sg_client/src/lib.rs | 9 +++-- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/crates/graphix_lib/src/test_utils/mod.rs b/crates/graphix_lib/src/test_utils/mod.rs index 6d3a1b7..1fe40e0 100644 --- a/crates/graphix_lib/src/test_utils/mod.rs +++ b/crates/graphix_lib/src/test_utils/mod.rs @@ -15,6 +15,20 @@ use url::Url; use crate::config::IndexerConfig; +pub mod deployments { + pub const ARB1_PREMIA_BLUE: &str = "QmdHQVHirs3yPygcgo3HNttXaFCS4pnoGiMx3aKXr192En"; + pub const ARB1_QUICKSWAP_V3: &str = "QmQEYSGSD8t7jTw4gS2dwC4DLvyZceR9fYQ432Ff1hZpCp"; + pub const ARB1_LIDO: &str = "Qmd3vU6y6pxxXPrvVWRZMN9soNB8AFQCEnqPa9jMSZZDEG"; + + /// Extremely low curation signal, basically no indexer has it. + pub const FUSE_TO_ETHEREUM_AMB: &str = "QmYU3Exnta8H52vWUFhGQi6Qm8LhXr5LqmypNrLba8rRem"; +} + +pub mod indexers { + pub const ARB1_DATA_NEXUS: &str = "https://arb-service.thegraph.datanexus.tech/"; + pub const ARB1_ELLIPFRA: &str = "https://graph-l2prod.ellipfra.com/"; +} + pub static TEST_SEED: Lazy = Lazy::new(|| { let seed = env::var("TEST_SEED") .map(|seed| seed.parse().expect("Invalid TEST_SEED value")) diff --git a/crates/graphix_lib/tests/it_indexing_statuses.rs b/crates/graphix_lib/tests/it_indexing_statuses.rs index 54d3380..d193e0f 100644 --- a/crates/graphix_lib/tests/it_indexing_statuses.rs +++ b/crates/graphix_lib/tests/it_indexing_statuses.rs @@ -1,14 +1,14 @@ use std::time::Duration; use graphix_indexer_client::IndexerClient; -use graphix_lib::test_utils::{ipfs_cid, test_indexer_from_url}; +use graphix_lib::test_utils::{deployments, indexers, ipfs_cid, test_indexer_from_url}; #[tokio::test] async fn send_indexer_statuses_query() { //// Given - let indexer = test_indexer_from_url("https://testnet-indexer-03-europe-cent.thegraph.com"); + let indexer = test_indexer_from_url(indexers::ARB1_DATA_NEXUS); - let test_deployment = ipfs_cid("QmeYTH2fK2wv96XvnCGH2eyKFE8kmRfo53zYVy5dKysZtH"); + let test_deployment = ipfs_cid(deployments::ARB1_QUICKSWAP_V3); //// When let request_fut = IndexerClient::indexing_statuses(indexer); diff --git a/crates/graphix_lib/tests/it_proofs_of_indexing.rs b/crates/graphix_lib/tests/it_proofs_of_indexing.rs index f3c929d..54f1588 100644 --- a/crates/graphix_lib/tests/it_proofs_of_indexing.rs +++ b/crates/graphix_lib/tests/it_proofs_of_indexing.rs @@ -1,14 +1,14 @@ use std::time::Duration; use graphix_indexer_client::{IndexerClient, PoiRequest}; -use graphix_lib::test_utils::{ipfs_cid, test_indexer_from_url}; +use graphix_lib::test_utils::{deployments, indexers, ipfs_cid, test_indexer_from_url}; #[tokio::test] async fn send_single_query_and_process_result() { //// Given - let indexer = test_indexer_from_url("https://testnet-indexer-03-europe-cent.thegraph.com"); + let indexer = test_indexer_from_url(indexers::ARB1_DATA_NEXUS); - let deployment = ipfs_cid("QmeYTH2fK2wv96XvnCGH2eyKFE8kmRfo53zYVy5dKysZtH"); + let deployment = ipfs_cid(deployments::ARB1_PREMIA_BLUE); let poi_request = PoiRequest { deployment: deployment.clone(), @@ -32,9 +32,9 @@ async fn send_single_query_and_process_result() { #[tokio::test] async fn send_single_query_of_unknown_deployment_id_and_handle_error() { //// Given - let indexer = test_indexer_from_url("https://testnet-indexer-03-europe-cent.thegraph.com"); + let indexer = test_indexer_from_url(indexers::ARB1_DATA_NEXUS); - let deployment_unknown = ipfs_cid("Qmd3vU6y6pxxXPrvVWRZMN9soNB8AFQCEnqPa9jMSZZDEG"); + let deployment_unknown = ipfs_cid(deployments::FUSE_TO_ETHEREUM_AMB); let poi_request = PoiRequest { deployment: deployment_unknown.clone(), @@ -59,9 +59,9 @@ async fn send_single_query_of_unknown_deployment_id_and_handle_error() { #[tokio::test] async fn send_single_query_of_unknown_block_number_and_handle_error() { //// Given - let indexer = test_indexer_from_url("https://testnet-indexer-03-europe-cent.thegraph.com"); + let indexer = test_indexer_from_url(indexers::ARB1_DATA_NEXUS); - let deployment = ipfs_cid("QmeYTH2fK2wv96XvnCGH2eyKFE8kmRfo53zYVy5dKysZtH"); + let deployment = ipfs_cid(deployments::ARB1_QUICKSWAP_V3); let poi_request = PoiRequest { deployment: deployment.clone(), @@ -87,13 +87,16 @@ async fn send_single_query_of_unknown_block_number_and_handle_error() { async fn send_multiple_queries_and_process_results() { // Given + // FIXME: This is temporarily set to 1 until we fix the error: 'Null value resolved for + // non-null field `proofOfIndexing`' Which is probably a Graph Node bug. Setting it to 1 + // reduces the impact of this issue. const MAX_REQUESTS_PER_QUERY: usize = 1; - let indexer = test_indexer_from_url("https://testnet-indexer-03-europe-cent.thegraph.com"); + let indexer = test_indexer_from_url(indexers::ARB1_DATA_NEXUS); - let deployment = ipfs_cid("QmeYTH2fK2wv96XvnCGH2eyKFE8kmRfo53zYVy5dKysZtH"); + let deployment = ipfs_cid(deployments::ARB1_QUICKSWAP_V3); - let poi_requests = (1..=MAX_REQUESTS_PER_QUERY) + let poi_requests = (1..=MAX_REQUESTS_PER_QUERY + 2) .map(|i| PoiRequest { deployment: deployment.clone(), block_number: i as u64, @@ -124,11 +127,11 @@ async fn send_multiple_queries_and_process_results() { #[tokio::test] async fn send_multiple_queries_of_unknown_deployment_id_and_process_results() { //// Given - let indexer = test_indexer_from_url("https://testnet-indexer-03-europe-cent.thegraph.com"); + let indexer = test_indexer_from_url(indexers::ARB1_DATA_NEXUS); - let deployment0 = ipfs_cid("QmeYTH2fK2wv96XvnCGH2eyKFE8kmRfo53zYVy5dKysZtH"); - let deployment1 = ipfs_cid("QmawxQJ5U1JvgosoFVDyAwutLWxrckqVmBTQxaMaKoj3Lw"); - let deployment_unknown = ipfs_cid("Qmd3vU6y6pxxXPrvVWRZMN9soNB8AFQCEnqPa9jMSZZDEG"); + let deployment0 = ipfs_cid(deployments::ARB1_PREMIA_BLUE); + let deployment1 = ipfs_cid(deployments::ARB1_QUICKSWAP_V3); + let deployment_unknown = ipfs_cid(deployments::FUSE_TO_ETHEREUM_AMB); let poi_requests = vec![ PoiRequest { @@ -151,6 +154,8 @@ async fn send_multiple_queries_of_unknown_deployment_id_and_process_results() { .await .expect("Timeout"); + println!("response: {:?}", response); + //// Then assert_eq!(response.len(), 2); diff --git a/crates/network_sg_client/src/lib.rs b/crates/network_sg_client/src/lib.rs index 612af30..bde2be7 100644 --- a/crates/network_sg_client/src/lib.rs +++ b/crates/network_sg_client/src/lib.rs @@ -138,7 +138,7 @@ impl NetworkSubgraphClient { #[serde(rename_all = "camelCase")] struct IndexerData { url: String, - default_display_name: String, + default_display_name: Option, } let indexer_data = response_data @@ -147,7 +147,7 @@ impl NetworkSubgraphClient { .ok_or_else(|| anyhow::anyhow!("No indexer found for address {}", address))?; let indexer = RealIndexer::new( - Some(indexer_data.default_display_name.clone()), + indexer_data.default_display_name.clone(), *address, Url::parse(&format!("{}/status", indexer_data.url))?.to_string(), self.public_poi_requests.clone(), @@ -397,9 +397,8 @@ mod tests { #[tokio::test] async fn mainnet_fetch_ellipfra() { let client = network_sg_client_on_ethereum(); - // ellipfra.eth: - // htps://thegraph.com/explorer/profile/0x62a0bd1d110ff4e5b793119e95fc07c9d1fc8c4a?view=Indexing&chain=mainnet - let address = str::parse("62a0bd1d110ff4e5b793119e95fc07c9d1fc8c4a").unwrap(); + // htps://thegraph.com/explorer/profile/0x...?view=Indexing&chain=mainnet + let address = str::parse("f92f430dd8567b0d466358c79594ab58d919a6d4").unwrap(); let indexer = client.indexer_by_address(&address).await.unwrap(); assert_eq!(indexer.address(), address); }