Skip to content

Commit

Permalink
refactor(all): bump tap-core to 1.0.0
Browse files Browse the repository at this point in the history
Signed-off-by: Gustavo Inacio <[email protected]>
  • Loading branch information
gusinacio committed Aug 1, 2024
1 parent 45bddd5 commit 8a35da2
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 54 deletions.
31 changes: 3 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ thegraph = { git = "https://github.com/edgeandnode/toolshed", tag = "thegraph-v0
thegraph-graphql-http = { version = "0.2.1", features = [
"http-client-reqwest",
] }
tap_core = "0.8.0"
tap_core = "1.0.0"
axum = { version = "0.7.5", default_features = true }
axum-extra = { version = "0.9.3", features = ["typed-header"] }
thiserror = "1.0.49"
Expand All @@ -40,7 +40,11 @@ build-info = "0.0.34"
autometrics = { version = "1.0.1", features = ["prometheus-exporter"] }
tracing = "0.1.40"
tower_governor = "0.3.2"
tower-http = { version = "0.5.2", features = ["trace", "cors", "normalize-path"] }
tower-http = { version = "0.5.2", features = [
"trace",
"cors",
"normalize-path",
] }
tokio-util = "0.7.10"
bigdecimal = "0.4.2"
thegraph-core = { version = "0.5.2", features = ["subgraph-client"] }
Expand Down
4 changes: 2 additions & 2 deletions common/src/indexer_service/http/indexer_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use eventuals::Eventual;
use reqwest::StatusCode;
use serde::{de::DeserializeOwned, Serialize};
use sqlx::postgres::PgPoolOptions;
use tap_core::{manager::Manager, receipt::checks::Checks};
use tap_core::{manager::Manager, receipt::checks::CheckList};
use thegraph::types::Address;
use thegraph::types::{Attestation, DeploymentId};
use thiserror::Error;
Expand Down Expand Up @@ -306,7 +306,7 @@ impl IndexerService {
)
.await;

let tap_manager = Manager::new(domain_separator, indexer_context, Checks::new(checks));
let tap_manager = Manager::new(domain_separator, indexer_context, CheckList::new(checks));

let state = Arc::new(IndexerServiceState {
config: options.config.clone(),
Expand Down
3 changes: 2 additions & 1 deletion common/src/tap/checks/allocation_eligible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use eventuals::Eventual;

use tap_core::receipt::{
checks::{Check, CheckResult},
Checking, ReceiptWithState,
state::Checking,
ReceiptWithState,
};

use crate::prelude::Allocation;
Expand Down
3 changes: 2 additions & 1 deletion common/src/tap/checks/deny_list_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use std::sync::RwLock;
use std::{str::FromStr, sync::Arc};
use tap_core::receipt::{
checks::{Check, CheckResult},
Checking, ReceiptWithState,
state::Checking,
ReceiptWithState,
};
use thegraph::types::Address;
use tracing::error;
Expand Down
5 changes: 3 additions & 2 deletions common/src/tap/checks/receipt_max_val_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ pub struct ReceiptMaxValueCheck {

use tap_core::receipt::{
checks::{Check, CheckResult},
Checking, ReceiptWithState,
state::Checking,
ReceiptWithState,
};

impl ReceiptMaxValueCheck {
Expand Down Expand Up @@ -47,7 +48,7 @@ mod tests {

use super::*;
use tap_core::{
receipt::{checks::Check, Checking, Receipt, ReceiptWithState},
receipt::{checks::Check, state::Checking, Receipt, ReceiptWithState},
signed_message::EIP712SignedMessage,
};

Expand Down
3 changes: 2 additions & 1 deletion common/src/tap/checks/sender_balance_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use ethers_core::types::U256;
use eventuals::Eventual;
use tap_core::receipt::{
checks::{Check, CheckResult},
Checking, ReceiptWithState,
state::Checking,
ReceiptWithState,
};
use tracing::error;

Expand Down
5 changes: 3 additions & 2 deletions common/src/tap/checks/timestamp_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ pub struct TimestampCheck {

use tap_core::receipt::{
checks::{Check, CheckResult},
Checking, ReceiptWithState,
state::Checking,
ReceiptWithState,
};

impl TimestampCheck {
Expand Down Expand Up @@ -52,7 +53,7 @@ mod tests {

use super::*;
use tap_core::{
receipt::{checks::Check, Checking, Receipt, ReceiptWithState},
receipt::{checks::Check, state::Checking, Receipt, ReceiptWithState},
signed_message::EIP712SignedMessage,
};

Expand Down
2 changes: 1 addition & 1 deletion common/src/tap/receipt_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use bigdecimal::num_bigint::BigInt;
use sqlx::types::BigDecimal;
use tap_core::{
manager::adapters::ReceiptStore,
receipt::{Checking, ReceiptWithState},
receipt::{state::Checking, ReceiptWithState},
};
use tracing::error;

Expand Down
4 changes: 2 additions & 2 deletions tap-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ sqlx = { version = "0.7.2", features = [
"rust_decimal",
"chrono",
] }
tap_aggregator = "0.3.0"
tap_core = "0.8.0"
tap_aggregator = "0.3.1"
tap_core = "1.0.0"
thiserror = "1.0.44"
tokio = { version = "1.33.0" }
thegraph = { git = "https://github.com/edgeandnode/toolshed", tag = "thegraph-v0.5.0" }
Expand Down
20 changes: 13 additions & 7 deletions tap-agent/src/agent/sender_allocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ use tap_core::{
manager::adapters::RAVRead,
rav::{RAVRequest, ReceiptAggregateVoucher, SignedRAV},
receipt::{
checks::{Check, Checks},
Failed, ReceiptWithState,
checks::{Check, CheckList},
state::Failed,
ReceiptWithState,
},
signed_message::EIP712SignedMessage,
};
Expand Down Expand Up @@ -331,7 +332,7 @@ impl SenderAllocationState {
let tap_manager = TapManager::new(
domain_separator.clone(),
context,
Checks::new(required_checks),
CheckList::new(required_checks),
);

let http_client = HttpClientBuilder::default()
Expand Down Expand Up @@ -508,6 +509,10 @@ impl SenderAllocationState {
),
_ => e.into(),
})?;
let valid_receipts: Vec<_> = valid_receipts
.into_iter()
.map(|r| r.signed_receipt().clone())
.collect();
let rav_response_time_start = Instant::now();
let response: JsonRpcResponse<EIP712SignedMessage<ReceiptAggregateVoucher>> = self
.http_client
Expand Down Expand Up @@ -763,8 +768,9 @@ pub mod tests {
};
use tap_aggregator::{jsonrpsee_helpers::JsonRpcResponse, server::run_server};
use tap_core::receipt::{
checks::{Check, Checks},
Checking, ReceiptWithState,
checks::{Check, CheckList},
state::Checking,
ReceiptWithState,
};
use wiremock::{
matchers::{body_string_contains, method},
Expand Down Expand Up @@ -1348,7 +1354,7 @@ pub mod tests {
.await;
let mut state = SenderAllocationState::new(args).await.unwrap();

let checks = Checks::new(vec![Arc::new(FailingCheck)]);
let checks = CheckList::new(vec![Arc::new(FailingCheck)]);

// create some checks
let checking_receipts = vec![
Expand All @@ -1360,7 +1366,7 @@ pub mod tests {
.into_iter()
.map(|receipt| async { receipt.finalize_receipt_checks(&checks).await.unwrap_err() })
.collect::<Vec<_>>();
let failing_receipts = join_all(failing_receipts).await;
let failing_receipts: Vec<_> = join_all(failing_receipts).await;

// store the failing receipts
let result = state.store_invalid_receipts(&failing_receipts).await;
Expand Down
3 changes: 2 additions & 1 deletion tap-agent/src/tap/context/checks/allocation_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use eventuals::{Eventual, EventualExt};
use indexer_common::subgraph_client::{Query, SubgraphClient};
use tap_core::receipt::{
checks::{Check, CheckResult},
Checking, ReceiptWithState,
state::Checking,
ReceiptWithState,
};
use tokio::time::sleep;
use tracing::error;
Expand Down
3 changes: 2 additions & 1 deletion tap-agent/src/tap/context/checks/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use eventuals::Eventual;
use indexer_common::escrow_accounts::EscrowAccounts;
use tap_core::receipt::{
checks::{Check, CheckResult},
Checking, ReceiptWithState,
state::Checking,
ReceiptWithState,
};

use crate::tap::context::error::AdapterError;
Expand Down
3 changes: 2 additions & 1 deletion tap-agent/src/tap/context/checks/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use anyhow::anyhow;
use tap_core::{
receipt::{
checks::{Check, CheckResult},
Checking, ReceiptWithState,
state::Checking,
ReceiptWithState,
},
signed_message::MessageId,
};
Expand Down
2 changes: 1 addition & 1 deletion tap-agent/src/tap/context/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use bigdecimal::{num_bigint::ToBigInt, ToPrimitive};
use sqlx::{postgres::types::PgRange, types::BigDecimal};
use tap_core::{
manager::adapters::{safe_truncate_receipts, ReceiptDelete, ReceiptRead},
receipt::{Checking, Receipt, ReceiptWithState, SignedReceipt},
receipt::{state::Checking, Receipt, ReceiptWithState, SignedReceipt},
};
use thegraph::types::Address;

Expand Down
2 changes: 1 addition & 1 deletion tap-agent/src/tap/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use lazy_static::lazy_static;
use sqlx::PgPool;
use tap_core::{
rav::{ReceiptAggregateVoucher, SignedRAV},
receipt::{Checking, Receipt, ReceiptWithState, SignedReceipt},
receipt::{state::Checking, Receipt, ReceiptWithState, SignedReceipt},
signed_message::EIP712SignedMessage,
};
use thegraph::types::Address;
Expand Down

0 comments on commit 8a35da2

Please sign in to comment.