Skip to content

Commit

Permalink
move network setup to a different module
Browse files Browse the repository at this point in the history
  • Loading branch information
mangas committed May 22, 2024
1 parent 9174aa7 commit 71d956d
Show file tree
Hide file tree
Showing 8 changed files with 409 additions and 383 deletions.
7 changes: 3 additions & 4 deletions node/src/bin/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ use graph::{
};
use graph_chain_ethereum::EthereumAdapter;
use graph_graphql::prelude::GraphQlRunner;
use graph_node::config::{self, Config as Cfg, Networks};
use graph_node::config::{self, Config as Cfg};
use graph_node::manager::color::Terminal;
use graph_node::manager::commands;
use graph_node::network_setup::Networks;
use graph_node::{
manager::{deployment::DeploymentSearch, PanicSubscriptionManager},
store_builder::StoreBuilder,
Expand Down Expand Up @@ -990,9 +991,7 @@ impl Context {
let logger = self.logger.clone();
let registry = self.metrics_registry();
let metrics = Arc::new(EndpointMetrics::mock());
self.config
.networks(logger, registry, metrics, block_store)
.await
Networks::from_config(logger, &self.config, registry, metrics, block_store).await
}

fn chain_store(self, chain_name: &str) -> anyhow::Result<Arc<ChainStore>> {
Expand Down
17 changes: 9 additions & 8 deletions node/src/chain.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::config::{
AdapterConfiguration, Config, EthAdapterConfig, FirehoseAdapterConfig, Networks,
ProviderDetails,
use crate::config::{Config, ProviderDetails};
use crate::network_setup::{
AdapterConfiguration, EthAdapterConfig, FirehoseAdapterConfig, Networks,
};
use ethereum::chain::{
EthereumAdapterSelector, EthereumBlockRefetcher, EthereumRuntimeAdapterBuilder,
Expand Down Expand Up @@ -623,7 +623,8 @@ pub async fn networks_as_chains(

#[cfg(test)]
mod test {
use crate::config::{AdapterConfiguration, Config, Opt};
use crate::config::{Config, Opt};
use crate::network_setup::{AdapterConfiguration, Networks};
use graph::components::adapter::{ChainId, MockIdentValidator};
use graph::endpoint::EndpointMetrics;
use graph::log::logger;
Expand Down Expand Up @@ -659,10 +660,10 @@ mod test {
let metrics_registry = Arc::new(MetricsRegistry::mock());
let ident_validator = Arc::new(MockIdentValidator);

let networks = config
.networks(logger, metrics_registry, metrics, ident_validator)
.await
.expect("can parse config");
let networks =
Networks::from_config(logger, &config, metrics_registry, metrics, ident_validator)
.await
.expect("can parse config");
let mut network_names = networks
.adapters
.iter()
Expand Down
Loading

0 comments on commit 71d956d

Please sign in to comment.