Skip to content

Commit

Permalink
chore(deps): update rust crate thegraph-core to v0.8.5
Browse files Browse the repository at this point in the history
Signed-off-by: Lorenzo Delgado <[email protected]>
  • Loading branch information
LNSD committed Nov 27, 2024
1 parent 3e8df7f commit 1319dee
Show file tree
Hide file tree
Showing 29 changed files with 952 additions and 170 deletions.
1,006 changes: 881 additions & 125 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ inherits = "release"
debug = true

[dependencies]
alloy = { version = "0.5.4", features = ["contract", "signer-local"] }
anyhow = "1.0"
axum = { version = "0.7.7", default-features = false, features = [
"json",
Expand All @@ -25,7 +24,6 @@ faster-hex = "0.10.0"
futures = "0.3"
graphql = { git = "https://github.com/edgeandnode/toolshed", tag = "graphql-v0.3.0", default-features = false }
headers = "0.4.0"
hex = "0.4"
hickory-resolver = "0.24.0"
http = "1.1.0"
indexer-selection = { git = "https://github.com/edgeandnode/candidate-selection", rev = "c3a9ee8" }
Expand All @@ -52,8 +50,8 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0.116", features = ["raw_value"] }
serde_with = "3.8.1"
snmalloc-rs = "0.3"
tap_core = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", rev = "61b47b3" }
thegraph-core = { version = "0.7.0", features = ["serde"] }
tap_core = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", rev = "f680f4c" }
thegraph-core = { version = "0.8.5", features = ["alloy-contract", "alloy-signer-local", "attestation", "serde"] }
thegraph-graphql-http = { version = "0.2.1", features = [
"http-client-reqwest",
] }
Expand Down
2 changes: 1 addition & 1 deletion src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ pub fn is_domain_authorized<S: AsRef<str>>(authorized: &[S], origin: &str) -> bo

#[cfg(test)]
mod tests {
use alloy::primitives::hex;
use thegraph_core::alloy::primitives::hex;

use super::{is_domain_authorized, parse_api_key};

Expand Down
4 changes: 2 additions & 2 deletions src/block_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use graphql::{
};
use itertools::Itertools as _;
use serde_json::{self, json};
use thegraph_core::{BlockHash, BlockNumber};
use thegraph_core::alloy::primitives::{BlockHash, BlockNumber};

use crate::{blocks::BlockConstraint, chain::Chain, errors::Error};

Expand Down Expand Up @@ -298,7 +298,7 @@ fn parse_number<'c, T: Text<'c>>(
mod tests {
use std::iter::FromIterator as _;

use alloy::primitives::hex;
use thegraph_core::alloy::primitives::hex;

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion src/blocks.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::Deserialize;
use thegraph_core::{BlockHash, BlockNumber, BlockTimestamp};
use thegraph_core::alloy::primitives::{BlockHash, BlockNumber, BlockTimestamp};

#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Deserialize)]
pub struct Block {
Expand Down
8 changes: 5 additions & 3 deletions src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
iter,
};

use thegraph_core::{BlockHash, IndexerId};
use thegraph_core::{alloy::primitives::BlockHash, IndexerId};

use crate::blocks::Block;

Expand Down Expand Up @@ -107,12 +107,14 @@ impl Chain {

#[cfg(test)]
mod tests {
use alloy::primitives::U256;
use itertools::Itertools;
use rand::{
rngs::SmallRng, seq::SliceRandom as _, thread_rng, Rng as _, RngCore as _, SeedableRng,
};
use thegraph_core::{Address, BlockHash, IndexerId};
use thegraph_core::{
alloy::primitives::{Address, BlockHash, U256},
IndexerId,
};

use super::{Block, Chain, MAX_LEN};
use crate::concat_bytes;
Expand Down
2 changes: 1 addition & 1 deletion src/client_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use prost::bytes::Buf;
use rand::{thread_rng, Rng as _};
use serde::Deserialize;
use serde_json::value::RawValue;
use thegraph_core::{AllocationId, BlockNumber, DeploymentId, IndexerId};
use thegraph_core::{alloy::primitives::BlockNumber, AllocationId, DeploymentId, IndexerId};
use tokio::sync::mpsc;
use tracing::{info_span, Instrument as _};
use url::Url;
Expand Down
4 changes: 2 additions & 2 deletions src/client_query/attestation_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use axum::http::{HeaderName, HeaderValue};
use headers::Error;
use thegraph_core::Attestation;
use thegraph_core::attestation::Attestation;

static GRAPH_ATTESTATION_HEADER_NAME: HeaderName = HeaderName::from_static("graph-attestation");

Expand Down Expand Up @@ -77,7 +77,7 @@ impl headers::Header for GraphAttestation {
mod tests {
use assert_matches::assert_matches;
use headers::{Header, HeaderValue};
use thegraph_core::Attestation;
use thegraph_core::attestation::Attestation;

use super::GraphAttestation;

Expand Down
2 changes: 1 addition & 1 deletion src/client_query/context.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy::dyn_abi::Eip712Domain;
use ordered_float::NotNan;
use thegraph_core::alloy::dyn_abi::Eip712Domain;
use tokio::sync::{mpsc, watch};

use crate::{
Expand Down
6 changes: 4 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ use std::{
path::{Path, PathBuf},
};

use alloy::primitives::{B256, U256};
use anyhow::Context;
use ipnetwork::IpNetwork;
use ordered_float::NotNan;
use semver::Version;
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr};
use thegraph_core::{Address, BlockNumber, DeploymentId};
use thegraph_core::{
alloy::primitives::{Address, BlockNumber, B256, U256},
DeploymentId,
};
use url::Url;

use crate::{auth::APIKey, network::subgraph_client::TrustedIndexer};
Expand Down
2 changes: 1 addition & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{

use axum::response::{IntoResponse, Response};
use itertools::Itertools as _;
use thegraph_core::{BlockNumber, IndexerId};
use thegraph_core::{alloy::primitives::BlockNumber, IndexerId};

use crate::graphql;

Expand Down
6 changes: 4 additions & 2 deletions src/exchange_rate.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use std::{sync::Arc, time::Duration};

use alloy::{primitives::Address, providers::ProviderBuilder, sol, transports::http::Http};
use anyhow::ensure;
use ordered_float::NotNan;
use thegraph_core::alloy::{
primitives::Address, providers::ProviderBuilder, sol, transports::http::Http,
};
use tokio::{
sync::watch,
time::{interval, MissedTickBehavior},
Expand All @@ -17,7 +19,7 @@ sol!(
);

// TODO: figure out how to erase this type
type Provider = alloy::providers::RootProvider<Http<reqwest::Client>>;
type Provider = thegraph_core::alloy::providers::RootProvider<Http<reqwest::Client>>;

pub async fn grt_per_usd(provider: Url) -> watch::Receiver<NotNan<f64>> {
// https://data.chain.link/feeds/arbitrum/mainnet/grt-usd
Expand Down
6 changes: 4 additions & 2 deletions src/indexer_client.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use alloy::dyn_abi::Eip712Domain;
use reqwest::header::AUTHORIZATION;
use serde::{Deserialize, Serialize};
use thegraph_core::{
alloy::{
dyn_abi::Eip712Domain,
primitives::{BlockHash, BlockNumber},
},
attestation::{self, Attestation},
BlockHash, BlockNumber,
};
use thegraph_graphql_http::http::response::Error as GQLError;
use url::Url;
Expand Down
2 changes: 1 addition & 1 deletion src/indexers/indexing_progress.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Deserialize;
use serde_with::serde_as;
use thegraph_core::{BlockNumber, DeploymentId};
use thegraph_core::{alloy::primitives::BlockNumber, DeploymentId};
use thegraph_graphql_http::{
graphql::{Document, IntoDocument, IntoDocumentWithVariables},
http_client::{RequestError, ReqwestExt as _, ResponseError},
Expand Down
4 changes: 2 additions & 2 deletions src/indexers/public_poi.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr};
use thegraph_core::{BlockNumber, DeploymentId, ProofOfIndexing};
use thegraph_core::{alloy::primitives::BlockNumber, DeploymentId, ProofOfIndexing};
use thegraph_graphql_http::{
graphql::{Document, IntoDocument, IntoDocumentWithVariables},
http_client::{RequestError, ReqwestExt, ResponseError},
Expand Down Expand Up @@ -133,7 +133,7 @@ pub struct PartialBlockPtr {

#[cfg(test)]
mod tests {
use thegraph_core::{deployment_id, poi};
use thegraph_core::{deployment_id, proof_of_indexing as poi};

use super::Response;

Expand Down
2 changes: 1 addition & 1 deletion src/indexing_performance.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{collections::HashMap, ops::Deref, time::Duration};

use parking_lot::RwLock;
use thegraph_core::{BlockNumber, DeploymentId, IndexerId};
use thegraph_core::{alloy::primitives::BlockNumber, DeploymentId, IndexerId};
use tokio::{self, sync::mpsc, time::MissedTickBehavior};

use crate::network::NetworkService;
Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use std::{
time::Duration,
};

use alloy::{dyn_abi::Eip712Domain, signers::local::PrivateKeySigner};
use auth::AuthContext;
use axum::{
extract::DefaultBodyLimit,
Expand All @@ -56,7 +55,10 @@ use middleware::{
use network::subgraph_client::Client as SubgraphClient;
use prometheus::{self, Encoder as _};
use receipts::ReceiptSigner;
use thegraph_core::{attestation, ChainId};
use thegraph_core::{
alloy::{dyn_abi::Eip712Domain, primitives::ChainId, signers::local::PrivateKeySigner},
attestation,
};
use tokio::{net::TcpListener, signal::unix::SignalKind, sync::watch};
use tower_http::cors::{self, CorsLayer};
use tracing_subscriber::{prelude::*, EnvFilter};
Expand Down
2 changes: 1 addition & 1 deletion src/network/indexer_indexing_poi_blocklist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use std::collections::{HashMap, HashSet};

use thegraph_core::{BlockNumber, DeploymentId, ProofOfIndexing};
use thegraph_core::{alloy::primitives::BlockNumber, DeploymentId, ProofOfIndexing};

use crate::config::BlockedPoi;

Expand Down
2 changes: 1 addition & 1 deletion src/network/indexer_indexing_poi_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use std::{collections::HashMap, time::Duration};

use parking_lot::RwLock;
use thegraph_core::{BlockNumber, DeploymentId, ProofOfIndexing};
use thegraph_core::{alloy::primitives::BlockNumber, DeploymentId, ProofOfIndexing};
use url::Url;

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion src/network/indexer_indexing_progress_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::{collections::HashMap, time::Duration};

use parking_lot::{Mutex, RwLock};
use thegraph_core::{BlockNumber, DeploymentId};
use thegraph_core::{alloy::primitives::BlockNumber, DeploymentId};
use url::Url;

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion src/network/internal/indexer_processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::{HashMap, HashSet};
use custom_debug::CustomDebug;
use ipnetwork::IpNetwork;
use semver::Version;
use thegraph_core::{AllocationId, BlockNumber, DeploymentId, IndexerId};
use thegraph_core::{alloy::primitives::BlockNumber, AllocationId, DeploymentId, IndexerId};
use tracing::Instrument;
use url::Url;

Expand Down
4 changes: 3 additions & 1 deletion src/network/internal/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ use std::{

use custom_debug::CustomDebug;
use semver::Version;
use thegraph_core::{AllocationId, BlockNumber, DeploymentId, IndexerId, SubgraphId};
use thegraph_core::{
alloy::primitives::BlockNumber, AllocationId, DeploymentId, IndexerId, SubgraphId,
};
use url::Url;

use super::{DeploymentInfo, SubgraphInfo};
Expand Down
2 changes: 1 addition & 1 deletion src/network/internal/state.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::{BTreeMap, HashSet};

use ipnetwork::IpNetwork;
use thegraph_core::Address;
use thegraph_core::alloy::primitives::Address;

use crate::{
config::BlockedIndexer,
Expand Down
2 changes: 1 addition & 1 deletion src/network/internal/subgraph_processing.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::{HashMap, HashSet};

use thegraph_core::{BlockNumber, DeploymentId, IndexerId, SubgraphId};
use thegraph_core::{alloy::primitives::BlockNumber, DeploymentId, IndexerId, SubgraphId};

use crate::network::errors::{DeploymentError, SubgraphError};

Expand Down
5 changes: 4 additions & 1 deletion src/network/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ use std::{

use ipnetwork::IpNetwork;
use semver::Version;
use thegraph_core::{Address, BlockNumber, DeploymentId, SubgraphId};
use thegraph_core::{
alloy::primitives::{Address, BlockNumber},
DeploymentId, SubgraphId,
};
use tokio::{sync::watch, time::MissedTickBehavior};

use super::{
Expand Down
6 changes: 4 additions & 2 deletions src/network/subgraph_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use custom_debug::CustomDebug;
use serde::{ser::SerializeMap, Deserialize, Serialize, Serializer};
use serde_json::json;
use serde_with::serde_as;
use thegraph_core::{BlockHash, BlockNumber, BlockTimestamp};
use thegraph_core::alloy::primitives::{BlockHash, BlockNumber, BlockTimestamp};
use thegraph_graphql_http::http::response::Error as GqlError;
use types::Subgraph;
use url::Url;
Expand All @@ -33,7 +33,9 @@ use crate::{
pub mod types {
use serde::Deserialize;
use serde_with::serde_as;
use thegraph_core::{AllocationId, BlockNumber, DeploymentId, IndexerId, SubgraphId};
use thegraph_core::{
alloy::primitives::BlockNumber, AllocationId, DeploymentId, IndexerId, SubgraphId,
};

#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down
20 changes: 16 additions & 4 deletions src/receipts.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
use std::{collections::HashMap, sync::Arc, time::SystemTime};

use alloy::{dyn_abi::Eip712Domain, primitives::U256, signers::local::PrivateKeySigner};
use parking_lot::{Mutex, RwLock};
use rand::RngCore;
pub use receipts::QueryStatus as ReceiptStatus;
use receipts::ReceiptPool;
use secp256k1::SecretKey;
use tap_core::{receipt::Receipt as TapReceipt, signed_message::EIP712SignedMessage};
use thegraph_core::{Address, AllocationId};
use thegraph_core::{
alloy::{
dyn_abi::Eip712Domain,
primitives::{Address, U256},
signers::local::PrivateKeySigner,
},
AllocationId,
};

/// A receipt for an indexer request.
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -211,7 +217,10 @@ impl ReceiptSigner {

#[cfg(test)]
mod tests {
use thegraph_core::{address, allocation_id};
use thegraph_core::{
allocation_id,
alloy::{primitives::address, signers::local::PrivateKeySigner},
};

use super::*;

Expand Down Expand Up @@ -271,7 +280,10 @@ mod tests {
}

mod tap {
use thegraph_core::{address, allocation_id};
use thegraph_core::{
allocation_id,
alloy::{primitives::address, signers::local::PrivateKeySigner},
};

use super::*;

Expand Down
2 changes: 1 addition & 1 deletion src/reports.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::{anyhow, Context};
use ordered_float::NotNan;
use prost::Message;
use thegraph_core::{Address, AllocationId, DeploymentId, IndexerId};
use thegraph_core::{alloy::primitives::Address, AllocationId, DeploymentId, IndexerId};
use tokio::sync::mpsc;

use crate::{concat_bytes, errors, indexer_client::IndexerResponse, receipts::Receipt};
Expand Down
Loading

0 comments on commit 1319dee

Please sign in to comment.