@@ -204,13 +204,13 @@ impl<T: Config> Pallet<T> {
204
204
. position ( |( hash, _, _, _) | * hash == provided_hash)
205
205
{
206
206
// --- 8. Get the commit block for the commit being revealed.
207
- let ( _, commit_block, _, _) = commits
207
+ let ( _, commit_block, _, _) = * commits
208
208
. get ( position)
209
209
. ok_or ( Error :: < T > :: NoWeightsCommitFound ) ?;
210
210
211
211
// --- 9. Ensure the commit is ready to be revealed in the current block range.
212
212
ensure ! (
213
- Self :: is_reveal_block_range( netuid, * commit_block) ,
213
+ Self :: is_reveal_block_range( netuid, commit_block) ,
214
214
Error :: <T >:: RevealTooEarly
215
215
) ;
216
216
@@ -225,7 +225,14 @@ impl<T: Config> Pallet<T> {
225
225
}
226
226
227
227
// --- 12. Proceed to set the revealed weights.
228
- Self :: do_set_weights ( origin, netuid, uids. clone ( ) , values. clone ( ) , version_key) ?;
228
+ Self :: do_set_weights (
229
+ origin,
230
+ netuid,
231
+ uids. clone ( ) ,
232
+ values. clone ( ) ,
233
+ version_key,
234
+ commit_block,
235
+ ) ?;
229
236
230
237
// --- 13. Emit the WeightsRevealed event.
231
238
Self :: deposit_event ( Event :: WeightsRevealed ( who. clone ( ) , netuid, provided_hash) ) ;
@@ -391,10 +398,18 @@ impl<T: Config> Pallet<T> {
391
398
. position ( |( hash, _, _, _) | * hash == provided_hash)
392
399
{
393
400
// --- 8b. Remove the commit from the queue.
394
- commits. remove ( position) ;
401
+ let ( _, commit_block, _, _) =
402
+ commits. remove ( position) . expect ( "commit_block exists" ) ;
395
403
396
404
// --- 8c. Proceed to set the revealed weights.
397
- Self :: do_set_weights ( origin. clone ( ) , netuid, uids, values, version_key) ?;
405
+ Self :: do_set_weights (
406
+ origin. clone ( ) ,
407
+ netuid,
408
+ uids,
409
+ values,
410
+ version_key,
411
+ commit_block,
412
+ ) ?;
398
413
399
414
// --- 8d. Collect the revealed hash.
400
415
revealed_hashes. push ( provided_hash) ;
@@ -484,15 +499,17 @@ impl<T: Config> Pallet<T> {
484
499
uids : Vec < u16 > ,
485
500
values : Vec < u16 > ,
486
501
version_key : u64 ,
502
+ block : u64 ,
487
503
) -> dispatch:: DispatchResult {
488
504
// --- 1. Check the caller's signature. This is the hotkey of a registered account.
489
505
let hotkey = ensure_signed ( origin) ?;
490
506
log:: debug!(
491
- "do_set_weights( origin:{:?} netuid:{:?}, uids:{:?}, values:{:?})" ,
507
+ "do_set_weights( origin:{:?} netuid:{:?}, uids:{:?}, values:{:?}, block:{:?} )" ,
492
508
hotkey,
493
509
netuid,
494
510
uids,
495
- values
511
+ values,
512
+ block
496
513
) ;
497
514
498
515
// --- Check that the netuid is not the root network.
@@ -588,7 +605,7 @@ impl<T: Config> Pallet<T> {
588
605
589
606
// --- 18. Set the activity for the weights on this network.
590
607
if !Self :: get_commit_reveal_weights_enabled ( netuid) {
591
- Self :: set_last_update_for_uid ( netuid, neuron_uid, current_block ) ;
608
+ Self :: set_last_update_for_uid ( netuid, neuron_uid, block ) ;
592
609
}
593
610
594
611
// --- 19. Emit the tracking event.
0 commit comments