diff --git a/graph/src/components/subgraph/proof_of_indexing/mod.rs b/graph/src/components/subgraph/proof_of_indexing/mod.rs index 36eeabc22cd..718a3a5cecd 100644 --- a/graph/src/components/subgraph/proof_of_indexing/mod.rs +++ b/graph/src/components/subgraph/proof_of_indexing/mod.rs @@ -81,6 +81,7 @@ impl SharedProofOfIndexing { #[cfg(test)] mod tests { use super::*; + use crate::util::stable_hash_glue::{impl_stable_hash, AsBytes}; use crate::{ data::store::Id, prelude::{BlockPtr, DeploymentHash, Value}, @@ -97,6 +98,33 @@ mod tests { use std::convert::TryInto; use web3::types::{Address, H256}; + /// The PoI is the StableHash of this struct. This reference implementation is + /// mostly here just to make sure that the online implementation is + /// 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. + pub struct PoI<'a> { + pub causality_regions: HashMap>, + pub subgraph_id: DeploymentHash, + pub block_hash: H256, + pub indexer: Option
, + } + + fn h256_as_bytes(val: &H256) -> AsBytes<&[u8]> { + AsBytes(val.as_bytes()) + } + + fn indexer_opt_as_bytes(val: &Option
) -> Option> { + val.as_ref().map(|v| AsBytes(v.as_bytes())) + } + + impl_stable_hash!(PoI<'_> { + causality_regions, + subgraph_id, + block_hash: h256_as_bytes, + indexer: indexer_opt_as_bytes + }); + /// Verify that the stable hash of a reference and online implementation match fn check(case: Case, cache: &mut HashMap) { let logger = Logger::root(Discard, o!()); diff --git a/graph/src/components/subgraph/proof_of_indexing/reference.rs b/graph/src/components/subgraph/proof_of_indexing/reference.rs index 3a11a4db4e3..31050a1c821 100644 --- a/graph/src/components/subgraph/proof_of_indexing/reference.rs +++ b/graph/src/components/subgraph/proof_of_indexing/reference.rs @@ -1,38 +1,5 @@ use super::ProofOfIndexingEvent; -use crate::prelude::DeploymentHash; -use crate::util::stable_hash_glue::{impl_stable_hash, AsBytes}; -use std::collections::HashMap; -use web3::types::{Address, H256}; - -/// The PoI is the StableHash of this struct. This reference implementation is -/// mostly here just to make sure that the online implementation is -/// 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, - pub block_hash: H256, - 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())) -} - -impl_stable_hash!(PoI<'_> { - causality_regions, - subgraph_id, - block_hash: h256_as_bytes, - indexer: indexer_opt_as_bytes -}); +use crate::util::stable_hash_glue::impl_stable_hash; pub struct PoICausalityRegion<'a> { pub blocks: Vec>, diff --git a/graph/src/data_source/offchain.rs b/graph/src/data_source/offchain.rs index 46a77e8ba32..bde499fc2d1 100644 --- a/graph/src/data_source/offchain.rs +++ b/graph/src/data_source/offchain.rs @@ -374,39 +374,6 @@ pub struct UnresolvedMapping { pub entities: Vec, } -impl UnresolvedDataSource { - #[allow(dead_code)] - pub(super) async fn resolve( - self, - resolver: &Arc, - logger: &Logger, - manifest_idx: u32, - causality_region: CausalityRegion, - schema: &InputSchema, - ) -> Result { - info!(logger, "Resolve offchain data source"; - "name" => &self.name, - "kind" => &self.kind, - "source" => format_args!("{:?}", &self.source), - ); - - let kind = OffchainDataSourceKind::from_str(self.kind.as_str())?; - let source = kind.try_parse_source(Bytes::from(self.source.file.link.as_bytes()))?; - - Ok(DataSource { - manifest_idx, - kind, - name: self.name, - source, - mapping: self.mapping.resolve(resolver, schema, logger).await?, - context: Arc::new(None), - creation_block: None, - done_at: Arc::new(AtomicI32::new(NOT_DONE_VALUE)), - causality_region, - }) - } -} - impl UnresolvedMapping { pub async fn resolve( self, diff --git a/graph/src/data_source/subgraph.rs b/graph/src/data_source/subgraph.rs index b1b83a5137b..b5a04363093 100644 --- a/graph/src/data_source/subgraph.rs +++ b/graph/src/data_source/subgraph.rs @@ -344,7 +344,6 @@ impl UnresolvedDataSource { Ok(()) } - #[allow(dead_code)] pub(super) async fn resolve( self, resolver: &Arc, diff --git a/graph/src/schema/input/mod.rs b/graph/src/schema/input/mod.rs index 634930c5731..15cdaa30478 100644 --- a/graph/src/schema/input/mod.rs +++ b/graph/src/schema/input/mod.rs @@ -1702,7 +1702,6 @@ mod validations { /// Helper struct for validations struct Schema<'a> { - #[allow(dead_code)] spec_version: &'a Version, schema: &'a BaseSchema, subgraph_schema_type: Option<&'a s::ObjectType>, diff --git a/graphql/src/store/resolver.rs b/graphql/src/store/resolver.rs index 8f5eaaccbd1..3fb8059988d 100644 --- a/graphql/src/store/resolver.rs +++ b/graphql/src/store/resolver.rs @@ -24,7 +24,6 @@ use crate::query::ext::BlockConstraint; /// A resolver that fetches entities from a `Store`. #[derive(Clone, CheapClone)] pub struct StoreResolver { - #[allow(dead_code)] logger: Logger, pub(crate) store: Arc, pub(crate) block_ptr: Option, diff --git a/runtime/wasm/src/error.rs b/runtime/wasm/src/error.rs index a52a49dcd7c..50e87acbc67 100644 --- a/runtime/wasm/src/error.rs +++ b/runtime/wasm/src/error.rs @@ -9,7 +9,6 @@ pub enum DeterminismLevel { Deterministic, /// This error is known to be non-deterministic. For example, an intermittent http failure. - #[allow(dead_code)] NonDeterministic, /// The runtime is processing a given block, but there is an indication that the blockchain client diff --git a/runtime/wasm/src/to_from/external.rs b/runtime/wasm/src/to_from/external.rs index 3f19716f487..046f9d4433a 100644 --- a/runtime/wasm/src/to_from/external.rs +++ b/runtime/wasm/src/to_from/external.rs @@ -10,7 +10,6 @@ use graph::runtime::{ use graph::{data::store, runtime::DeterministicHostError}; use graph::{prelude::serde_json, runtime::FromAscObj}; use graph::{prelude::web3::types as web3, runtime::AscHeap}; -use graph_runtime_derive::AscType; use crate::asc_abi::class::*; @@ -465,14 +464,6 @@ where } } -#[derive(Debug, Clone, Eq, PartialEq, AscType)] -#[allow(dead_code)] -pub enum AscSubgraphEntityOp { - Create, - Modify, - Delete, -} - impl ToAscObj> for serde_yaml::Value { fn to_asc_obj( &self, diff --git a/server/index-node/src/resolver.rs b/server/index-node/src/resolver.rs index 61a273e353a..13379aa6959 100644 --- a/server/index-node/src/resolver.rs +++ b/server/index-node/src/resolver.rs @@ -98,7 +98,6 @@ pub struct IndexNodeResolver { logger: Logger, blockchain_map: Arc, store: Arc, - #[allow(dead_code)] link_resolver: Arc, bearer_token: Option, } diff --git a/store/postgres/src/chain_head_listener.rs b/store/postgres/src/chain_head_listener.rs index 301c1f19209..1880b343c3d 100644 --- a/store/postgres/src/chain_head_listener.rs +++ b/store/postgres/src/chain_head_listener.rs @@ -40,7 +40,6 @@ impl Watcher { } } - #[allow(dead_code)] fn send(&self) { // Unwrap: `self` holds a receiver. self.sender.send(()).unwrap() diff --git a/store/postgres/src/deployment.rs b/store/postgres/src/deployment.rs index 4b3da58469d..340d80d1184 100644 --- a/store/postgres/src/deployment.rs +++ b/store/postgres/src/deployment.rs @@ -30,15 +30,12 @@ use graph::{ schema::InputSchema, }; use graph::{ - data::subgraph::{ - schema::{DeploymentCreate, SubgraphManifestEntity}, - SubgraphFeature, - }, + data::subgraph::schema::{DeploymentCreate, SubgraphManifestEntity}, util::backoff::ExponentialBackoff, }; use stable_hash_legacy::crypto::SetHasher; -use std::{collections::BTreeSet, convert::TryFrom, ops::Bound, time::Duration}; -use std::{str::FromStr, sync::Arc}; +use std::sync::Arc; +use std::{convert::TryFrom, ops::Bound, time::Duration}; use crate::ForeignServer; use crate::{block_range::BLOCK_RANGE_COLUMN, primary::Site}; @@ -403,24 +400,6 @@ pub fn set_history_blocks( .map_err(StoreError::from) } -#[allow(dead_code)] -pub fn features( - conn: &mut PgConnection, - site: &Site, -) -> Result, StoreError> { - use subgraph_manifest as sm; - - let features: Vec = sm::table - .select(sm::features) - .filter(sm::id.eq(site.id)) - .first(conn) - .unwrap(); - features - .iter() - .map(|f| SubgraphFeature::from_str(f).map_err(StoreError::from)) - .collect() -} - /// This migrates subgraphs that existed before the raw_yaml column was added. pub fn set_manifest_raw_yaml( conn: &mut PgConnection, diff --git a/store/postgres/src/relational_queries.rs b/store/postgres/src/relational_queries.rs index 0295ed24cab..aa439e4c1c3 100644 --- a/store/postgres/src/relational_queries.rs +++ b/store/postgres/src/relational_queries.rs @@ -4973,15 +4973,6 @@ impl<'a> Query for CountCurrentVersionsQuery<'a> { 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, -} - fn write_column_names( column_names: &AttributeNames, table: dsl::Table<'_>,