Skip to content

Commit 8060e47

Browse files
committed
fix merge
1 parent 8431083 commit 8060e47

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

pallets/admin-utils/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ pub mod pallet {
953953
/// The extrinsic sets the commit/reveal interval for a subnet.
954954
/// It is only callable by the root account or subnet owner.
955955
/// The extrinsic will call the Subtensor pallet to set the interval.
956-
#[pallet::call_index(47)]
956+
#[pallet::call_index(48)]
957957
#[pallet::weight(T::WeightInfo::sudo_set_commit_reveal_weights_interval())]
958958
pub fn sudo_set_commit_reveal_weights_interval(
959959
origin: OriginFor<T>,
@@ -979,7 +979,7 @@ pub mod pallet {
979979
/// The extrinsic enabled/disables commit/reaveal for a given subnet.
980980
/// It is only callable by the root account or subnet owner.
981981
/// The extrinsic will call the Subtensor pallet to set the value.
982-
#[pallet::call_index(48)]
982+
#[pallet::call_index(49)]
983983
#[pallet::weight(T::WeightInfo::sudo_set_commit_reveal_weights_enabled())]
984984
pub fn sudo_set_commit_reveal_weights_enabled(
985985
origin: OriginFor<T>,

pallets/subtensor/src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ mod errors {
119119
/// No commit found for the provided hotkey+netuid combination when attempting to reveal the weights.
120120
NoWeightsCommitFound,
121121
/// Not the correct block/range to reveal weights.
122-
InvalidRevealCommitHashNotMatchTempo,
122+
InvalidRevealCommitTempo,
123123
/// Committed hash does not equal the hashed reveal data.
124124
InvalidRevealCommitHashNotMatch,
125125
/// Attempting to call set_weights when commit/reveal is enabled

pallets/subtensor/src/weights.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,13 @@ impl<T: Config> Pallet<T> {
9797
);
9898

9999
WeightCommits::<T>::try_mutate_exists(netuid, &who, |maybe_commit| -> DispatchResult {
100-
let (commit_hash, commit_block) =
101-
maybe_commit.as_ref().ok_or(Error::<T>::NoCommitFound)?;
100+
let (commit_hash, commit_block) = maybe_commit
101+
.as_ref()
102+
.ok_or(Error::<T>::NoWeightsCommitFound)?;
102103

103104
ensure!(
104105
Self::is_reveal_block_range(netuid, *commit_block),
105-
Error::<T>::InvalidRevealTempo
106+
Error::<T>::InvalidRevealCommitTempo
106107
);
107108

108109
let provided_hash: H256 = BlakeTwo256::hash_of(&(
@@ -113,7 +114,10 @@ impl<T: Config> Pallet<T> {
113114
salt.clone(),
114115
version_key,
115116
));
116-
ensure!(provided_hash == *commit_hash, Error::<T>::InvalidReveal);
117+
ensure!(
118+
provided_hash == *commit_hash,
119+
Error::<T>::InvalidRevealCommitHashNotMatch
120+
);
117121

118122
Self::do_set_weights(origin, netuid, uids, values, version_key)
119123
})

pallets/subtensor/tests/weights.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ fn test_commit_reveal_interval() {
11581158
salt.clone(),
11591159
version_key,
11601160
),
1161-
Error::<Test>::InvalidRevealCommitHashNotMatchTempo
1161+
Error::<Test>::InvalidRevealCommitTempo
11621162
);
11631163
step_block(99);
11641164
assert_err!(
@@ -1174,7 +1174,7 @@ fn test_commit_reveal_interval() {
11741174
salt.clone(),
11751175
version_key,
11761176
),
1177-
Error::<Test>::InvalidRevealCommitHashNotMatchTempo
1177+
Error::<Test>::InvalidRevealCommitTempo
11781178
);
11791179
step_block(1);
11801180
assert_ok!(SubtensorModule::reveal_weights(
@@ -1199,7 +1199,7 @@ fn test_commit_reveal_interval() {
11991199
salt.clone(),
12001200
version_key,
12011201
),
1202-
Error::<Test>::InvalidRevealCommitHashNotMatchTempo
1202+
Error::<Test>::InvalidRevealCommitTempo
12031203
);
12041204
step_block(100);
12051205
assert_ok!(SubtensorModule::reveal_weights(
@@ -1227,7 +1227,7 @@ fn test_commit_reveal_interval() {
12271227
salt.clone(),
12281228
version_key,
12291229
),
1230-
Error::<Test>::InvalidRevealCommitHashNotMatchTempo
1230+
Error::<Test>::InvalidRevealCommitTempo
12311231
);
12321232

12331233
// Testing when you commit but do not reveal until later intervals
@@ -1584,7 +1584,7 @@ fn test_commit_reveal_bad_salt_fail() {
15841584
bad_salt.clone(),
15851585
version_key,
15861586
),
1587-
Error::<Test>::InvalidReveal
1587+
Error::<Test>::InvalidRevealCommitHashNotMatch
15881588
);
15891589
});
15901590
}

0 commit comments

Comments
 (0)