From fa4c4fd7e60dd2bc81c2e7c0a6482cacc5d61eda Mon Sep 17 00:00:00 2001 From: Jono Prest Date: Mon, 18 Nov 2024 19:18:29 +0200 Subject: [PATCH] Add ignore from tests to mev commit --- codegenerator/cli/src/config_parsing/chain_helpers.rs | 4 ++-- .../cli/src/scripts/print_missing_networks.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/codegenerator/cli/src/config_parsing/chain_helpers.rs b/codegenerator/cli/src/config_parsing/chain_helpers.rs index 6bba194df..5a500a7f3 100644 --- a/codegenerator/cli/src/config_parsing/chain_helpers.rs +++ b/codegenerator/cli/src/config_parsing/chain_helpers.rs @@ -9,7 +9,7 @@ use subenum::subenum; use crate::constants::DEFAULT_CONFIRMED_BLOCK_THRESHOLD; -#[subenum(NetworkWithExplorer, HypersyncNetwork, GraphNetwork)] +#[subenum(NetworkWithExplorer, HypersyncNetwork, GraphNetwork, IgnoreFromTests)] #[derive( Clone, Debug, @@ -207,7 +207,7 @@ pub enum Network { #[subenum(HypersyncNetwork, NetworkWithExplorer)] Metis = 1088, - #[subenum(HypersyncNetwork)] + #[subenum(IgnoreFromTests)] MevCommit = 17864, #[subenum(HypersyncNetwork, NetworkWithExplorer)] diff --git a/codegenerator/cli/src/scripts/print_missing_networks.rs b/codegenerator/cli/src/scripts/print_missing_networks.rs index cbf2b6d39..df8a0aeab 100644 --- a/codegenerator/cli/src/scripts/print_missing_networks.rs +++ b/codegenerator/cli/src/scripts/print_missing_networks.rs @@ -1,9 +1,10 @@ -use crate::config_parsing::chain_helpers::{GraphNetwork, HypersyncNetwork}; +use crate::config_parsing::chain_helpers::{GraphNetwork, HypersyncNetwork, IgnoreFromTests, Network}; use anyhow::Result; use convert_case::{Case, Casing}; use reqwest; use serde::Deserialize; use std::collections::HashSet; +use strum::IntoEnumIterator; #[derive(Deserialize, Debug)] struct Chain { @@ -20,6 +21,7 @@ pub async fn get_diff() -> Result { let url = "https://chains.hyperquery.xyz/active_chains"; let response = reqwest::get(url).await?; let chains: Vec = response.json().await?; + let ignored_chains = IgnoreFromTests::iter().map(|c|{Network::from(c).get_network_id()}).collect::>(); let mut missing_chains = Vec::new(); let mut api_chain_ids = HashSet::new(); @@ -28,6 +30,9 @@ pub async fn get_diff() -> Result { let Some(chain_id) = chain.chain_id else { continue; }; + if ignored_chains.contains(&chain_id) { + continue; + } if chain.name == "internal-test-chain" { continue; } @@ -51,6 +56,9 @@ pub async fn get_diff() -> Result { let mut extra_chains = Vec::new(); for network in HypersyncNetwork::iter_hypersync_networks() { let network_id = network as u64; + if !ignored_chains.contains(&network_id) { + continue; + } if !api_chain_ids.contains(&network_id) { extra_chains.push(format!("{:?} (ID: {})", network, network_id)); }