fix: remove unused imports and suppress warnings in various modules

This commit is contained in:
Gulshan Yadav 2026-01-26 23:59:27 +05:30
parent 780a6aaad0
commit 7785dbe8f8
8 changed files with 13 additions and 34 deletions

View file

@ -11,15 +11,11 @@
//! - DAG reorg handling
//! - Parallel blocks (GHOSTDAG) resolution
use std::collections::{HashMap, HashSet};
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::Arc;
use std::time::Duration;
use parking_lot::RwLock;
use tempfile::TempDir;
use tokio::sync::{broadcast, mpsc, Barrier};
use tokio::time::{sleep, timeout};
use tokio::time::sleep;
use tracing::info;
use synord::config::NodeConfig;
@ -29,15 +25,9 @@ use synord::node::{NodeState, SynorNode};
// Test Configuration Constants
// =============================================================================
/// Default test timeout for async operations.
const TEST_TIMEOUT: Duration = Duration::from_secs(60);
/// Time to wait for network operations to settle.
const NETWORK_SETTLE_TIME: Duration = Duration::from_millis(500);
/// Byzantine fault tolerance threshold (f nodes can be faulty in 3f+1 total nodes).
const BFT_THRESHOLD: usize = 3;
// =============================================================================
// Test Helpers
// =============================================================================
@ -58,23 +48,11 @@ fn create_node_config(temp_dir: &TempDir, node_index: u16, seeds: Vec<String>) -
config
}
/// Creates a mining-enabled node configuration.
fn create_miner_config(
temp_dir: &TempDir,
node_index: u16,
seeds: Vec<String>,
coinbase_addr: &str,
) -> NodeConfig {
let mut config = create_node_config(temp_dir, node_index, seeds);
config.mining.enabled = true;
config.mining.coinbase_address = Some(coinbase_addr.to_string());
config.mining.threads = 1;
config
}
/// Test network for Byzantine fault scenarios.
struct TestNetwork {
nodes: Vec<Arc<SynorNode>>,
/// Temp directories kept to ensure they are not dropped during tests
#[allow(dead_code)]
temp_dirs: Vec<TempDir>,
}
@ -123,7 +101,7 @@ impl TestNetwork {
let mut nodes = Vec::new();
let mut node_index = 0u16;
for (group_idx, &group_size) in group_sizes.iter().enumerate() {
for (_group_idx, &group_size) in group_sizes.iter().enumerate() {
// First node of each group is the seed for that group
let group_seed_port = 20000 + (std::process::id() % 500) as u16 * 10 + node_index * 3;
@ -173,7 +151,7 @@ impl TestNetwork {
let to_config = self.nodes[to].config();
let to_addr = &to_config.p2p.listen_addr;
let from_network = self.nodes[from].network();
from_network.connect_peer(to_addr).await;
let _ = from_network.connect_peer(to_addr).await;
Ok(())
}
@ -441,7 +419,7 @@ mod double_spend_tests {
// For now, verify mempool API is working
// and handles empty/invalid data gracefully
let invalid_tx = vec![0u8; 50]; // Invalid transaction bytes
let _invalid_tx = vec![0u8; 50]; // Invalid transaction bytes (for future use)
// Submitting invalid tx should fail gracefully
// Mempool should maintain integrity
@ -1493,7 +1471,7 @@ mod timing_attack_tests {
let tips: Vec<[u8; 32]> = consensus.tips().await;
for tip in tips.iter().take(1) {
if let Some(info) = consensus.get_block_info(tip).await {
if let Some(_info) = consensus.get_block_info(tip).await {
info!(
block = hex::encode(&tip[..8]),
"Block with validated timestamp"

View file

@ -515,7 +515,7 @@ pub enum TaskExecutionResult {
#[cfg(test)]
mod tests {
use super::*;
use crate::processor::{Operation, Precision};
use crate::processor::Operation;
use crate::task::{TaskPriority, TaskStatus};
fn create_test_task(id: u64, op: Operation, deps: Vec<TaskId>) -> Task {

View file

@ -370,7 +370,7 @@ mod tests {
#[test]
fn test_discount_expiry() {
let mut discount = Discount::percentage("EXPIRED", "Expired", dec!(10))
let discount = Discount::percentage("EXPIRED", "Expired", dec!(10))
.with_expiry(Utc::now() - chrono::Duration::days(1));
assert!(!discount.is_valid());

View file

@ -606,7 +606,6 @@ impl Default for IbcHandler {
#[cfg(test)]
mod tests {
use super::*;
use crate::client::TrustLevel;
use crate::types::ChainId;
fn setup_handler() -> IbcHandler {

View file

@ -471,7 +471,7 @@ mod tests {
let mut builder = CarBuilder::new(root.clone());
let cid1 = builder.add_content(b"block 1".to_vec());
let cid2 = builder.add_content(b"block 2".to_vec());
let _cid2 = builder.add_content(b"block 2".to_vec());
// Adding same content again should not create new block
let cid1_again = builder.add_content(b"block 1".to_vec());

View file

@ -263,7 +263,6 @@ impl Prover {
#[cfg(test)]
mod tests {
use super::*;
use crate::ast::{BinaryOperator, Literal};
#[test]
fn test_prover_config_default() {

View file

@ -79,6 +79,7 @@ analyzer:
- "**/*.g.dart"
- "**/*.freezed.dart"
errors:
avoid_print: ignore
missing_required_param: error
missing_return: error
todo: ignore

View file

@ -1,3 +1,5 @@
// ignore_for_file: avoid_print
import 'dart:convert';
import 'dart:io';