Skip to content

Commit 2956dea

Browse files
committed
fix: reduce log verbosity - default to warn, keep only important info
- Default log level: warn (was info/debug) - validator_node and platform_bittensor: info (epoch/weight events) - Silence noisy P2P consensus, WASM runtime, libp2p, tower_http - Demote per-weight Burn UID log to debug - Fix pre-existing clippy lints (derivable_impls, unnecessary_to_owned, matches)
1 parent 2d7f6d1 commit 2956dea

File tree

5 files changed

+16
-35
lines changed

5 files changed

+16
-35
lines changed

bins/validator-node/src/main.rs

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ async fn main() -> Result<()> {
353353
tracing_subscriber::registry()
354354
.with(tracing_subscriber::fmt::layer().with_filter(
355355
tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| {
356-
"info,validator_node=debug,platform_p2p_consensus=debug".into()
356+
"warn,validator_node=info,platform_bittensor=info,platform_p2p_consensus=warn,wasm_runtime_interface=warn,libp2p_kad=error,libp2p_gossipsub=error,tower_http=warn".into()
357357
}),
358358
))
359359
.with(sentry_tracing::layer().event_filter(|meta| {
@@ -1817,7 +1817,7 @@ async fn main() -> Result<()> {
18171817
// Write all consensus-reached proposals
18181818
for p in to_write {
18191819
let storage_key = StorageKey::new(
1820-
&p.challenge_id.to_string(),
1820+
p.challenge_id.as_ref(),
18211821
hex::encode(&p.key),
18221822
);
18231823
let result = if p.value.is_empty() {
@@ -3413,7 +3413,7 @@ async fn handle_network_event(
34133413
.apply(|state| state.remove_storage_proposal(&proposal.proposal_id));
34143414
if let Some(p) = proposal_opt {
34153415
let storage_key =
3416-
StorageKey::new(&p.challenge_id.to_string(), hex::encode(&p.key));
3416+
StorageKey::new(p.challenge_id.as_ref(), hex::encode(&p.key));
34173417
let result = if p.value.is_empty() {
34183418
storage.delete(&storage_key).await
34193419
} else {
@@ -3499,7 +3499,7 @@ async fn handle_network_event(
34993499
// Use same key format as ChallengeStorageBackend:
35003500
// namespace = challenge_id.to_string(), key = hex::encode(key_bytes)
35013501
let storage_key = StorageKey::new(
3502-
&proposal.challenge_id.to_string(),
3502+
proposal.challenge_id.as_ref(),
35033503
hex::encode(&proposal.key),
35043504
);
35053505

@@ -4313,21 +4313,13 @@ async fn handle_network_event(
43134313

43144314
// During bootstrap, always accept data from the bootstrap validator
43154315
// (it is the source of truth). Otherwise, only apply if newer.
4316-
let should_apply = if in_bootstrap && from_bootstrap {
4317-
true
4318-
} else {
4319-
match storage
4320-
.get(&key, platform_distributed_storage::GetOptions::default())
4321-
.await
4322-
{
4323-
Ok(Some(existing))
4324-
if existing.metadata.version >= entry.version =>
4325-
{
4326-
false
4327-
}
4328-
_ => true,
4329-
}
4330-
};
4316+
let should_apply = in_bootstrap && from_bootstrap
4317+
|| !matches!(
4318+
storage
4319+
.get(&key, platform_distributed_storage::GetOptions::default())
4320+
.await,
4321+
Ok(Some(existing)) if existing.metadata.version >= entry.version
4322+
);
43314323

43324324
if should_apply {
43334325
if let Err(e) =
@@ -5063,7 +5055,7 @@ async fn handle_block_event(
50635055
uids.push(0);
50645056
vals.push(burn_u16);
50655057
}
5066-
info!(" Burn (UID 0): {:.4} = {}", burn_weight, burn_u16);
5058+
debug!(" Burn (UID 0): {:.4} = {}", burn_weight, burn_u16);
50675059
}
50685060

50695061
if !uids.is_empty() {

crates/challenge-sdk/src/types.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
55
use std::collections::HashMap;
66

77
/// Unique challenge identifier — a human-readable string name.
8-
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
8+
#[derive(Clone, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
99
pub struct ChallengeId(pub String);
1010

1111
impl ChallengeId {
@@ -32,12 +32,6 @@ impl ChallengeId {
3232
}
3333
}
3434

35-
impl Default for ChallengeId {
36-
fn default() -> Self {
37-
Self(String::new())
38-
}
39-
}
40-
4135
impl std::fmt::Debug for ChallengeId {
4236
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4337
write!(f, "Challenge({})", self.0)

crates/core/src/types.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl fmt::Display for Hotkey {
6363
}
6464

6565
/// Challenge ID — a human-readable string name (e.g. "bounty-challenge").
66-
#[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)]
66+
#[derive(Clone, Default, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)]
6767
pub struct ChallengeId(pub String);
6868

6969
impl ChallengeId {
@@ -84,12 +84,6 @@ impl ChallengeId {
8484
}
8585
}
8686

87-
impl Default for ChallengeId {
88-
fn default() -> Self {
89-
Self(String::new())
90-
}
91-
}
92-
9387
impl fmt::Debug for ChallengeId {
9488
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9589
write!(f, "Challenge({})", self.0)

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ services:
2727
- validator-data:/data
2828

2929
environment:
30-
- RUST_LOG=${RUST_LOG:-info,validator_node=debug}
30+
- RUST_LOG=${RUST_LOG:-warn,validator_node=info,platform_bittensor=info,platform_p2p_consensus=warn,wasm_runtime_interface=warn,libp2p_kad=error,libp2p_gossipsub=error,tower_http=warn}
3131
- DATA_DIR=/data
3232
- VALIDATOR_SECRET_KEY=${VALIDATOR_SECRET_KEY}
3333
- SUBTENSOR_ENDPOINT=${SUBTENSOR_ENDPOINT:-wss://entrypoint-finney.opentensor.ai:443}

vendor/bittensor-rs/src/subtensor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ impl Subtensor {
325325
/// Subtensor uses epoch-granular commit-reveal:
326326
/// - Commits are accepted during the ENTIRE epoch
327327
/// - Reveals are accepted during the ENTIRE next epoch (epoch + reveal_period)
328+
///
328329
/// Returns: "commit" (always - entire epoch is a commit window)
329330
pub async fn get_current_phase(&self, _netuid: u16) -> Result<String> {
330331
Ok("commit".to_string())

0 commit comments

Comments
 (0)