@@ -89,10 +89,7 @@ pub enum WeightResponseData {
8989 encrypted_payload : Vec < u8 > ,
9090 } ,
9191 /// Legacy commit-reveal data
92- CommitReveal {
93- commit_hash : String ,
94- salt : Vec < u16 > ,
95- } ,
92+ CommitReveal { commit_hash : String , salt : Vec < u16 > } ,
9693}
9794
9895/// Salt type for commit-reveal (Vec<u16>)
@@ -247,7 +244,9 @@ impl Subtensor {
247244
248245 /// Get weights rate limit for a subnet
249246 pub async fn weights_rate_limit ( & self , netuid : u16 ) -> Result < u64 > {
250- weights_rate_limit ( & self . client , netuid) . await . map ( |v| v. unwrap_or ( 0 ) )
247+ weights_rate_limit ( & self . client , netuid)
248+ . await
249+ . map ( |v| v. unwrap_or ( 0 ) )
251250 }
252251
253252 /// Get blocks since last update for a neuron
@@ -261,10 +260,7 @@ impl Subtensor {
261260 . storage_with_keys (
262261 SUBTENSOR_MODULE ,
263262 "LastUpdate" ,
264- vec ! [
265- Value :: u128 ( storage_index as u128 ) ,
266- Value :: u128 ( uid as u128 ) ,
267- ] ,
263+ vec ! [ Value :: u128 ( storage_index as u128 ) , Value :: u128 ( uid as u128 ) ] ,
268264 )
269265 . await ?
270266 {
@@ -327,11 +323,11 @@ impl Subtensor {
327323 let block = self . get_current_block ( ) . await ?;
328324 let tempo = self . tempo ( netuid) . await ? as u64 ;
329325 let block_in_epoch = block % ( tempo + 1 ) ;
330-
326+
331327 // Standard phase distribution: 75% eval, 15% commit, 10% reveal
332328 let eval_end = ( tempo * 75 ) / 100 ;
333329 let commit_end = eval_end + ( tempo * 15 ) / 100 ;
334-
330+
335331 if block_in_epoch < eval_end {
336332 Ok ( "evaluation" . to_string ( ) )
337333 } else if block_in_epoch < commit_end {
@@ -506,7 +502,8 @@ impl Subtensor {
506502 ) ;
507503
508504 // Encrypt payload
509- let encrypted = prepare_crv4_commit ( & hotkey_bytes, uids, weights, version_key, reveal_round) ?;
505+ let encrypted =
506+ prepare_crv4_commit ( & hotkey_bytes, uids, weights, version_key, reveal_round) ?;
510507
511508 info ! (
512509 "CRv4 commit: netuid={}, mechanism={}, uids={}, reveal_round={}" ,
@@ -547,11 +544,14 @@ impl Subtensor {
547544 tx_hash, reveal_round
548545 ) ;
549546
550- Ok ( WeightResponse :: success ( tx_hash, "CRv4 weights committed (auto-reveal)" )
551- . with_data ( WeightResponseData :: Crv4 {
552- reveal_round,
553- encrypted_payload : encrypted,
554- } ) )
547+ Ok (
548+ WeightResponse :: success ( tx_hash, "CRv4 weights committed (auto-reveal)" ) . with_data (
549+ WeightResponseData :: Crv4 {
550+ reveal_round,
551+ encrypted_payload : encrypted,
552+ } ,
553+ ) ,
554+ )
555555 }
556556
557557 // ==========================================================================
@@ -615,8 +615,14 @@ impl Subtensor {
615615
616616 // Submit commit
617617 let tx_hash = if mechanism_id == 0 {
618- raw_commit_weights ( & self . client , signer, netuid, & commit_data. commit_hash , wait_for)
619- . await ?
618+ raw_commit_weights (
619+ & self . client ,
620+ signer,
621+ netuid,
622+ & commit_data. commit_hash ,
623+ wait_for,
624+ )
625+ . await ?
620626 } else {
621627 crate :: commit_mechanism_weights (
622628 & self . client ,
@@ -659,11 +665,14 @@ impl Subtensor {
659665 tx_hash, epoch
660666 ) ;
661667
662- Ok ( WeightResponse :: success ( tx_hash, "Weights committed - call again to reveal" )
663- . with_data ( WeightResponseData :: CommitReveal {
664- commit_hash : commit_data. commit_hash ,
665- salt : commit_data. salt ,
666- } ) )
668+ Ok (
669+ WeightResponse :: success ( tx_hash, "Weights committed - call again to reveal" ) . with_data (
670+ WeightResponseData :: CommitReveal {
671+ commit_hash : commit_data. commit_hash ,
672+ salt : commit_data. salt ,
673+ } ,
674+ ) ,
675+ )
667676 }
668677
669678 /// Reveal a pending commit
@@ -722,7 +731,10 @@ impl Subtensor {
722731
723732 info ! ( "Weights revealed: {}" , tx_hash) ;
724733
725- Ok ( WeightResponse :: success ( tx_hash, "Weights revealed successfully" ) )
734+ Ok ( WeightResponse :: success (
735+ tx_hash,
736+ "Weights revealed successfully" ,
737+ ) )
726738 }
727739
728740 // ==========================================================================
@@ -829,7 +841,9 @@ impl Subtensor {
829841 let mut state = self . state . write ( ) . await ;
830842 let cutoff = current_epoch. saturating_sub ( max_age_epochs) ;
831843
832- state. pending_commits . retain ( |_, commit| commit. epoch >= cutoff) ;
844+ state
845+ . pending_commits
846+ . retain ( |_, commit| commit. epoch >= cutoff) ;
833847
834848 if let Some ( ref path) = self . state_path {
835849 let _ = state. save ( path) ;
0 commit comments