diff --git a/core/src/subgraph/instance_manager.rs b/core/src/subgraph/instance_manager.rs index 20366a39bfa..cdf3688c574 100644 --- a/core/src/subgraph/instance_manager.rs +++ b/core/src/subgraph/instance_manager.rs @@ -60,7 +60,6 @@ impl SubgraphInstanceManagerTrait for SubgraphInstanceManager< async fn start_subgraph( self: Arc, loc: DeploymentLocator, - manifest: serde_yaml::Mapping, stop_block: Option, ) { let runner_index = self.subgraph_start_counter.fetch_add(1, Ordering::SeqCst); @@ -78,6 +77,19 @@ impl SubgraphInstanceManagerTrait for SubgraphInstanceManager< let deployment_status_metric = deployment_status_metric.clone(); async move { + let link_resolver = self + .link_resolver + .for_manifest(&loc.hash.to_string()) + .map_err(SubgraphAssignmentProviderError::ResolveError)?; + + let file_bytes = link_resolver + .cat(&logger, &loc.hash.to_ipfs_link()) + .await + .map_err(SubgraphAssignmentProviderError::ResolveError)?; + + let manifest: serde_yaml::Mapping = serde_yaml::from_slice(&file_bytes) + .map_err(|e| SubgraphAssignmentProviderError::ResolveError(e.into()))?; + match BlockchainKind::from_manifest(&manifest)? { BlockchainKind::Ethereum => { let runner = instance_manager diff --git a/core/src/subgraph/provider.rs b/core/src/subgraph/provider.rs index 9ad50f43942..a7122442531 100644 --- a/core/src/subgraph/provider.rs +++ b/core/src/subgraph/provider.rs @@ -44,14 +44,12 @@ impl DeploymentRegistry { pub struct SubgraphAssignmentProvider { logger_factory: LoggerFactory, deployment_registry: DeploymentRegistry, - link_resolver: Arc, instance_manager: Arc, } impl SubgraphAssignmentProvider { pub fn new( logger_factory: &LoggerFactory, - link_resolver: Arc, instance_manager: I, subgraph_metrics: Arc, ) -> Self { @@ -61,7 +59,6 @@ impl SubgraphAssignmentProvider { // Create the subgraph provider SubgraphAssignmentProvider { logger_factory, - link_resolver: link_resolver.with_retries().into(), instance_manager: Arc::new(instance_manager), deployment_registry: DeploymentRegistry::new(subgraph_metrics), } @@ -86,22 +83,9 @@ impl SubgraphAssignmentProviderTrait for SubgraphAss )); } - let link_resolver = self - .link_resolver - .for_manifest(&loc.hash.to_string()) - .map_err(SubgraphAssignmentProviderError::ResolveError)?; - - let file_bytes = link_resolver - .cat(&logger, &loc.hash.to_ipfs_link()) - .await - .map_err(SubgraphAssignmentProviderError::ResolveError)?; - - let raw: serde_yaml::Mapping = serde_yaml::from_slice(&file_bytes) - .map_err(|e| SubgraphAssignmentProviderError::ResolveError(e.into()))?; - self.instance_manager .cheap_clone() - .start_subgraph(loc, raw, stop_block) + .start_subgraph(loc, stop_block) .await; Ok(()) diff --git a/graph/Cargo.toml b/graph/Cargo.toml index bb4287b2c31..3c78221e7a8 100644 --- a/graph/Cargo.toml +++ b/graph/Cargo.toml @@ -61,7 +61,7 @@ sqlparser = { workspace = true } # stable-hash_legacy = { version = "0.3.3", package = "stable-hash" } # stable-hash = { version = "0.4.2" } stable-hash = { git = "https://github.com/graphprotocol/stable-hash", branch = "main" } -stable-hash_legacy = { git = "https://github.com/graphprotocol/stable-hash", branch = "old", package = "stable-hash", doc = false } +stable-hash_legacy = { git = "https://github.com/graphprotocol/stable-hash", branch = "old", package = "stable-hash" } strum_macros = "0.27.1" slog-async = "2.5.0" slog-envlogger = "2.1.0" diff --git a/graph/src/components/store/write.rs b/graph/src/components/store/write.rs index b75d2912de2..fc0ebaea856 100644 --- a/graph/src/components/store/write.rs +++ b/graph/src/components/store/write.rs @@ -145,7 +145,7 @@ impl EntityModification { /// Return the details of the write if `self` is a write operation for a /// new or an existing entity - fn as_write(&self) -> Option { + fn as_write(&self) -> Option> { EntityWrite::try_from(self).ok() } @@ -823,7 +823,7 @@ impl Batch { &self, entity_type: &EntityType, at: BlockNumber, - ) -> impl Iterator { + ) -> impl Iterator> { self.mods .group(entity_type) .map(|group| group.effective_ops(at)) diff --git a/graph/src/components/subgraph/instance_manager.rs b/graph/src/components/subgraph/instance_manager.rs index c04fd5237b4..c9f076a2a36 100644 --- a/graph/src/components/subgraph/instance_manager.rs +++ b/graph/src/components/subgraph/instance_manager.rs @@ -13,7 +13,6 @@ pub trait SubgraphInstanceManager: Send + Sync + 'static { async fn start_subgraph( self: Arc, deployment: DeploymentLocator, - manifest: serde_yaml::Mapping, stop_block: Option, ); async fn stop_subgraph(&self, deployment: DeploymentLocator); diff --git a/graph/src/components/subgraph/proof_of_indexing/reference.rs b/graph/src/components/subgraph/proof_of_indexing/reference.rs index 5c7d269d7a7..3a11a4db4e3 100644 --- a/graph/src/components/subgraph/proof_of_indexing/reference.rs +++ b/graph/src/components/subgraph/proof_of_indexing/reference.rs @@ -9,6 +9,7 @@ use web3::types::{Address, H256}; /// well-implemented (without conflicting sequence numbers, or other oddities). /// It's just way easier to check that this works, and serves as a kind of /// documentation as a side-benefit. +#[allow(dead_code)] pub struct PoI<'a> { pub causality_regions: HashMap>, pub subgraph_id: DeploymentHash, @@ -16,10 +17,12 @@ pub struct PoI<'a> { pub indexer: Option
, } +#[allow(dead_code)] fn h256_as_bytes(val: &H256) -> AsBytes<&[u8]> { AsBytes(val.as_bytes()) } +#[allow(dead_code)] fn indexer_opt_as_bytes(val: &Option
) -> Option> { val.as_ref().map(|v| AsBytes(v.as_bytes())) } diff --git a/graph/src/util/timed_rw_lock.rs b/graph/src/util/timed_rw_lock.rs index 4a52d531604..e8ff394be44 100644 --- a/graph/src/util/timed_rw_lock.rs +++ b/graph/src/util/timed_rw_lock.rs @@ -20,7 +20,7 @@ impl TimedRwLock { } } - pub fn write(&self, logger: &Logger) -> parking_lot::RwLockWriteGuard { + pub fn write(&self, logger: &Logger) -> parking_lot::RwLockWriteGuard<'_, T> { loop { let mut elapsed = Duration::from_secs(0); match self.lock.try_write_for(self.log_threshold) { @@ -36,11 +36,11 @@ impl TimedRwLock { } } - pub fn try_read(&self) -> Option> { + pub fn try_read(&self) -> Option> { self.lock.try_read() } - pub fn read(&self, logger: &Logger) -> parking_lot::RwLockReadGuard { + pub fn read(&self, logger: &Logger) -> parking_lot::RwLockReadGuard<'_, T> { loop { let mut elapsed = Duration::from_secs(0); match self.lock.try_read_for(self.log_threshold) { @@ -73,7 +73,7 @@ impl TimedMutex { } } - pub fn lock(&self, logger: &Logger) -> parking_lot::MutexGuard { + pub fn lock(&self, logger: &Logger) -> parking_lot::MutexGuard<'_, T> { let start = Instant::now(); let guard = self.lock.lock(); let elapsed = start.elapsed(); diff --git a/node/src/launcher.rs b/node/src/launcher.rs index 4441131a52e..533d04aba28 100644 --- a/node/src/launcher.rs +++ b/node/src/launcher.rs @@ -294,12 +294,8 @@ fn build_subgraph_registrar( ); // Create IPFS-based subgraph provider - let subgraph_provider = IpfsSubgraphAssignmentProvider::new( - &logger_factory, - link_resolver.clone(), - subgraph_instance_manager, - sg_count, - ); + let subgraph_provider = + IpfsSubgraphAssignmentProvider::new(&logger_factory, subgraph_instance_manager, sg_count); // Check version switching mode environment variable let version_switching_mode = ENV_VARS.subgraph_version_switching_mode; diff --git a/node/src/manager/commands/run.rs b/node/src/manager/commands/run.rs index 5a767eaa125..003fac69ae9 100644 --- a/node/src/manager/commands/run.rs +++ b/node/src/manager/commands/run.rs @@ -158,7 +158,6 @@ pub async fn run( // Create IPFS-based subgraph provider let subgraph_provider = Arc::new(IpfsSubgraphAssignmentProvider::new( &logger_factory, - link_resolver.cheap_clone(), subgraph_instance_manager, sg_metrics, )); diff --git a/runtime/wasm/src/module/instance.rs b/runtime/wasm/src/module/instance.rs index 63845e81c60..cddac22f9fc 100644 --- a/runtime/wasm/src/module/instance.rs +++ b/runtime/wasm/src/module/instance.rs @@ -141,7 +141,7 @@ impl WasmInstance { self.store.into_data() } - pub(crate) fn instance_ctx(&mut self) -> WasmInstanceContext { + pub(crate) fn instance_ctx(&mut self) -> WasmInstanceContext<'_> { WasmInstanceContext::new(&mut self.store) } diff --git a/runtime/wasm/src/to_from/external.rs b/runtime/wasm/src/to_from/external.rs index 6bb7122613f..3f19716f487 100644 --- a/runtime/wasm/src/to_from/external.rs +++ b/runtime/wasm/src/to_from/external.rs @@ -466,6 +466,7 @@ where } #[derive(Debug, Clone, Eq, PartialEq, AscType)] +#[allow(dead_code)] pub enum AscSubgraphEntityOp { Create, Modify, diff --git a/store/postgres/src/relational/dsl.rs b/store/postgres/src/relational/dsl.rs index e804a4d06ca..13cab9dd9d0 100644 --- a/store/postgres/src/relational/dsl.rs +++ b/store/postgres/src/relational/dsl.rs @@ -176,7 +176,7 @@ impl<'a> Table<'a> { } /// Reference a column in this table and use the correct SQL type `ST` - fn bind(&self, name: &str) -> Option> { + fn bind(&self, name: &str) -> Option> { self.column(name).map(|c| c.bind()) } diff --git a/store/postgres/src/relational_queries.rs b/store/postgres/src/relational_queries.rs index 533990c42b9..79d96edd30c 100644 --- a/store/postgres/src/relational_queries.rs +++ b/store/postgres/src/relational_queries.rs @@ -4964,6 +4964,7 @@ impl<'a, Conn> RunQueryDsl for CountCurrentVersionsQuery<'a> {} /// Helper struct for returning the id's touched by the RevertRemove and /// RevertExtend queries #[derive(QueryableByName, PartialEq, Eq, Hash)] +#[allow(dead_code)] pub struct CopyVid { #[diesel(sql_type = BigInt)] pub vid: i64, diff --git a/store/postgres/src/subgraph_store.rs b/store/postgres/src/subgraph_store.rs index 28fe5bba514..2cb2df8a0d6 100644 --- a/store/postgres/src/subgraph_store.rs +++ b/store/postgres/src/subgraph_store.rs @@ -789,7 +789,7 @@ impl SubgraphStoreInner { /// connections can deadlock the entire process if the pool runs out /// of connections in between getting the first one and trying to get the /// second one. - pub(crate) fn primary_conn(&self) -> Result { + pub(crate) fn primary_conn(&self) -> Result, StoreError> { let conn = self.mirror.primary().get()?; Ok(primary::Connection::new(conn)) } diff --git a/store/postgres/src/writable.rs b/store/postgres/src/writable.rs index 74b516433b6..9c512e27ae7 100644 --- a/store/postgres/src/writable.rs +++ b/store/postgres/src/writable.rs @@ -49,7 +49,7 @@ use crate::{primary, primary::Site, relational::Layout, SubgraphStore}; struct WritableSubgraphStore(SubgraphStore); impl WritableSubgraphStore { - fn primary_conn(&self) -> Result { + fn primary_conn(&self) -> Result, StoreError> { self.0.primary_conn() } diff --git a/tests/src/fixture/mod.rs b/tests/src/fixture/mod.rs index 86b67918673..e7de6a59460 100644 --- a/tests/src/fixture/mod.rs +++ b/tests/src/fixture/mod.rs @@ -574,7 +574,6 @@ pub async fn setup_inner( // Create IPFS-based subgraph provider let subgraph_provider = Arc::new(IpfsSubgraphAssignmentProvider::new( &logger_factory, - link_resolver.cheap_clone(), subgraph_instance_manager.clone(), sg_count, ));