Skip to content

Commit b0b9df3

Browse files
committed
chore(agent): fix conditional compilation warnings and headers
1 parent 8442a1e commit b0b9df3

File tree

5 files changed

+71
-15
lines changed

5 files changed

+71
-15
lines changed

crates/tap-agent/src/agent/sender_account.rs

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,45 @@
11
// Copyright 2023-, Edge & Node, GraphOps, and Semiotic Labs.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
#[allow(unused_imports)] // str::FromStr used in production code paths
45
use std::{
56
collections::{HashMap, HashSet},
67
str::FromStr,
78
sync::LazyLock,
89
time::Duration,
910
};
1011

12+
#[allow(unused_imports)] // Used in different conditional compilation modes
1113
use anyhow::Context;
14+
#[allow(unused_imports)] // Used in different conditional compilation modes
1215
use bigdecimal::{num_bigint::ToBigInt, ToPrimitive};
13-
use futures::{stream, StreamExt};
16+
#[allow(unused_imports)] // Used in different conditional compilation modes
17+
use futures::stream;
18+
#[allow(unused_imports)] // Used for stream operations
19+
use futures::StreamExt;
20+
#[allow(unused_imports)] // Used in production config structs
1421
use indexer_monitor::{EscrowAccounts, SubgraphClient};
22+
#[allow(unused_imports)] // Used in different conditional compilation modes
1523
use indexer_query::{
1624
closed_allocations::{self, ClosedAllocations},
17-
unfinalized_transactions, UnfinalizedTransactions,
25+
unfinalized_transactions::{self},
26+
UnfinalizedTransactions,
1827
};
28+
#[allow(unused_imports)] // Used in different conditional compilation modes
1929
use indexer_watcher::watch_pipe;
2030
use prometheus::{register_gauge_vec, register_int_gauge_vec, GaugeVec, IntGaugeVec};
2131
#[cfg(any(test, feature = "test"))]
2232
use ractor::{Actor, ActorProcessingErr, ActorRef, MessagingErr, SupervisionEvent};
33+
#[allow(unused_imports)] // Used in production config structs
2334
use reqwest::Url;
35+
#[allow(unused_imports)] // Used in production config structs
2436
use sqlx::PgPool;
37+
#[allow(unused_imports)] // Used in different conditional compilation modes
2538
use tap_aggregator::grpc::{
2639
v1::tap_aggregator_client::TapAggregatorClient as AggregatorV1,
2740
v2::tap_aggregator_client::TapAggregatorClient as AggregatorV2,
2841
};
42+
#[allow(unused_imports)] // hex::ToHexExt and sol_types::Eip712Domain used in production
2943
use thegraph_core::{
3044
alloy::{
3145
hex::ToHexExt,
@@ -34,17 +48,21 @@ use thegraph_core::{
3448
},
3549
AllocationId as AllocationIdCore, CollectionId,
3650
};
51+
#[allow(unused_imports)] // Used in production config structs
3752
use tokio::{sync::watch::Receiver, task::JoinHandle};
53+
#[allow(unused_imports)] // Used in different conditional compilation modes
3854
use tonic::transport::{Channel, Endpoint};
55+
#[allow(unused_imports)] // Used in different conditional compilation modes
3956
use tracing::Level;
4057

41-
use super::{
42-
sender_accounts_manager::{AllocationId, SenderType},
43-
sender_allocation::{AllocationConfig, SenderAllocationMessage},
44-
};
58+
#[allow(unused_imports)] // SenderType used for Legacy/Horizon differentiation in production
59+
use super::sender_accounts_manager::{AllocationId, SenderType};
4560

4661
#[cfg(any(test, feature = "test"))]
47-
use super::sender_allocation::{SenderAllocation, SenderAllocationArgs};
62+
use super::sender_allocation::{
63+
AllocationConfig, SenderAllocation, SenderAllocationArgs, SenderAllocationMessage,
64+
};
65+
#[allow(unused_imports)] // Production-only imports for rate limiting, backoff, network types, tracking
4866
use crate::{
4967
adaptative_concurrency::AdaptiveLimiter,
5068
agent::unaggregated_receipts::UnaggregatedReceipts,
@@ -53,9 +71,11 @@ use crate::{
5371
tracker::{SenderFeeTracker, SimpleFeeTracker},
5472
};
5573

74+
#[allow(dead_code)] // Prometheus metrics used in production, not in test builds
5675
static SENDER_DENIED: LazyLock<IntGaugeVec> = LazyLock::new(|| {
5776
register_int_gauge_vec!("tap_sender_denied", "Sender is denied", &["sender"]).unwrap()
5877
});
78+
#[allow(dead_code)] // Used in production code
5979
static ESCROW_BALANCE: LazyLock<GaugeVec> = LazyLock::new(|| {
6080
register_gauge_vec!(
6181
"tap_sender_escrow_balance_grt_total",
@@ -64,6 +84,7 @@ static ESCROW_BALANCE: LazyLock<GaugeVec> = LazyLock::new(|| {
6484
)
6585
.unwrap()
6686
});
87+
#[allow(dead_code)] // Used in production code
6788
static UNAGGREGATED_FEES: LazyLock<GaugeVec> = LazyLock::new(|| {
6889
register_gauge_vec!(
6990
"tap_unaggregated_fees_grt_total",
@@ -72,6 +93,7 @@ static UNAGGREGATED_FEES: LazyLock<GaugeVec> = LazyLock::new(|| {
7293
)
7394
.unwrap()
7495
});
96+
#[allow(dead_code)] // Used in production code
7597
static SENDER_FEE_TRACKER: LazyLock<GaugeVec> = LazyLock::new(|| {
7698
register_gauge_vec!(
7799
"tap_sender_fee_tracker_grt_total",
@@ -80,6 +102,7 @@ static SENDER_FEE_TRACKER: LazyLock<GaugeVec> = LazyLock::new(|| {
80102
)
81103
.unwrap()
82104
});
105+
#[allow(dead_code)] // Used in production code
83106
static INVALID_RECEIPT_FEES: LazyLock<GaugeVec> = LazyLock::new(|| {
84107
register_gauge_vec!(
85108
"tap_invalid_receipt_fees_grt_total",
@@ -88,6 +111,7 @@ static INVALID_RECEIPT_FEES: LazyLock<GaugeVec> = LazyLock::new(|| {
88111
)
89112
.unwrap()
90113
});
114+
#[allow(dead_code)] // Used in production code
91115
static PENDING_RAV: LazyLock<GaugeVec> = LazyLock::new(|| {
92116
register_gauge_vec!(
93117
"tap_pending_rav_grt_total",
@@ -96,6 +120,7 @@ static PENDING_RAV: LazyLock<GaugeVec> = LazyLock::new(|| {
96120
)
97121
.unwrap()
98122
});
123+
#[allow(dead_code)] // Used in production code
99124
static MAX_FEE_PER_SENDER: LazyLock<GaugeVec> = LazyLock::new(|| {
100125
register_gauge_vec!(
101126
"tap_max_fee_per_sender_grt_total",
@@ -104,6 +129,7 @@ static MAX_FEE_PER_SENDER: LazyLock<GaugeVec> = LazyLock::new(|| {
104129
)
105130
.unwrap()
106131
});
132+
#[allow(dead_code)] // Used in production code
107133
static RAV_REQUEST_TRIGGER_VALUE: LazyLock<GaugeVec> = LazyLock::new(|| {
108134
register_gauge_vec!(
109135
"tap_rav_request_trigger_value",
@@ -113,6 +139,7 @@ static RAV_REQUEST_TRIGGER_VALUE: LazyLock<GaugeVec> = LazyLock::new(|| {
113139
.unwrap()
114140
});
115141

142+
#[allow(dead_code)] // Used by AdaptiveLimiter in production code paths
116143
const INITIAL_RAV_REQUEST_CONCURRENT: usize = 1;
117144

118145
type RavMap = HashMap<Address, u128>;

crates/tap-agent/src/agent/sender_accounts_manager.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,50 @@
11
// Copyright 2023-, Edge & Node, GraphOps, and Semiotic Labs.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
#[allow(unused_imports)] // HashMap/HashSet used for sender management data structures
45
use std::{
56
collections::{HashMap, HashSet},
67
fmt::Display,
78
str::FromStr,
89
sync::LazyLock,
9-
time::Duration,
1010
};
1111

12+
#[allow(unused_imports)] // Used in different conditional compilation modes
1213
use anyhow::{anyhow, bail};
14+
#[allow(unused_imports)] // Used for streaming operations in production
1315
use futures::{stream, StreamExt};
16+
#[allow(unused_imports)] // Used in different conditional compilation modes
1417
use indexer_allocation::Allocation;
18+
#[allow(unused_imports)] // Used in different conditional compilation modes
1519
use indexer_monitor::{EscrowAccounts, SubgraphClient};
20+
#[allow(unused_imports)] // Used for allocation watching in production
1621
use indexer_watcher::{map_watcher, watch_pipe};
1722
use prometheus::{register_counter_vec, CounterVec};
1823
#[cfg(any(test, feature = "test"))]
1924
use ractor::{Actor, ActorCell, ActorProcessingErr, ActorRef, SupervisionEvent};
25+
#[allow(unused_imports)] // Used for aggregator endpoints in production
2026
use reqwest::Url;
2127
use serde::Deserialize;
28+
#[allow(unused_imports)] // Used in different conditional compilation modes
2229
use sqlx::{postgres::PgListener, PgPool};
30+
#[allow(unused_imports)] // Used for retry timing in production
31+
use std::time::Duration;
32+
#[allow(unused_imports)] // sol_types::Eip712Domain used for EIP-712 domain separator
2333
use thegraph_core::{
2434
alloy::{primitives::Address, sol_types::Eip712Domain},
2535
AllocationId as AllocationIdCore, CollectionId,
2636
};
37+
#[allow(unused_imports)] // Used in different conditional compilation modes
2738
use tokio::{select, sync::watch::Receiver};
2839

2940
#[cfg(any(test, feature = "test"))]
30-
use super::sender_account::{SenderAccount, SenderAccountArgs};
31-
use super::sender_account::{SenderAccountConfig, SenderAccountMessage};
32-
use crate::agent::sender_allocation::SenderAllocationMessage;
41+
use super::sender_account::{
42+
SenderAccount, SenderAccountArgs, SenderAccountConfig, SenderAccountMessage,
43+
};
44+
#[cfg(any(test, feature = "test"))]
45+
use super::sender_allocation::SenderAllocationMessage;
3346

47+
#[allow(dead_code)] // Prometheus counter used in production receipt tracking
3448
static RECEIPTS_CREATED: LazyLock<CounterVec> = LazyLock::new(|| {
3549
register_counter_vec!(
3650
"tap_receipts_received_total",

crates/tap-agent/src/agent/sender_allocation.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,21 @@ use std::{
88
time::{Duration, Instant},
99
};
1010

11+
#[allow(unused_imports)] // Used in different conditional compilation modes
1112
use anyhow::{anyhow, ensure};
12-
use bigdecimal::{num_bigint::BigInt, ToPrimitive};
13+
#[allow(unused_imports)] // Used in different conditional compilation modes
14+
use bigdecimal::ToPrimitive;
15+
#[allow(unused_imports)] // Used in database operations
16+
use bigdecimal::{num_bigint::BigInt, BigDecimal};
17+
#[allow(unused_imports)] // Used in different conditional compilation modes
1318
use indexer_monitor::{EscrowAccounts, SubgraphClient};
19+
#[allow(unused_imports)] // Used in different conditional compilation modes
1420
use itertools::{Either, Itertools};
1521
use prometheus::{register_counter_vec, register_histogram_vec, CounterVec, HistogramVec};
1622
#[cfg(any(test, feature = "test"))]
1723
use ractor::{Actor, ActorProcessingErr, ActorRef};
18-
use sqlx::{types::BigDecimal, PgPool};
24+
#[allow(unused_imports)] // Used for database operations in production
25+
use sqlx::PgPool;
1926
use tap_core::{
2027
manager::adapters::{RavRead, RavStore, ReceiptDelete, ReceiptRead},
2128
rav_request::RavRequest,
@@ -27,8 +34,10 @@ use tap_core::{
2734
},
2835
signed_message::Eip712SignedMessage,
2936
};
37+
#[allow(unused_imports)] // Used in different conditional compilation modes
3038
use thegraph_core::alloy::{hex::ToHexExt, primitives::Address, sol_types::Eip712Domain};
3139
use thiserror::Error;
40+
#[allow(unused_imports)] // Used in different conditional compilation modes
3241
use tokio::sync::watch::Receiver;
3342

3443
use super::sender_account::SenderAccountConfig;
@@ -40,7 +49,7 @@ use crate::{
4049
},
4150
tap::{
4251
context::{
43-
checks::{AllocationId, Signature},
52+
checks::{AllocationId as AllocationIdCheck, Signature},
4453
Horizon, Legacy, NetworkVersion, TapAgentContext,
4554
},
4655
signers_trimmed, TapReceipt,
@@ -469,7 +478,7 @@ where
469478
) -> anyhow::Result<Self> {
470479
let required_checks: Vec<Arc<dyn Check<TapReceipt> + Send + Sync>> = vec![
471480
Arc::new(
472-
AllocationId::new(
481+
AllocationIdCheck::new(
473482
config.indexer_address,
474483
config.escrow_polling_interval,
475484
sender,

crates/tap-agent/src/subgraph_client_simple.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright 2023-, Edge & Node, GraphOps, and Semiotic Labs.
2+
// SPDX-License-Identifier: Apache-2.0
3+
14
//! Simple SubgraphClient Abstraction for Testing
25
//!
36
//! This provides a minimal abstraction to enable Layer 2 integration testing

crates/tap-agent/tests/production_integration_tests.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright 2023-, Edge & Node, GraphOps, and Semiotic Labs.
2+
// SPDX-License-Identifier: Apache-2.0
3+
14
//! Layer 2 Integration Tests - Production Component Testing
25
//!
36
//! These tests exercise real production components while maintaining test reliability

0 commit comments

Comments
 (0)