Skip to content

Commit

Permalink
build(deps): Use thegraph::types::Address (0.5.0) instead of alloy's …
Browse files Browse the repository at this point in the history
…directly

Signed-off-by: Alexis Asseman <[email protected]>
  • Loading branch information
aasseman committed Feb 5, 2024
1 parent d16470f commit 633ceec
Show file tree
Hide file tree
Showing 27 changed files with 228 additions and 108 deletions.
220 changes: 176 additions & 44 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2021"

[dependencies]
alloy-primitives = { version = "0.5.2", features = ["serde"] }
alloy-sol-types = "0.5.2"
alloy-primitives = { version = "0.6", features = ["serde"] }
alloy-sol-types = "0.6"
anyhow = "1.0.75"
arc-swap = "1.6.0"
ethers = "2.0.10"
Expand All @@ -30,11 +30,11 @@ sqlx = { version = "0.7.1", features = [
"time",
] }
tokio = { version = "1.32.0", features = ["full", "macros", "rt"] }
thegraph = { git = "https://github.com/edgeandnode/toolshed", branch = "main" }
thegraph = { git = "https://github.com/edgeandnode/toolshed", tag = "thegraph-v0.5.0" }
graphql-http = { git = "https://github.com/edgeandnode/toolshed", branch = "main", features = [
"http-reqwest",
] }
tap_core = "0.7.0"
tap_core = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", branch = "aasseman/tap_core_0_7_0_fix_toolshed_dep" }
axum = { version = "0.6.20", default_features = true, features = ["headers"] }
thiserror = "1.0.49"
async-trait = "0.1.74"
Expand Down
2 changes: 1 addition & 1 deletion common/src/allocations/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright 2023-, GraphOps and Semiotic Labs.
// SPDX-License-Identifier: Apache-2.0

use alloy_primitives::Address;
use ethers_core::types::U256;
use serde::{Deserialize, Deserializer};
use thegraph::types::Address;
use thegraph::types::DeploymentId;

pub mod monitor;
Expand Down
2 changes: 1 addition & 1 deletion common/src/allocations/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

use std::{collections::HashMap, time::Duration};

use alloy_primitives::Address;
use anyhow::anyhow;
use eventuals::{timer, Eventual, EventualExt};
use serde::Deserialize;
use thegraph::types::Address;
use tokio::time::sleep;
use tracing::warn;

Expand Down
2 changes: 1 addition & 1 deletion common/src/attestations/dispute_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

use std::time::Duration;

use alloy_primitives::Address;
use eventuals::{timer, Eventual, EventualExt};
use serde::Deserialize;
use thegraph::types::Address;
use tokio::time::sleep;
use tracing::warn;

Expand Down
3 changes: 1 addition & 2 deletions common/src/attestations/signer.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright 2023-, GraphOps and Semiotic Labs.
// SPDX-License-Identifier: Apache-2.0

use alloy_primitives::{Address, U256};
use alloy_sol_types::Eip712Domain;
use ethers::signers::coins_bip39::English;
use ethers::signers::{MnemonicBuilder, Signer, Wallet};
use ethers_core::k256::ecdsa::SigningKey;
use thegraph::types::{attestation, Attestation, DeploymentId};
use thegraph::types::{Address, U256};

use crate::prelude::Allocation;

Expand Down Expand Up @@ -124,7 +124,6 @@ fn wallet_for_allocation(

#[cfg(test)]
mod tests {
use alloy_primitives::Address;
use ethers_core::types::U256;
use std::str::FromStr;
use test_log::test;
Expand Down
4 changes: 1 addition & 3 deletions common/src/attestations/signers.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2023-, GraphOps and Semiotic Labs.
// SPDX-License-Identifier: Apache-2.0

use alloy_primitives::Address;
use ethers_core::types::U256;
use eventuals::{join, Eventual, EventualExt};
use std::collections::HashMap;
use std::sync::Arc;
use thegraph::types::Address;
use tokio::sync::Mutex;
use tracing::warn;

Expand Down Expand Up @@ -61,8 +61,6 @@ pub fn attestation_signers(

#[cfg(test)]
mod tests {
use alloy_primitives::Address;

use crate::test_vectors::{
DISPUTE_MANAGER_ADDRESS, INDEXER_ALLOCATIONS, INDEXER_OPERATOR_MNEMONIC,
};
Expand Down
2 changes: 1 addition & 1 deletion common/src/escrow_accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use std::{
time::Duration,
};

use alloy_primitives::Address;
use anyhow::Result;
use ethers_core::types::U256;
use eventuals::{timer, Eventual, EventualExt};
use serde::Deserialize;
use thegraph::types::Address;
use thiserror::Error;
use tokio::time::sleep;
use tracing::{error, warn};
Expand Down
2 changes: 1 addition & 1 deletion common/src/indexer_service/http/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

use std::net::SocketAddr;

use alloy_primitives::Address;
use serde::{Deserialize, Serialize};
use thegraph::types::Address;
use thegraph::types::DeploymentId;

#[derive(Clone, Debug, Deserialize, Serialize)]
Expand Down
2 changes: 1 addition & 1 deletion common/src/indexer_service/http/indexer_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::{
time::Duration,
};

use alloy_primitives::Address;
use alloy_sol_types::eip712_domain;
use anyhow;
use autometrics::prometheus_exporter;
Expand All @@ -23,6 +22,7 @@ use eventuals::Eventual;
use reqwest::StatusCode;
use serde::{de::DeserializeOwned, Serialize};
use sqlx::postgres::PgPoolOptions;
use thegraph::types::Address;
use thegraph::types::{Attestation, DeploymentId};
use thiserror::Error;
use tokio::signal;
Expand Down
2 changes: 1 addition & 1 deletion common/src/indexer_service/http/scalar_receipt_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ impl Header for ScalarReceipt {
mod test {
use std::str::FromStr;

use alloy_primitives::Address;
use axum::{headers::Header, http::HeaderValue};
use thegraph::types::Address;

use crate::test_vectors::create_signed_receipt;

Expand Down
2 changes: 1 addition & 1 deletion common/src/signature_verification.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright 2023-, GraphOps and Semiotic Labs.
// SPDX-License-Identifier: Apache-2.0

use alloy_primitives::Address;
use arc_swap::ArcSwap;
use keccak_hash::keccak;
use lazy_static::lazy_static;
use secp256k1::{ecdsa::RecoverableSignature, Message, PublicKey, Secp256k1, VerifyOnly};
use std::sync::Arc;
use thegraph::types::Address;

lazy_static! {
static ref SECP256K1: Secp256k1<VerifyOnly> = Secp256k1::verification_only();
Expand Down
3 changes: 1 addition & 2 deletions common/src/tap_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0

use alloy_primitives::hex::ToHex;
use alloy_primitives::Address;
use alloy_sol_types::Eip712Domain;
use anyhow::anyhow;
use ethers_core::types::U256;
Expand All @@ -12,6 +11,7 @@ use sqlx::{types::BigDecimal, PgPool};
use std::collections::HashSet;
use std::{collections::HashMap, str::FromStr, sync::Arc};
use tap_core::tap_manager::SignedReceipt;
use thegraph::types::Address;
use tokio::sync::RwLock;
use tracing::error;

Expand Down Expand Up @@ -246,7 +246,6 @@ mod test {
use std::str::FromStr;

use crate::prelude::{AllocationStatus, SubgraphDeployment};
use alloy_primitives::Address;
use keccak_hash::H256;
use sqlx::postgres::PgListener;

Expand Down
26 changes: 9 additions & 17 deletions common/src/test_vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

use std::{collections::HashMap, str::FromStr};

use alloy_primitives::Address;
use alloy_sol_types::{eip712_domain, Eip712Domain};
use ethers::signers::{coins_bip39::English, LocalWallet, MnemonicBuilder, Signer};
use ethers_core::types::U256;
use lazy_static::lazy_static;
use tap_core::{
eip_712_signed_message::EIP712SignedMessage, tap_manager::SignedReceipt, tap_receipt::Receipt,
};
use thegraph::types::Address;
use thegraph::types::DeploymentId;

use crate::prelude::{Allocation, AllocationStatus, SubgraphDeployment};
Expand Down Expand Up @@ -166,11 +166,9 @@ lazy_static! {
created_at_epoch: 953,
closed_at_epoch: None,
subgraph_deployment: SubgraphDeployment {
id: DeploymentId(
id: DeploymentId::from_str(
"0xbbde25a2c85f55b53b7698b9476610c3d1202d88870e66502ab0076b7218f98a"
.parse()
.unwrap(),
),
).unwrap(),
denied_at: Some(0),
},
status: AllocationStatus::Null,
Expand All @@ -192,11 +190,9 @@ lazy_static! {
created_at_epoch: 953,
closed_at_epoch: None,
subgraph_deployment: SubgraphDeployment {
id: DeploymentId(
id: DeploymentId::from_str(
"0xcda7fa0405d6fd10721ed13d18823d24b535060d8ff661f862b26c23334f13bf"
.parse()
.unwrap(),
),
).unwrap(),
denied_at: Some(0),
},
status: AllocationStatus::Null,
Expand All @@ -218,11 +214,9 @@ lazy_static! {
created_at_epoch: 940,
closed_at_epoch: Some(953),
subgraph_deployment: SubgraphDeployment {
id: DeploymentId(
id: DeploymentId::from_str(
"0xbbde25a2c85f55b53b7698b9476610c3d1202d88870e66502ab0076b7218f98a"
.parse()
.unwrap(),
),
).unwrap(),
denied_at: Some(0),
},
status: AllocationStatus::Null,
Expand All @@ -244,11 +238,9 @@ lazy_static! {
created_at_epoch: 940,
closed_at_epoch: Some(953),
subgraph_deployment: SubgraphDeployment {
id: DeploymentId(
id: DeploymentId::from_str(
"0xc064c354bc21dd958b1d41b67b8ef161b75d2246b425f68ed4c74964ae705cbd"
.parse()
.unwrap(),
),
).unwrap(),
denied_at: Some(0),
},
status: AllocationStatus::Null,
Expand Down
8 changes: 4 additions & 4 deletions service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ autometrics = { version = "0.3.3", features = ["prometheus-exporter"] }
clap = { version = "4.3.1", features = ["derive", "env"] }
prometheus = "0.13.3"
hex = "0.4.3"
tap_core = "0.7.0"
tap_core = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", branch = "aasseman/tap_core_0_7_0_fix_toolshed_dep" }
ethereum-types = "0.14.1"
sqlx = { version = "0.7.1", features = [
"postgres",
Expand All @@ -54,10 +54,10 @@ sqlx = { version = "0.7.1", features = [
"rust_decimal",
"time",
] }
alloy-primitives = { version = "0.5.2", features = ["serde"] }
alloy-sol-types = "0.5.2"
alloy-primitives = { version = "0.6", features = ["serde"] }
alloy-sol-types = "0.6"
lazy_static = "1.4.0"
thegraph = { git = "https://github.com/edgeandnode/toolshed", branch = "main" }
thegraph = { git = "https://github.com/edgeandnode/toolshed", tag = "thegraph-v0.5.0" }
graphql = { git = "https://github.com/edgeandnode/toolshed", branch = "main" }
graphql-http = { git = "https://github.com/edgeandnode/toolshed", branch = "main", features = [
"http-reqwest",
Expand Down
9 changes: 4 additions & 5 deletions service/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,10 @@ mod test {
setup_cost_models_table(&pool).await;
add_cost_models(&pool, to_db_models(test_data())).await;

let deployment_id_from_bytes = DeploymentId(
"0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea"
.parse()
.unwrap(),
);
let deployment_id_from_bytes = DeploymentId::from_str(
"0xbd499f7673ca32ef4a642207a8bebdd0fb03888cf2678b298438e3a1ae5206ea",
)
.unwrap();
let deployment_id_from_hash =
DeploymentId::from_str("Qmb5Ysp5oCUXhLA8NmxmYKDAX2nCMnh7Vvb5uffb9n5vss").unwrap();

Expand Down
10 changes: 5 additions & 5 deletions tap-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ name = "indexer-tap-agent"
path = "src/main.rs"

[dependencies]
alloy-primitives = "0.5.2"
alloy-sol-types = "0.5.2"
alloy-primitives = "0.6"
alloy-sol-types = "0.6"
anyhow = "1.0.72"
async-trait = "0.1.72"
bigdecimal = { version = "0.4.2", features = ["serde"] }
Expand All @@ -32,11 +32,11 @@ sqlx = { version = "0.7.2", features = [
"bigdecimal",
"rust_decimal",
] }
tap_aggregator = "0.2.0"
tap_core = "0.7.0"
tap_aggregator = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", branch = "aasseman/tap_core_0_7_0_fix_toolshed_dep" }
tap_core = { git = "https://github.com/semiotic-ai/timeline-aggregation-protocol", branch = "aasseman/tap_core_0_7_0_fix_toolshed_dep" }
thiserror = "1.0.44"
tokio = { version = "1.33.0" }
thegraph = { git = "https://github.com/edgeandnode/toolshed", branch = "main" }
thegraph = { git = "https://github.com/edgeandnode/toolshed", tag = "thegraph-v0.5.0" }
graphql-http = { git = "https://github.com/edgeandnode/toolshed", branch = "main" }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3", features = [
Expand Down
2 changes: 1 addition & 1 deletion tap-agent/src/aggregator_endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::fs::File;
use std::io::BufReader;
use std::path::PathBuf;

use alloy_primitives::Address;
use thegraph::types::Address;

/// Load a hashmap of sender addresses and their corresponding aggregator endpoints
/// from a yaml file. We're using serde_yaml.
Expand Down
2 changes: 1 addition & 1 deletion tap-agent/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

use std::{path::PathBuf, str::FromStr};

use alloy_primitives::Address;
use bigdecimal::{BigDecimal, ToPrimitive};
use clap::{command, Args, Parser, ValueEnum};
use dotenvy::dotenv;
use serde::{Deserialize, Serialize};
use thegraph::types::Address;
use thegraph::types::DeploymentId;
use tracing::subscriber::{set_global_default, SetGlobalDefaultError};
use tracing_subscriber::{EnvFilter, FmtSubscriber};
Expand Down
2 changes: 1 addition & 1 deletion tap-agent/src/tap/escrow_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

use std::{collections::HashMap, sync::Arc};

use alloy_primitives::Address;
use async_trait::async_trait;
use eventuals::Eventual;
use indexer_common::escrow_accounts::EscrowAccounts;
use tap_core::adapters::escrow_adapter::EscrowAdapter as EscrowAdapterTrait;
use thegraph::types::Address;
use thiserror::Error;
use tokio::sync::RwLock;

Expand Down
3 changes: 2 additions & 1 deletion tap-agent/src/tap/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Copyright 2023-, GraphOps and Semiotic Labs.
// SPDX-License-Identifier: Apache-2.0

use alloy_primitives::{hex::ToHex, Address};
use alloy_primitives::hex::ToHex;
use anyhow::anyhow;
use eventuals::Eventual;
use indexer_common::escrow_accounts::EscrowAccounts;
use thegraph::types::Address;

mod escrow_adapter;
mod rav_storage_adapter;
Expand Down
2 changes: 1 addition & 1 deletion tap-agent/src/tap/rav_storage_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0

use alloy_primitives::hex::ToHex;
use alloy_primitives::Address;
use anyhow::Result;
use async_trait::async_trait;
use sqlx::PgPool;
use tap_core::adapters::rav_storage_adapter::RAVStorageAdapter as RAVStorageAdapterTrait;
use tap_core::tap_manager::SignedRAV;
use thegraph::types::Address;
use thiserror::Error;

#[derive(Debug)]
Expand Down
Loading

0 comments on commit 633ceec

Please sign in to comment.