Skip to content

Commit c470b4c

Browse files
committed
fix: resolve CI lint and clippy warnings
- Fix clippy unnecessary_unwrap in csudo by using if-let pattern - Fix inconsistent digit grouping in miner_verifier - Fix bool_assert_comparison in integration tests - Remove unused imports (HashMap, error macro) - Add #![allow] attributes to test files for dead_code warnings - Update setup-hooks.sh documentation
1 parent 6262980 commit c470b4c

File tree

14 files changed

+37
-10
lines changed

14 files changed

+37
-10
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bins/csudo/src/main.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,13 +1048,15 @@ async fn main() -> Result<()> {
10481048
docker_image,
10491049
mechanism_id,
10501050
} => {
1051-
if name.is_some() && docker_image.is_some() && mechanism_id.is_some() {
1051+
if let (Some(name), Some(docker_image), Some(mechanism_id)) =
1052+
(name, docker_image, mechanism_id)
1053+
{
10521054
// Non-interactive
10531055
let config = ChallengeContainerConfig {
10541056
challenge_id: ChallengeId::new(),
1055-
name: name.unwrap(),
1056-
docker_image: docker_image.unwrap(),
1057-
mechanism_id: mechanism_id.unwrap(),
1057+
name,
1058+
docker_image,
1059+
mechanism_id,
10581060
emission_weight: 1.0,
10591061
timeout_secs: 3600,
10601062
cpu_cores: 2.0,

crates/bittensor-integration/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ pub use bittensor_rs::{
4141

4242
// Re-export chain types needed for weight submission
4343
pub use bittensor_rs::chain::{signer_from_seed, BittensorSigner, ExtrinsicWait};
44+
45+
// Re-export metagraph sync for validator discovery
46+
pub use bittensor_rs::metagraph::sync_metagraph;

crates/challenge-orchestrator/src/evaluator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
77
use std::collections::HashMap;
88
use std::sync::Arc;
99
use std::time::Duration;
10-
use tracing::{debug, error, info};
10+
use tracing::{debug, info};
1111

1212
/// Evaluator for routing evaluation requests to challenge containers
1313
pub struct ChallengeEvaluator {

crates/challenge-runtime/src/miner_verifier.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ mod tests {
401401
hotkey: "5Miner".to_string(),
402402
coldkey: "5Cold".to_string(),
403403
uid: 42,
404-
stake: 1000_000_000_000,
404+
stake: 1_000_000_000_000,
405405
is_registered: true,
406406
is_active: true,
407407
fetched_at_block: 100,

crates/challenge-sdk/src/p2p.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ pub enum P2PError {
222222
}
223223

224224
/// Decrypt an API key that was encrypted for this validator
225-
///
225+
///
226226
/// Uses X25519 key exchange + ChaCha20-Poly1305 (same scheme as term-challenge)
227227
pub fn decrypt_api_key(
228228
encrypted: &EncryptedApiKey,

crates/secure-container-runtime/tests/integration_tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//! Run with: cargo test --test integration_tests -- --ignored
1111
1212
use secure_container_runtime::*;
13-
use std::collections::HashMap;
1413
use std::time::Duration;
1514
use tokio::time::sleep;
1615

@@ -315,7 +314,7 @@ fn test_container_config_builder() {
315314
assert!(config.network.ports.contains_key(&9090));
316315
assert_eq!(config.mounts.len(), 1);
317316
assert_eq!(config.mounts[0].source, "/tmp/data");
318-
assert_eq!(config.mounts[0].read_only, true);
317+
assert!(config.mounts[0].read_only);
319318
assert_eq!(config.labels.get("version"), Some(&"1.0.0".to_string()));
320319
}
321320

scripts/setup-hooks.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
REPO_ROOT="$(git rev-parse --show-toplevel)"
55
git config core.hooksPath "$REPO_ROOT/.githooks"
66

7-
echo "Git hooks configured. Pre-commit will format code, pre-push will run CI checks."
7+
echo "Git hooks configured:"
8+
echo " - pre-commit: Runs cargo fmt check, clippy, and cargo check"
9+
echo " - pre-push: Runs all CI checks (fmt, clippy, check, tests)"

tests/bittensor_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
//!
33
//! Tests for weight submission, block sync, and validator sync.
44
5+
#![allow(dead_code)]
6+
57
use platform_core::*;
68

79
// ============================================================================

tests/challenge_runtime_tests.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
//!
33
//! Tests for challenge execution, scheduling, and anti-cheat.
44
5+
#![allow(
6+
dead_code,
7+
unused_imports,
8+
unused_variables,
9+
clippy::type_complexity,
10+
clippy::useless_vec
11+
)]
12+
513
use platform_challenge_sdk::*;
614
use platform_core::*;
715
use std::collections::HashMap;

0 commit comments

Comments
 (0)