@@ -15,15 +15,12 @@ use graph::blockchain::{
1515 ChainIdentifier ,
1616} ;
1717use graph:: cheap_clone:: CheapClone ;
18- use graph:: components:: adapter :: ChainId ;
18+ use graph:: components:: network_provider :: ChainName ;
1919use graph:: components:: store:: { BlockStore as _, ChainStore } ;
2020use graph:: data:: store:: NodeId ;
2121use graph:: endpoint:: EndpointMetrics ;
2222use graph:: env:: { EnvVars , ENV_VARS } ;
23- use graph:: firehose:: {
24- FirehoseEndpoint , FirehoseGenesisDecoder , GenesisDecoder , SubgraphLimit ,
25- SubstreamsGenesisDecoder ,
26- } ;
23+ use graph:: firehose:: { FirehoseEndpoint , SubgraphLimit } ;
2724use graph:: futures03:: future:: try_join_all;
2825use graph:: itertools:: Itertools ;
2926use graph:: log:: factory:: LoggerFactory ;
@@ -63,11 +60,11 @@ pub fn create_substreams_networks(
6360 config. chains. ingestor,
6461 ) ;
6562
66- let mut networks_by_kind: BTreeMap < ( BlockchainKind , ChainId ) , Vec < Arc < FirehoseEndpoint > > > =
63+ let mut networks_by_kind: BTreeMap < ( BlockchainKind , ChainName ) , Vec < Arc < FirehoseEndpoint > > > =
6764 BTreeMap :: new ( ) ;
6865
6966 for ( name, chain) in & config. chains . chains {
70- let name: ChainId = name. as_str ( ) . into ( ) ;
67+ let name: ChainName = name. as_str ( ) . into ( ) ;
7168 for provider in & chain. providers {
7269 if let ProviderDetails :: Substreams ( ref firehose) = provider. details {
7370 info ! (
@@ -93,7 +90,6 @@ pub fn create_substreams_networks(
9390 firehose. compression_enabled ( ) ,
9491 SubgraphLimit :: Unlimited ,
9592 endpoint_metrics. clone ( ) ,
96- Box :: new ( SubstreamsGenesisDecoder { } ) ,
9793 ) ) ) ;
9894 }
9995 }
@@ -124,11 +120,11 @@ pub fn create_firehose_networks(
124120 config. chains. ingestor,
125121 ) ;
126122
127- let mut networks_by_kind: BTreeMap < ( BlockchainKind , ChainId ) , Vec < Arc < FirehoseEndpoint > > > =
123+ let mut networks_by_kind: BTreeMap < ( BlockchainKind , ChainName ) , Vec < Arc < FirehoseEndpoint > > > =
128124 BTreeMap :: new ( ) ;
129125
130126 for ( name, chain) in & config. chains . chains {
131- let name: ChainId = name. as_str ( ) . into ( ) ;
127+ let name: ChainName = name. as_str ( ) . into ( ) ;
132128 for provider in & chain. providers {
133129 let logger = logger. cheap_clone ( ) ;
134130 if let ProviderDetails :: Firehose ( ref firehose) = provider. details {
@@ -143,27 +139,6 @@ pub fn create_firehose_networks(
143139 . entry ( ( chain. protocol , name. clone ( ) ) )
144140 . or_insert_with ( Vec :: new) ;
145141
146- let decoder: Box < dyn GenesisDecoder > = match chain. protocol {
147- BlockchainKind :: Arweave => {
148- FirehoseGenesisDecoder :: < graph_chain_arweave:: Block > :: new ( logger)
149- }
150- BlockchainKind :: Ethereum => {
151- FirehoseGenesisDecoder :: < graph_chain_ethereum:: codec:: Block > :: new ( logger)
152- }
153- BlockchainKind :: Near => {
154- FirehoseGenesisDecoder :: < graph_chain_near:: HeaderOnlyBlock > :: new ( logger)
155- }
156- BlockchainKind :: Cosmos => {
157- FirehoseGenesisDecoder :: < graph_chain_cosmos:: Block > :: new ( logger)
158- }
159- BlockchainKind :: Substreams => {
160- unreachable ! ( "Substreams configuration should not be handled here" ) ;
161- }
162- BlockchainKind :: Starknet => {
163- FirehoseGenesisDecoder :: < graph_chain_starknet:: Block > :: new ( logger)
164- }
165- } ;
166-
167142 // Create n FirehoseEndpoints where n is the size of the pool. If a
168143 // subgraph limit is defined for this endpoint then each endpoint
169144 // instance will have their own subgraph limit.
@@ -182,7 +157,6 @@ pub fn create_firehose_networks(
182157 firehose. compression_enabled ( ) ,
183158 firehose. limit_for ( & config. node ) ,
184159 endpoint_metrics. cheap_clone ( ) ,
185- decoder. box_clone ( ) ,
186160 ) ) ) ;
187161 }
188162 }
@@ -384,7 +358,7 @@ pub async fn networks_as_chains(
384358 async fn add_substreams < C : Blockchain > (
385359 networks : & Networks ,
386360 config : & Arc < EnvVars > ,
387- chain_id : ChainId ,
361+ chain_id : ChainName ,
388362 blockchain_map : & mut BlockchainMap ,
389363 logger_factory : LoggerFactory ,
390364 chain_store : Arc < dyn ChainStore > ,
@@ -608,7 +582,7 @@ pub async fn networks_as_chains(
608582mod test {
609583 use crate :: config:: { Config , Opt } ;
610584 use crate :: network_setup:: { AdapterConfiguration , Networks } ;
611- use graph:: components:: adapter :: { ChainId , NoopIdentValidator } ;
585+ use graph:: components:: network_provider :: ChainName ;
612586 use graph:: endpoint:: EndpointMetrics ;
613587 use graph:: log:: logger;
614588 use graph:: prelude:: { tokio, MetricsRegistry } ;
@@ -641,23 +615,15 @@ mod test {
641615 let metrics = Arc :: new ( EndpointMetrics :: mock ( ) ) ;
642616 let config = Config :: load ( & logger, & opt) . expect ( "can create config" ) ;
643617 let metrics_registry = Arc :: new ( MetricsRegistry :: mock ( ) ) ;
644- let ident_validator = Arc :: new ( NoopIdentValidator ) ;
645618
646- let networks = Networks :: from_config (
647- logger,
648- & config,
649- metrics_registry,
650- metrics,
651- ident_validator,
652- false ,
653- )
654- . await
655- . expect ( "can parse config" ) ;
619+ let networks = Networks :: from_config ( logger, & config, metrics_registry, metrics, & [ ] )
620+ . await
621+ . expect ( "can parse config" ) ;
656622 let mut network_names = networks
657623 . adapters
658624 . iter ( )
659625 . map ( |a| a. chain_id ( ) )
660- . collect :: < Vec < & ChainId > > ( ) ;
626+ . collect :: < Vec < & ChainName > > ( ) ;
661627 network_names. sort ( ) ;
662628
663629 let traces = NodeCapabilities {
0 commit comments