Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node: Fix fresh start with firehose only #4553

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion node/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use clap::Parser as _;
use ethereum::chain::{EthereumAdapterSelector, EthereumBlockRefetcher, EthereumStreamBuilder};
use ethereum::codec::HeaderOnlyBlock;
use ethereum::{BlockIngestor, EthereumNetworks, RuntimeAdapter};
use git_testament::{git_testament, render_testament};
use graph::blockchain::client::ChainClient;
Expand Down Expand Up @@ -296,9 +297,19 @@ async fn main() {
)
.await;

// This only has idents for chains with rpc adapters.
let (eth_networks, ethereum_idents) =
connect_ethereum_networks(&logger, eth_networks).await;

let (eth_firehose_only_networks, eth_firehose_only_idents) =
connect_firehose_networks::<HeaderOnlyBlock>(
&logger,
firehose_networks_by_kind
.remove(&BlockchainKind::Ethereum)
.unwrap_or_else(FirehoseNetworks::new),
)
.await;

let (near_networks, near_idents) =
connect_firehose_networks::<NearFirehoseHeaderOnlyBlock>(
&logger,
Expand All @@ -318,6 +329,7 @@ async fn main() {

let network_identifiers = ethereum_idents
.into_iter()
.chain(eth_firehose_only_idents)
.chain(arweave_idents)
.chain(near_idents)
.chain(cosmos_idents)
Expand All @@ -334,12 +346,18 @@ async fn main() {
metrics_registry.clone(),
);

let eth_firehose_only_networks = if eth_firehose_only_networks.networks.len() == 0 {
None
} else {
Some(&eth_firehose_only_networks)
};

let ethereum_chains = ethereum_networks_as_chains(
&mut blockchain_map,
&logger,
node_id.clone(),
metrics_registry.clone(),
firehose_networks_by_kind.get(&BlockchainKind::Ethereum),
eth_firehose_only_networks,
substreams_networks_by_kind.get(&BlockchainKind::Ethereum),
&eth_networks,
network_store.as_ref(),
Expand Down