Skip to content

Commit 6f964f0

Browse files
committed
Remove provider checks at startup
#3937
1 parent 2dc7516 commit 6f964f0

File tree

5 files changed

+609
-6
lines changed

5 files changed

+609
-6
lines changed

chain/ethereum/src/network.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use anyhow::{anyhow, bail};
2+
use graph::blockchain::ChainIdentifier;
23
use graph::cheap_clone::CheapClone;
4+
use graph::components::adapter::{NetIdentifiable, ProviderManager, ProviderName};
35
use graph::endpoint::EndpointMetrics;
46
use graph::firehose::{AvailableCapacity, SubgraphLimit};
57
use graph::prelude::rand::seq::IteratorRandom;
@@ -9,7 +11,7 @@ use std::collections::HashMap;
911
use std::sync::Arc;
1012

1113
pub use graph::impl_slog_value;
12-
use graph::prelude::Error;
14+
use graph::prelude::{async_trait, Error};
1315

1416
use crate::adapter::EthereumAdapter as _;
1517
use crate::capabilities::NodeCapabilities;
@@ -29,6 +31,16 @@ pub struct EthereumNetworkAdapter {
2931
limit: SubgraphLimit,
3032
}
3133

34+
#[async_trait]
35+
impl NetIdentifiable for EthereumNetworkAdapter {
36+
async fn net_identifiers(&self) -> Result<ChainIdentifier, anyhow::Error> {
37+
unimplemented!()
38+
}
39+
fn provider_name(&self) -> ProviderName {
40+
unimplemented!()
41+
}
42+
}
43+
3244
impl EthereumNetworkAdapter {
3345
fn is_call_only(&self) -> bool {
3446
self.adapter.is_call_only()
@@ -46,9 +58,10 @@ impl EthereumNetworkAdapter {
4658
}
4759
}
4860

49-
#[derive(Debug, Clone)]
61+
#[derive(Debug)]
5062
pub struct EthereumNetworkAdapters {
51-
pub adapters: Vec<EthereumNetworkAdapter>,
63+
// provider_status: ProviderGenesisVerification,
64+
adapters: Vec<EthereumNetworkAdapter>,
5265
call_only_adapters: Vec<EthereumNetworkAdapter>,
5366
// Percentage of request that should be used to retest errored adapters.
5467
retest_percent: f64,
@@ -66,6 +79,7 @@ impl EthereumNetworkAdapters {
6679
adapters: vec![],
6780
call_only_adapters: vec![],
6881
retest_percent: retest_percent.unwrap_or(DEFAULT_ADAPTER_ERROR_RETEST_PERCENT),
82+
// provider_status: ProviderGenesisVerification::default(),
6983
}
7084
}
7185

@@ -76,7 +90,7 @@ impl EthereumNetworkAdapters {
7690
self.adapters.push(adapter);
7791
}
7892
}
79-
pub fn all_cheapest_with(
93+
fn all_cheapest_with(
8094
&self,
8195
required_capabilities: &NodeCapabilities,
8296
) -> impl Iterator<Item = &EthereumNetworkAdapter> + '_ {
@@ -179,7 +193,7 @@ impl EthereumNetworkAdapters {
179193
}
180194
}
181195

182-
#[derive(Clone)]
196+
#[derive(Debug, Clone)]
183197
pub struct EthereumNetworks {
184198
pub metrics: Arc<EndpointMetrics>,
185199
pub networks: HashMap<String, EthereumNetworkAdapters>,

graph/src/blockchain/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ impl From<BlockPtr> for BlockNumber {
316316
}
317317
}
318318

319-
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
319+
#[derive(Clone, Debug, PartialEq, Eq, Hash, Default)]
320320
/// A collection of attributes that (kind of) uniquely identify a blockchain.
321321
pub struct ChainIdentifier {
322322
pub net_version: String,

0 commit comments

Comments
 (0)