Skip to content

Commit d3b07a0

Browse files
committed
update error docs
1 parent 4407df4 commit d3b07a0

File tree

11 files changed

+78
-78
lines changed

11 files changed

+78
-78
lines changed

pallets/collective/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -369,16 +369,16 @@ pub mod pallet {
369369
/// Proposal must exist
370370
ProposalNotExists,
371371
/// Index mismatched the proposal hash
372-
IndexNotMatchProposalHash,
372+
IndexMismatchProposalHash,
373373
/// Duplicate vote ignored
374374
DuplicateVote,
375-
/// The close call was made too early, before the end of the voting.
375+
/// The call to close the proposal was made too early, before the end of the voting
376376
TooEarlyToCloseProposal,
377377
/// There can only be a maximum of `MaxProposals` active proposals.
378378
TooManyActiveProposals,
379-
/// The given weight bound for the proposal was too low.
379+
/// The given weight-bound for the proposal was too low.
380380
ProposalWeightLessThanDispatchCallWeight,
381-
/// The given length bound for the proposal was too low.
381+
/// The given length-bound for the proposal was too low.
382382
ProposalLengthBoundLessThanProposalLength,
383383
/// The given motion duration for the proposal was too low.
384384
DurationLowerThanConfiguredMotionDuration,
@@ -750,7 +750,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
750750
let mut voting = Self::voting(proposal).ok_or(Error::<T, I>::ProposalNotExists)?;
751751
ensure!(
752752
voting.index == index,
753-
Error::<T, I>::IndexNotMatchProposalHash
753+
Error::<T, I>::IndexMismatchProposalHash
754754
);
755755

756756
let position_yes = voting.ayes.iter().position(|a| a == &who);
@@ -804,7 +804,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
804804
let voting = Self::voting(proposal_hash).ok_or(Error::<T, I>::ProposalNotExists)?;
805805
ensure!(
806806
voting.index == index,
807-
Error::<T, I>::IndexNotMatchProposalHash
807+
Error::<T, I>::IndexMismatchProposalHash
808808
);
809809

810810
let mut no_votes = voting.nays.len() as MemberCount;
@@ -1008,7 +1008,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
10081008
let voting = Self::voting(proposal).ok_or(Error::<T, I>::ProposalNotExists)?;
10091009
ensure!(
10101010
voting.index == index,
1011-
Error::<T, I>::IndexNotMatchProposalHash
1011+
Error::<T, I>::IndexMismatchProposalHash
10121012
);
10131013

10141014
let position_yes = voting.ayes.iter().position(|a| a == who);

pallets/collective/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ fn motions_ignoring_bad_index_collective_vote_works() {
964964
));
965965
assert_noop!(
966966
Collective::vote(RuntimeOrigin::signed(2), hash, 1, true),
967-
Error::<Test, Instance1>::IndexNotMatchProposalHash,
967+
Error::<Test, Instance1>::IndexMismatchProposalHash,
968968
);
969969
});
970970
}
@@ -1117,7 +1117,7 @@ fn motions_all_first_vote_free_works() {
11171117
);
11181118
assert_eq!(close_rval.unwrap().pays_fee, Pays::No);
11191119

1120-
// trying to close the proposal, which is already closed.
1120+
// trying to close the proposal, which is already closed
11211121
// Expecting error "ProposalNotExists" with Pays::Yes
11221122
let close_rval: DispatchResultWithPostInfo = Collective::close(
11231123
RuntimeOrigin::signed(2),

pallets/commitments/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ pub mod pallet {
7878
pub enum Error<T> {
7979
/// Account passed too many additional fields to their commitment
8080
TooManyFieldsInCommitmentInfo,
81-
/// Account isn't allow to make commitments to the chain
81+
/// Account is not allow to make commitments to the chain
8282
AccountNotAllowedCommit,
83-
/// Account is trying to commit data too fast
83+
/// Account is trying to commit data too fast, rate limit exceeded
8484
CommitmentSetRateLimitExceeded,
8585
}
8686

pallets/registry/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub mod pallet {
8282

8383
#[pallet::error]
8484
pub enum Error<T> {
85-
/// Account attempted to register an identity but doesn't meet the requirements.
85+
/// Account attempted to register an identity but does not meet the requirements.
8686
CannotRegister,
8787
/// Account passed too many additional fields to their identity
8888
TooManyFieldsInIdentityInfo,

pallets/subtensor/src/errors.rs

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,121 +6,121 @@ use frame_support::pallet_macros::pallet_section;
66
mod errors {
77
#[pallet::error]
88
pub enum Error<T> {
9-
/// the network does not exist.
9+
/// The subnet does not exist.
1010
SubNetworkDoesNotExist,
11-
/// the root network does not exist.
11+
/// The root network does not exist.
1212
RootNetworkDoesNotExist,
13-
/// the user tries to serve an axon which is not of type 4 (IPv4) or 6 (IPv6).
13+
/// The user tries to serve an axon which is not of type 4 (IPv4) or 6 (IPv6).
1414
InvalidIpType,
15-
/// an invalid IP address is passed to the serve function.
15+
/// An invalid IP address is passed to the serve function.
1616
InvalidIpAddress,
17-
/// an invalid port is passed to the serve function.
17+
/// An invalid port is passed to the serve function.
1818
InvalidPort,
19-
/// the hot key not registered in subnet
19+
/// The hot key not registered in subnet
2020
HotKeyNotRegisteredInSubNet,
21-
/// the hot key not exists
21+
/// The hot key not exists
2222
HotKeyAccountNotExists,
23-
/// the hot key not registered in any subnet.
23+
/// The hot key is not registered in any subnet.
2424
HotKeyNotRegisteredInNetwork,
2525
/// stake, unstake or subscribe request is made by a coldkey which is not associated with the hotkey account.
2626
NonAssociatedColdKey,
27-
/// the hot key is not a delegate and the signer is not the owner of the hot key.
27+
/// The hot key is not a delegate and the signer is not the owner of the hot key.
2828
HotKeyNotDelegateAndSignerNotOwnHotKey,
29-
/// stake to withdraw amount is zero
29+
/// Stake to withdraw amount is zero
3030
StakeToWithdrawIsZero,
31-
/// the caller requests removing more stake than there exists in the staking account. See: fn remove_stake.
31+
/// The caller is requesting removing more stake than there exists in the staking account. See: fn "[remove_stake]".
3232
NotEnoughStakeToWithdraw,
33-
/// the caller requests to set weights but has less than WeightsMinStake
33+
/// The caller is requesting to set weights but the caller has less than minimum stake required to set weights (less than WeightsMinStake).
3434
NotEnoughStakeToSetWeights,
35-
/// the caller requests adding more stake than there exists in the cold key account. See: fn add_stake
35+
/// The caller is requesting adding more stake than there exists in the cold key account. See: fn "[add_stake()]"
3636
NotEnoughBalanceToStake,
37-
/// the caller tries to add stake, but for some reason the requested amount could not be withdrawn from the coldkey account.
37+
/// The caller is trying to add stake, but for some reason the requested amount could not be withdrawn from the coldkey account.
3838
BalanceWithdrawalError,
39-
/// successfully deducted balance for withdraw is zero
40-
ZeroBalanceWithdrawn,
41-
/// the caller attempts to set non-self weights without being a permitted validator.
39+
/// Unsuccessfully withdraw, balance could be zero (can not make account exist) after withdrawal.
40+
ZeroBalanceAfterWithdrawn,
41+
/// The caller is attempting to set non-self weights without being a permitted validator.
4242
NeuronNoValidatorPermit,
43-
/// the caller attempts to set the weight keys and values but these vectors have different size.
43+
/// The caller is attempting to set the weight keys and values but these vectors have different size.
4444
WeightVecNotEqualSize,
45-
/// the caller attempts to set weights with duplicate uids in the weight matrix.
45+
/// The caller is attempting to set weights with duplicate uids in the weight matrix.
4646
DuplicateUids,
47-
/// the caller attempts to set weight to at least one uid that does not exist in the metagraph.
47+
/// The caller is attempting to set weight to at least one uid that does not exist in the metagraph.
4848
UidVecContainInvalidOne,
49-
/// the dispatch attempts to set weights on chain with fewer elements than are allowed.
49+
/// The dispatch is attempting to set weights on chain with fewer elements than are allowed.
5050
WeightVecLengthIsLow,
51-
/// registrations this block exceeds allowed number.
51+
/// Number of registrations in this block exceeds the allowed number (i.e., exceeds the subnet hyperparameter "max_regs_per_block").
5252
TooManyRegistrationsThisBlock,
53-
/// the caller requests registering a neuron which already exists in the active set.
53+
/// The caller is requesting registering a neuron which already exists in the active set.
5454
HotKeyAlreadyRegisteredInSubNet,
55-
/// the new hot key is the same as old one
55+
/// The new hot key is the same as old one
5656
NewHotKeyIsSameWithOld,
57-
/// the supplied pow hash block is in the future or negative.
57+
/// The supplied PoW hash block is in the future or negative.
5858
InvalidWorkBlock,
59-
/// the supplied pow hash block does not meet the network difficulty.
59+
/// The supplied PoW hash block does not meet the network difficulty.
6060
InvalidDifficulty,
61-
/// the supplied pow hash seal does not match the supplied work.
61+
/// The supplied PoW hash seal does not match the supplied work.
6262
InvalidSeal,
63-
/// the dispatch attempts to set weights on chain with where any normalized weight is more than MaxWeightLimit.
63+
/// The dispatch is attempting to set weights on chain with weight value exceeding the MaxWeightLimit (max_weight_limit subnet hyperparameter).
6464
MaxWeightExceeded,
65-
/// the hotkey attempts to become delegate when they are already.
65+
/// The hotkey is attempting to become a delegate when the hotkey is already a delegate.
6666
HotKeyAlreadyDelegate,
67-
/// the hotkey attempts to set weights twice within net_tempo/2 blocks.
67+
/// The hotkey is attempting to set weights twice within the duration of net_tempo/2 blocks.
6868
SettingWeightsTooFast,
69-
/// a validator attempts to set weights from a validator with incorrect code base key.
70-
IncorrectNetworkVersionKey,
71-
/// an axon or prometheus serving exceeds the rate limit for a registered neuron.
69+
/// A validator is attempting to set weights from a validator with incorrect weight version.
70+
IncorrectWeightVersionKey,
71+
/// An axon or prometheus serving exceeds the rate limit for a registered neuron.
7272
ServingRateLimitExceeded,
73-
/// the caller attempts to set weights with more uids than allowed.
73+
/// The caller is attempting to set weights with more UIDs than allowed.
7474
UidsLengthExceedUidsInSubNet,
75-
/// a transactor exceeds the rate limit for add network tx.
75+
/// A transactor exceeded the rate limit for add network transaction.
7676
NetworkTxRateLimitExceeded,
77-
/// a transactor exceeds the rate limit for delegate tx.
77+
/// A transactor exceeded the rate limit for delegate transaction.
7878
DelegateTxRateLimitExceeded,
79-
/// a transactor exceeds the rate limit for set or swap hot key.
79+
/// A transactor exceeded the rate limit for set or swapping hot key.
8080
HotKeySetTxRateLimitExceeded,
81-
/// a transactor exceeds the rate limit for stakes.
81+
/// A transactor exceeded the rate limit for stakes.
8282
StakeRateLimitExceeded,
83-
/// a transactor exceeds the rate limit for unstakes.
83+
/// A transactor exceeded the rate limit for unstaking.
8484
UnstakeRateLimitExceeded,
85-
/// registration is disabled
85+
/// Registration is disabled.
8686
SubNetRegistrationDisabled,
87-
/// registration attempt exceeds allowed in interval
87+
/// The number of registration attempts exceeded the allowed number in the interval.
8888
TooManyRegistrationsThisInterval,
89-
/// the hotkey passed is not the origin, but it should be
89+
/// The hotkey is required to be the origin.
9090
TransactorAccountShouldBeHotKey,
91-
/// a hotkey attempts to do something only senate members can do
91+
/// A hotkey is attempting to do something only senate members can do.
9292
NotSenateMember,
93-
/// the faucet is disabled
93+
/// Faucet is disabled.
9494
FaucetDisabled,
95-
/// not subnet owner
95+
/// Not a subnet owner.
9696
NotSubnetOwner,
97-
/// operation not permitted on root subnet
97+
/// Operation is not permitted on root subnet.
9898
RegistrationNotPermittedOnRootSubnet,
99-
/// a hotkey attempts to join the root subnet with too little stake
99+
/// A hotkey with too little stake is attempting to join the root subnet.
100100
StakeTooLowForRoot,
101-
/// all subnets are in the immunity period
101+
/// All subnets are in the immunity period.
102102
AllNetworksInImmunity,
103-
/// not enough balance to pay swap hot key
103+
/// Not enough balance to pay swapping hot key.
104104
NotEnoughBalanceToPaySwapHotKey,
105-
/// Set root network weights not match net uid
105+
/// Netuid does not match for setting root network weights.
106106
NotRootSubnet,
107-
/// can't set weights for root network
107+
/// Can not set weights for the root network.
108108
CanNotSetRootNetworkWeights,
109-
/// no neuron id is available
109+
/// No neuron ID is available.
110110
NoNeuronIdAvailable,
111-
/// Thrown a stake would be below the minimum threshold for nominator validations
111+
/// Stake amount below the minimum threshold for nominator validations.
112112
NomStakeBelowMinimumThreshold,
113-
/// delegate take is too low
113+
/// Delegate take is too low.
114114
DelegateTakeTooLow,
115-
/// delegate take is too high
115+
/// Delegate take is too high.
116116
DelegateTakeTooHigh,
117-
/// Not allowed to commit weights
117+
/// Not allowed to commit weights.
118118
WeightsCommitNotAllowed,
119-
/// No commit found for provided hotkey+netuid when attempting to reveal weights
119+
/// No commit found for provided hotkey+netuid combination when attempting to reveal weights.
120120
NoWeightsCommitFound,
121-
/// Not the correct block/range to reveal weights
121+
/// Not the correct block/range to reveal weights.
122122
InvalidRevealCommitHashNotMatchTempo,
123-
/// Committed hash does not equal the hashed reveal data
123+
/// Committed hash does not equal the hashed reveal data.
124124
InvalidRevealCommitHashNotMatch,
125125
}
126126
}

pallets/subtensor/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ pub mod pallet {
14751475
/// * 'WeightVecLengthIsLow':
14761476
/// - Attempting to set weights with fewer weights than min.
14771477
///
1478-
/// * 'IncorrectNetworkVersionKey':
1478+
/// * 'IncorrectWeightVersionKey':
14791479
/// - Attempting to set weights with the incorrect network version key.
14801480
///
14811481
/// * 'SettingWeightsTooFast':

pallets/subtensor/src/root.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ impl<T: Config> Pallet<T> {
649649
// Ensure version_key is up-to-date.
650650
ensure!(
651651
Self::check_version_key(netuid, version_key),
652-
Error::<T>::IncorrectNetworkVersionKey
652+
Error::<T>::IncorrectWeightVersionKey
653653
);
654654

655655
// Get the neuron uid of associated hotkey on network netuid.

pallets/subtensor/src/staking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ impl<T: Config> Pallet<T> {
776776
.peek();
777777

778778
if credit == 0 {
779-
return Err(Error::<T>::ZeroBalanceWithdrawn.into());
779+
return Err(Error::<T>::ZeroBalanceAfterWithdrawn.into());
780780
}
781781

782782
Ok(credit)

pallets/subtensor/src/weights.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<T: Config> Pallet<T> {
137137
/// * 'NotRegistered':
138138
/// - Attempting to set weights from a non registered account.
139139
///
140-
/// * 'IncorrectNetworkVersionKey':
140+
/// * 'IncorrectWeightVersionKey':
141141
/// - Attempting to set weights without having an up-to-date version_key.
142142
///
143143
/// * 'SettingWeightsTooFast':
@@ -220,7 +220,7 @@ impl<T: Config> Pallet<T> {
220220
// --- 7. Ensure version_key is up-to-date.
221221
ensure!(
222222
Self::check_version_key(netuid, version_key),
223-
Error::<T>::IncorrectNetworkVersionKey
223+
Error::<T>::IncorrectWeightVersionKey
224224
);
225225

226226
// --- 9. Ensure the uid is not setting weights faster than the weights_set_rate_limit.

pallets/subtensor/tests/staking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ fn test_remove_balance_from_coldkey_account_failed() {
10461046
// as there is no balance, nor does the account exist
10471047
let result =
10481048
SubtensorModule::remove_balance_from_coldkey_account(&coldkey_account_id, ammount);
1049-
assert_eq!(result, Err(Error::<Test>::ZeroBalanceWithdrawn.into()));
1049+
assert_eq!(result, Err(Error::<Test>::ZeroBalanceAfterWithdrawn.into()));
10501050
});
10511051
}
10521052

0 commit comments

Comments
 (0)