diff --git a/chain/ethereum/src/network.rs b/chain/ethereum/src/network.rs index 83f2e311e82..dd06cb7eafc 100644 --- a/chain/ethereum/src/network.rs +++ b/chain/ethereum/src/network.rs @@ -298,96 +298,6 @@ impl EthereumNetworkAdapters { } } -// #[derive(Debug, Clone)] -// pub struct EthereumNetworks { -// pub logger: Logger, -// pub metrics: Arc, -// pub networks: HashMap, -// } - -// impl EthereumNetworks { -// pub fn new(logger: Logger, metrics: Arc) -> EthereumNetworks { -// EthereumNetworks { -// networks: HashMap::new(), -// metrics, -// logger, -// } -// } - -// pub fn insert_empty(&mut self, name: String) { -// self.networks.entry(name).or_default(); -// } - -// pub fn insert( -// &mut self, -// name: String, -// capabilities: NodeCapabilities, -// adapter: Arc, -// limit: SubgraphLimit, -// ) { -// let network_adapters = self.networks.entry(name).or_default(); - -// network_adapters.push_adapter(EthereumNetworkAdapter { -// capabilities, -// adapter, -// limit, -// endpoint_metrics: self.metrics.cheap_clone(), -// }); -// } - -// pub fn remove(&mut self, name: &str, provider: &str) { -// if let Some(adapters) = self.networks.get_mut(name) { -// adapters.remove(provider); -// } -// } - -// pub fn extend(&mut self, other_networks: EthereumNetworks) { -// self.networks.extend(other_networks.networks); -// } - -// pub fn flatten(&self) -> Vec<(String, NodeCapabilities, Arc)> { -// self.networks -// .iter() -// .flat_map(|(network_name, network_adapters)| { -// network_adapters -// .adapters -// .iter() -// .map(move |network_adapter| { -// ( -// network_name.clone(), -// network_adapter.capabilities, -// network_adapter.adapter.clone(), -// ) -// }) -// }) -// .collect() -// } - -// pub fn sort(&mut self) { -// for adapters in self.networks.values_mut() { -// adapters.adapters.sort_by(|a, b| { -// a.capabilities -// .partial_cmp(&b.capabilities) -// // We can't define a total ordering over node capabilities, -// // so incomparable items are considered equal and end up -// // near each other. -// .unwrap_or(Ordering::Equal) -// }) -// } -// } - -// pub fn adapter_with_capabilities( -// &self, -// network_name: String, -// requirements: &NodeCapabilities, -// ) -> Result, Error> { -// self.networks -// .get(&network_name) -// .ok_or(anyhow!("network not supported: {}", &network_name)) -// .and_then(|adapters| adapters.cheapest_with(requirements)) -// } -// } - #[cfg(test)] mod tests { use graph::cheap_clone::CheapClone; diff --git a/graph/src/firehose/endpoints.rs b/graph/src/firehose/endpoints.rs index 93dac09709b..ebedb8e253a 100644 --- a/graph/src/firehose/endpoints.rs +++ b/graph/src/firehose/endpoints.rs @@ -26,13 +26,8 @@ use itertools::Itertools; use prost::Message; use slog::Logger; use std::{ - collections::{BTreeMap, HashMap}, - fmt::Display, - marker::PhantomData, - ops::ControlFlow, - str::FromStr, - sync::Arc, - time::Duration, + collections::HashMap, fmt::Display, marker::PhantomData, ops::ControlFlow, str::FromStr, + sync::Arc, time::Duration, }; use tonic::codegen::InterceptedService; use tonic::{ @@ -692,46 +687,6 @@ impl FirehoseEndpoints { } } -#[derive(Clone, Debug)] -pub struct FirehoseNetworks { - /// networks contains a map from chain id (`near-mainnet`, `near-testnet`, `solana-mainnet`, etc.) - /// to a list of FirehoseEndpoint (type wrapper around `Arc>`). - pub networks: BTreeMap>>, -} - -impl FirehoseNetworks { - pub fn new() -> FirehoseNetworks { - FirehoseNetworks { - networks: BTreeMap::new(), - } - } - - pub fn insert(&mut self, chain_id: String, endpoint: Arc) { - let endpoints = self.networks.entry(chain_id).or_insert_with(|| Vec::new()); - - endpoints.push(endpoint); - } - - /// Returns a `HashMap` where the key is the chain's id and the key is an endpoint for this chain. - /// There can be multiple keys with the same chain id but with different - /// endpoint where multiple providers exist for a single chain id. Providers with the same - /// label do not need to be tested individually, if one is working, every other endpoint in the - /// pool should also work. - pub fn flatten(&self) -> HashMap<(String, Word), Arc> { - self.networks - .iter() - .flat_map(|(chain_id, firehose_endpoints)| { - firehose_endpoints.iter().map(move |endpoint| { - ( - (chain_id.clone(), endpoint.provider.clone()), - endpoint.clone(), - ) - }) - }) - .collect() - } -} - #[cfg(test)] mod test { use std::{mem, sync::Arc}; diff --git a/store/postgres/src/block_store.rs b/store/postgres/src/block_store.rs index bde0b6a402b..d77b4dfe4bb 100644 --- a/store/postgres/src/block_store.rs +++ b/store/postgres/src/block_store.rs @@ -259,32 +259,6 @@ impl BlockStore { ); return false; } - // if chain.net_version != ident.net_version { - // if chain.net_version == "0" { - // warn!(logger, - // "the net version for chain {} has changed from 0 to {} since the last time we ran, ignoring difference because 0 means UNSET and firehose does not provide it", - // chain.name, - // ident.net_version, - // ) - // } else { - // error!(logger, - // "the net version for chain {} has changed from {} to {} since the last time we ran", - // chain.name, - // chain.net_version, - // ident.net_version - // ); - // return false; - // } - // } - // if chain.genesis_block != ident.genesis_block_hash.hash_hex() { - // error!(logger, - // "the genesis block hash for chain {} has changed from {} to {} since the last time we ran", - // chain.name, - // chain.genesis_block, - // ident.genesis_block_hash - // ); - // return false; - // } true }