Skip to content

Commit 5317b8d

Browse files
author
EchoBT
committed
refactor: Remove redundant weights_v2.rs, use bittensor_rs::Subtensor directly
- Delete weights_v2.rs wrapper (unnecessary abstraction) - Use bittensor_rs::Subtensor API directly for set_weights - Apply cargo fmt formatting fixes - Fix unused_mut warning in validator-node
1 parent db6cd10 commit 5317b8d

File tree

8 files changed

+248
-466
lines changed

8 files changed

+248
-466
lines changed

Cargo.lock

Lines changed: 1 addition & 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: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,13 +524,17 @@ async fn main() -> Result<()> {
524524
}
525525

526526
// Submit each message via RPC
527-
info!("Submitting {} messages via RPC to {}...", messages_to_send.len(), args.rpc);
527+
info!(
528+
"Submitting {} messages via RPC to {}...",
529+
messages_to_send.len(),
530+
args.rpc
531+
);
528532
let client = reqwest::Client::new();
529-
533+
530534
for msg in &messages_to_send {
531535
let serialized = bincode::serialize(&msg)?;
532536
let hex_encoded = hex::encode(&serialized);
533-
537+
534538
let rpc_url = if args.rpc.ends_with("/rpc") {
535539
args.rpc.clone()
536540
} else {
@@ -552,12 +556,12 @@ async fn main() -> Result<()> {
552556
.await?;
553557

554558
let result: serde_json::Value = response.json().await?;
555-
559+
556560
if let Some(error) = result.get("error") {
557561
eprintln!("RPC Error: {}", error);
558562
return Ok(());
559563
}
560-
564+
561565
if let Some(res) = result.get("result") {
562566
info!("Message submitted: {:?}", res);
563567
}

bins/validator-node/src/main.rs

Lines changed: 150 additions & 71 deletions
Large diffs are not rendered by default.

crates/bittensor-integration/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ mod client;
1919
mod config;
2020
mod validator_sync;
2121
mod weights;
22-
mod weights_v2;
2322

2423
#[cfg(test)]
2524
mod tests;
@@ -30,12 +29,11 @@ pub use client::*;
3029
pub use config::*;
3130
pub use validator_sync::*;
3231
pub use weights::*;
33-
pub use weights_v2::{normalize_weights_f32, normalize_weights_f64, WeightSubmitterV2};
3432

3533
// Re-export bittensor-rs types for convenience
3634
pub use bittensor_rs::BittensorClient;
3735

38-
// Re-export high-level Subtensor API
36+
// Re-export high-level Subtensor API (use this directly instead of custom wrappers)
3937
pub use bittensor_rs::{
4038
PendingCommit, Salt, Subtensor, SubtensorBuilder, SubtensorState, WeightResponse,
4139
WeightResponseData,

0 commit comments

Comments
 (0)