Skip to content

Commit 5e557b2

Browse files
committed
comments -> rust docs
1 parent da4d9b9 commit 5e557b2

File tree

2 files changed

+88
-89
lines changed

2 files changed

+88
-89
lines changed

pallets/subtensor/src/lib.rs

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,23 +1218,22 @@ pub mod pallet {
12181218
Self::do_set_weights(origin, netuid, dests, weights, version_key)
12191219
}
12201220

1221-
// ---- Used to commit a hash of your wieght values to later be revealed.
1222-
//
1223-
// # Args:
1224-
// * 'origin': (<T as frame_system::Config>RuntimeOrigin):
1225-
// - The signature of the committing hotkey.
1226-
//
1227-
// * 'netuid' (u16):
1228-
// - The u16 network identifier.
1229-
//
1230-
// * 'commit_hash' (H256):
1231-
// - The hash representing the committed weights.
1232-
//
1233-
// # Raises:
1234-
// * 'CommitNotAllowed':
1235-
// - Attempting to commit when it is not allowed.
1236-
//
1237-
//
1221+
/// ---- Used to commit a hash of your weight values to later be revealed.
1222+
///
1223+
/// # Args:
1224+
/// * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`):
1225+
/// - The signature of the committing hotkey.
1226+
///
1227+
/// * `netuid` (`u16`):
1228+
/// - The u16 network identifier.
1229+
///
1230+
/// * `commit_hash` (`H256`):
1231+
/// - The hash representing the committed weights.
1232+
///
1233+
/// # Raises:
1234+
/// * `CommitNotAllowed`:
1235+
/// - Attempting to commit when it is not allowed.
1236+
///
12381237
#[pallet::call_index(96)]
12391238
#[pallet::weight((Weight::from_parts(10_151_000_000, 0)
12401239
.saturating_add(T::DbWeight::get().reads(4104))
@@ -1247,34 +1246,34 @@ pub mod pallet {
12471246
Self::do_commit_weights(origin, netuid, commit_hash)
12481247
}
12491248

1250-
// ---- Used to reveal the weights for a previously commited hash.
1251-
//
1252-
// # Args:
1253-
// * 'origin': (<T as frame_system::Config>RuntimeOrigin):
1254-
// - The signature of the revealing hotkey.
1255-
//
1256-
// * 'netuid' (u16):
1257-
// - The u16 network identifier.
1258-
//
1259-
// * 'uids' (Vec<u16>):
1260-
// - The uids for the weights being revealed.
1261-
//
1262-
// * 'values' (Vec<u16>):
1263-
// - The values of the weights being revealed.
1264-
//
1265-
// * 'version_key' (u64):
1266-
// - The network version key.
1267-
//
1268-
// # Raises:
1269-
// * 'NoCommitFound':
1270-
// - Attempting to reveal weights without an existing commit.
1271-
//
1272-
// * 'InvalidRevealTempo':
1273-
// - Attempting to reveal weights outside the valid tempo.
1274-
//
1275-
// * 'InvalidReveal':
1276-
// - The revealed hash does not match the committed hash.
1277-
//
1249+
/// ---- Used to reveal the weights for a previously committed hash.
1250+
///
1251+
/// # Args:
1252+
/// * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`):
1253+
/// - The signature of the revealing hotkey.
1254+
///
1255+
/// * `netuid` (`u16`):
1256+
/// - The u16 network identifier.
1257+
///
1258+
/// * `uids` (`Vec<u16>`):
1259+
/// - The uids for the weights being revealed.
1260+
///
1261+
/// * `values` (`Vec<u16>`):
1262+
/// - The values of the weights being revealed.
1263+
///
1264+
/// * `version_key` (`u64`):
1265+
/// - The network version key.
1266+
///
1267+
/// # Raises:
1268+
/// * `NoCommitFound`:
1269+
/// - Attempting to reveal weights without an existing commit.
1270+
///
1271+
/// * `InvalidRevealTempo`:
1272+
/// - Attempting to reveal weights outside the valid tempo.
1273+
///
1274+
/// * `InvalidReveal`:
1275+
/// - The revealed hash does not match the committed hash.
1276+
///
12781277
#[pallet::call_index(97)]
12791278
#[pallet::weight((Weight::from_parts(10_151_000_000, 0)
12801279
.saturating_add(T::DbWeight::get().reads(4104))

pallets/subtensor/src/weights.rs

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ use sp_runtime::traits::{BlakeTwo256, Hash};
55
use sp_std::vec;
66

77
impl<T: Config> Pallet<T> {
8-
// ---- The implementation for committing weight hashes.
9-
//
10-
// # Args:
11-
// * 'origin': (<T as frame_system::Config>RuntimeOrigin):
12-
// - The signature of the committing hotkey.
13-
//
14-
// * 'netuid' (u16):
15-
// - The u16 network identifier.
16-
//
17-
// * 'commit_hash' (H256):
18-
// - The hash representing the committed weights.
19-
//
20-
// # Raises:
21-
// * 'CommitNotAllowed':
22-
// - Attempting to commit when it is not allowed.
23-
//
8+
/// ---- The implementation for committing weight hashes.
9+
///
10+
/// # Args:
11+
/// * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`):
12+
/// - The signature of the committing hotkey.
13+
///
14+
/// * `netuid` (`u16`):
15+
/// - The u16 network identifier.
16+
///
17+
/// * `commit_hash` (`H256`):
18+
/// - The hash representing the committed weights.
19+
///
20+
/// # Raises:
21+
/// * `CommitNotAllowed`:
22+
/// - Attempting to commit when it is not allowed.
23+
///
2424
pub fn do_commit_weights(
2525
origin: T::RuntimeOrigin,
2626
netuid: u16,
@@ -40,34 +40,34 @@ impl<T: Config> Pallet<T> {
4040
Ok(())
4141
}
4242

43-
// ---- The implementation for revealing committed weights.
44-
//
45-
// # Args:
46-
// * 'origin': (<T as frame_system::Config>RuntimeOrigin):
47-
// - The signature of the revealing hotkey.
48-
//
49-
// * 'netuid' (u16):
50-
// - The u16 network identifier.
51-
//
52-
// * 'uids' (Vec<u16>):
53-
// - The uids for the weights being revealed.
54-
//
55-
// * 'values' (Vec<u16>):
56-
// - The values of the weights being revealed.
57-
//
58-
// * 'version_key' (u64):
59-
// - The network version key.
60-
//
61-
// # Raises:
62-
// * 'NoCommitFound':
63-
// - Attempting to reveal weights without an existing commit.
64-
//
65-
// * 'InvalidRevealTempo':
66-
// - Attempting to reveal weights outside the valid tempo.
67-
//
68-
// * 'InvalidReveal':
69-
// - The revealed hash does not match the committed hash.
70-
//
43+
/// ---- The implementation for revealing committed weights.
44+
///
45+
/// # Args:
46+
/// * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`):
47+
/// - The signature of the revealing hotkey.
48+
///
49+
/// * `netuid` (`u16`):
50+
/// - The u16 network identifier.
51+
///
52+
/// * `uids` (`Vec<u16>`):
53+
/// - The uids for the weights being revealed.
54+
///
55+
/// * `values` (`Vec<u16>`):
56+
/// - The values of the weights being revealed.
57+
///
58+
/// * `version_key` (`u64`):
59+
/// - The network version key.
60+
///
61+
/// # Raises:
62+
/// * `NoCommitFound`:
63+
/// - Attempting to reveal weights without an existing commit.
64+
///
65+
/// * `InvalidRevealTempo`:
66+
/// - Attempting to reveal weights outside the valid tempo.
67+
///
68+
/// * `InvalidReveal`:
69+
/// - The revealed hash does not match the committed hash.
70+
///
7171
pub fn do_reveal_weights(
7272
origin: T::RuntimeOrigin,
7373
netuid: u16,

0 commit comments

Comments
 (0)