@@ -885,6 +885,7 @@ async fn main() -> Result<()> {
885885 let mut wasm_eval_interval = tokio:: time:: interval ( Duration :: from_secs ( 5 ) ) ;
886886 let mut stale_job_interval = tokio:: time:: interval ( Duration :: from_secs ( 120 ) ) ;
887887 let mut weight_check_interval = tokio:: time:: interval ( Duration :: from_secs ( 30 ) ) ;
888+ let mut last_weight_submission_epoch: u64 = 0 ; // Local tracking of weight submissions
888889
889890 // Clone p2p_cmd_tx for use in the loop
890891 let p2p_broadcast_tx = p2p_cmd_tx. clone ( ) ;
@@ -1344,14 +1345,13 @@ async fn main() -> Result<()> {
13441345 _ = weight_check_interval. tick( ) => {
13451346 let current_block = state_manager. apply( |state| state. bittensor_block) ;
13461347 let current_epoch = current_block / 360 ;
1347- let last_submitted = state_manager. apply( |state| state. last_weight_submission_epoch) ;
13481348
13491349 // Submit weights if we're at an epoch boundary and haven't submitted for this epoch
13501350 // Check within first 30 blocks of epoch to catch up if we missed
1351- if current_epoch > last_submitted && current_block % 360 < 30 {
1351+ if current_epoch > last_weight_submission_epoch && current_block % 360 < 30 {
13521352 info!(
13531353 "Weight submission due: block={}, epoch={}, last_submitted={}" ,
1354- current_block, current_epoch, last_submitted
1354+ current_block, current_epoch, last_weight_submission_epoch
13551355 ) ;
13561356
13571357 if let ( Some ( st) , Some ( sig) ) = ( subtensor. as_ref( ) , subtensor_signer. as_ref( ) ) {
@@ -1371,9 +1371,7 @@ async fn main() -> Result<()> {
13711371 match st. set_mechanism_weights( sig, netuid, mechanism_id, & uids, & vals, version_key, ExtrinsicWait :: Finalized ) . await {
13721372 Ok ( resp) if resp. success => {
13731373 info!( "Weights submitted for epoch {}: {:?}" , current_epoch, resp. tx_hash) ;
1374- state_manager. apply( |state| {
1375- state. last_weight_submission_epoch = current_epoch;
1376- } ) ;
1374+ last_weight_submission_epoch = current_epoch;
13771375 }
13781376 Ok ( resp) => warn!( "Weight submission issue: {}" , resp. message) ,
13791377 Err ( e) => error!( "Weight submission failed: {}" , e) ,
@@ -1385,9 +1383,7 @@ async fn main() -> Result<()> {
13851383 match st. set_mechanism_weights( sig, netuid, mechanism_id, & [ 0u16 ] , & [ 65535u16 ] , version_key, ExtrinsicWait :: Finalized ) . await {
13861384 Ok ( resp) if resp. success => {
13871385 info!( "Burn weights submitted for epoch {}: {:?}" , current_epoch, resp. tx_hash) ;
1388- state_manager. apply( |state| {
1389- state. last_weight_submission_epoch = current_epoch;
1390- } ) ;
1386+ last_weight_submission_epoch = current_epoch;
13911387 }
13921388 Ok ( resp) => warn!( "Burn weight submission issue: {}" , resp. message) ,
13931389 Err ( e) => error!( "Burn weight submission failed: {}" , e) ,
0 commit comments