diff --git a/distance-oracle/src/lib.rs b/distance-oracle/src/lib.rs index 53a7503ea28f577684febf1ce09c2744746ba29b..965ed8b20ee0d8f79eb261600ae948536b466559 100644 --- a/distance-oracle/src/lib.rs +++ b/distance-oracle/src/lib.rs @@ -49,6 +49,7 @@ impl subxt::config::Config for RuntimeConfig { type Signature = subxt::ext::sp_runtime::MultiSignature; } +/// Represents a tipping amount. #[derive(Copy, Clone, Debug, Default, Encode)] pub struct Tip { #[codec(compact)] @@ -67,6 +68,7 @@ impl From<u64> for Tip { } } +/// Represents configuration parameters. pub struct Settings { pub evaluation_result_dir: PathBuf, pub rpc_url: String, @@ -81,6 +83,7 @@ impl Default for Settings { } } +/// Asynchronously runs a computation using the provided client and saves the result to a file. pub async fn run_and_save(client: &api::Client, settings: Settings) { let Some((evaluation, current_pool_index, evaluation_result_path)) = run(client, &settings, true).await @@ -138,7 +141,8 @@ pub async fn run_and_save(client: &api::Client, settings: Settings) { }); } -/// Returns `Option<(evaluation, current_pool_index, evaluation_result_path)>` +/// Asynchronously runs a computation based on the provided client and settings. +/// Returns `Option<(evaluation, current_pool_index, evaluation_result_path)>`. pub async fn run( client: &api::Client, settings: &Settings, diff --git a/docs/api/runtime-calls.md b/docs/api/runtime-calls.md index 320e6a1857da79456b7ef85bff57dca9c6b1a5cf..efdbb573ccd4698ecbff097f7f1f7fe11acb4e49 100644 --- a/docs/api/runtime-calls.md +++ b/docs/api/runtime-calls.md @@ -28,7 +28,7 @@ Taking 0.0107 % of a block. </details> -unlink the identity associated with the account +Unlink the identity associated with the account. ### Scheduler - 2 @@ -430,7 +430,7 @@ receiver: T::IdtyIndex </details> -Invite a WoT member to try becoming a Smith +Invite a member of the Web of Trust to attempt becoming a Smith. #### accept_invitation - 1 @@ -443,7 +443,7 @@ Taking 0.0122 % of a block. </details> -Accept an invitation (must have been invited first) +Accept an invitation to become a Smith (must have been invited first). #### certify_smith - 2 @@ -457,7 +457,7 @@ receiver: T::IdtyIndex </details> -Certify an invited smith which can lead the certified to become a Smith +Certify an invited Smith, which can lead the certified to become a Smith. ### AuthorityMembers - 11 @@ -472,7 +472,7 @@ Taking 0.0165 % of a block. </details> -ask to leave the set of validators two sessions after +Request to leave the set of validators two sessions later. #### go_online - 1 @@ -485,7 +485,7 @@ Taking 0.0188 % of a block. </details> -ask to join the set of validators two sessions after +Request to join the set of validators two sessions later. #### set_session_keys - 2 @@ -499,7 +499,7 @@ keys: T::Keys </details> -declare new session keys to replace current ones +Declare new session keys to replace current ones. #### remove_member_from_blacklist - 4 @@ -513,6 +513,7 @@ member_id: T::MemberId </details> +Remove a member from the blacklist. remove an identity from the blacklist ### Grandpa - 16 @@ -774,7 +775,7 @@ Taking 0.0218 % of a block. </details> -Claim Universal Dividends +Claim Universal Dividends. #### transfer_ud - 1 @@ -804,7 +805,7 @@ value: BalanceOf<T> </details> -Transfer some liquid free balance to another account, in milliUD. +Transfer some liquid free balance to another account in milliUD and keep the account alive. ### Identity - 41 @@ -901,7 +902,15 @@ inc: bool </details> -change sufficient ref count for given key +Change sufficient reference count for a given key. + +This function allows a privileged root origin to increment or decrement the sufficient +reference count associated with a specified owner key. + +- `origin` - The origin of the call. It must be root. +- `owner_key` - The account whose sufficient reference count will be modified. +- `inc` - A boolean indicating whether to increment (`true`) or decrement (`false`) the count. + #### link_account - 8 @@ -916,7 +925,14 @@ payload_sig: T::Signature </details> -Link an account to an identity +Link an account to an identity. + +This function links a specified account to an identity, requiring both the account and the +identity to sign the operation. + +- `origin` - The origin of the call, which must have an associated identity index. +- `account_id` - The account ID to link, which must sign the payload. +- `payload_sig` - The signature with the linked identity. ### Certification - 43 @@ -961,7 +977,9 @@ receiver: T::IdtyIndex </details> -remove a certification (only root) +Remove one certification given the issuer and the receiver. + +- `origin`: Must be `Root`. #### remove_all_certs_received_by - 2 @@ -975,7 +993,9 @@ idty_index: T::IdtyIndex </details> -remove all certifications received by an identity (only root) +Remove all certifications received by an identity. + +- `origin`: Must be `Root`. ### Distance - 44 @@ -990,9 +1010,11 @@ Taking 0.0325 % of a block. </details> -Request caller identity to be evaluated -positive evaluation will result in claim/renew membership -negative evaluation will result in slash for caller +Request evaluation of the caller's identity distance. + +This function allows the caller to request an evaluation of their distance. +A positive evaluation will lead to claiming or renewing membership, while a negative +evaluation will result in slashing for the caller. #### request_distance_evaluation_for - 4 @@ -1006,8 +1028,10 @@ target: T::IdtyIndex </details> -Request target identity to be evaluated -only possible for unvalidated identity +Request evaluation of a target identity's distance. + +This function allows the caller to request an evaluation of a specific target identity's distance. +This action is only permitted for unvalidated identities. #### update_evaluation - 1 @@ -1021,8 +1045,10 @@ computation_result: ComputationResult </details> -(Inherent) Push an evaluation result to the pool -this is called internally by validators (= inherent) +Push an evaluation result to the pool. + +This inherent function is called internally by validators to push an evaluation result +to the evaluation pool. #### force_update_evaluation - 2 @@ -1037,7 +1063,11 @@ computation_result: ComputationResult </details> -Force push an evaluation result to the pool +Force push an evaluation result to the pool. + +It is primarily used for testing purposes. + +- `origin`: Must be `Root`. #### force_valid_distance_status - 3 @@ -1051,7 +1081,11 @@ identity: <T as pallet_identity::Config>::IdtyIndex </details> -Force set the distance evaluation status of an identity +Force set the distance evaluation status of an identity. + +It is primarily used for testing purposes. + +- `origin`: Must be `Root`. ### AtomicSwap - 50 @@ -1307,7 +1341,7 @@ salt: H256 </details> -Request a randomness +Request randomness. ### Proxy - 53 @@ -2161,7 +2195,7 @@ member_id: T::MemberId </details> -remove an identity from the set of authorities +Remove a member from the set of validators. ### Grandpa - 16 @@ -2269,7 +2303,13 @@ names: Vec<IdtyName> </details> -remove identity names from storage +Remove identity names from storage. + +This function allows a privileged root origin to remove multiple identity names from storage +in bulk. + +- `origin` - The origin of the call. It must be root. +- `names` - A vector containing the identity names to be removed from storage. ### Utility - 54 diff --git a/pallets/certification/src/types.rs b/pallets/certification/src/types.rs index a12f6b43599e0c9dac5fb83b4d0f94074f05a156..5a158f8a9aa9805df642eb1ed51be3a6c76cd1ea 100644 --- a/pallets/certification/src/types.rs +++ b/pallets/certification/src/types.rs @@ -20,7 +20,7 @@ use codec::{Decode, Encode}; use frame_support::pallet_prelude::*; use scale_info::TypeInfo; -/// Reprensent the certification metadata attached to an identity. +/// Represents the certification metadata attached to an identity. #[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub struct IdtyCertMeta<BlockNumber: Default> { /// Number of certifications issued by this identity. diff --git a/pallets/distance/src/median.rs b/pallets/distance/src/median.rs index feab0d863176a4d24e33b85856717346a1ec29a7..5569d6f26984e09b292b081071cb7378ab5ab12e 100644 --- a/pallets/distance/src/median.rs +++ b/pallets/distance/src/median.rs @@ -17,6 +17,7 @@ use frame_support::pallet_prelude::*; use sp_std::cmp::Ordering; +/// Represents a median accumulator. #[derive(Clone, Debug, Decode, Default, Encode, TypeInfo)] pub struct MedianAcc< T: Clone + Decode + Encode + Ord + TypeInfo, @@ -35,6 +36,7 @@ pub struct MedianAcc< fn type_info() -> scale_info::Type<scale_info::form::MetaForm> {} }*/ +/// Represents the result of a median calculation. #[derive(Clone, Debug, Eq, PartialEq)] pub enum MedianResult<T: Clone + Ord> { One(T), diff --git a/pallets/membership/src/lib.rs b/pallets/membership/src/lib.rs index 83950eb8398aa0590684807f17cd6d4cf2f22170..860d3bd25db0736968a4dac5a3b882b9fff70074 100644 --- a/pallets/membership/src/lib.rs +++ b/pallets/membership/src/lib.rs @@ -57,15 +57,16 @@ impl<IdtyId, AccountId> SetupBenchmark<IdtyId, AccountId> for () { fn add_cert(_issuer: &IdtyId, _receiver: &IdtyId) {} } +/// Represent reasons for the removal of membership. #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub enum MembershipRemovalReason { - // reach end of life + /// Indicates membership was removed because it reached the end of its life. Expired, - // was explicitly revoked + /// Indicates membership was explicitly revoked. Revoked, - // received certs count passed below threshold + /// Indicates membership was removed because the received certifications count fell below the threshold. NotEnoughCerts, - // system reasons (consumers, authority members, or root) + /// Indicates membership was removed due to system reasons (e.g., consumers, authority members, or root). System, } diff --git a/pallets/oneshot-account/src/check_nonce.rs b/pallets/oneshot-account/src/check_nonce.rs index 3f365453196738d0edbf4c8e74223ae82282f137..0f1a2fccfb0aade09db2606065a82120aa8cbc5d 100644 --- a/pallets/oneshot-account/src/check_nonce.rs +++ b/pallets/oneshot-account/src/check_nonce.rs @@ -25,6 +25,7 @@ use sp_runtime::{ transaction_validity::{TransactionValidity, TransactionValidityError}, }; +/// Wrapper around `frame_system::CheckNonce<T>`. #[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] #[scale_info(skip_type_params(Runtime))] pub struct CheckNonce<T: Config>(pub frame_system::CheckNonce<T>); diff --git a/pallets/smith-members/src/lib.rs b/pallets/smith-members/src/lib.rs index 9cede1d7c618b61fc70f8bfb07a4e95e24aaa07c..b9bf58af2cba92bcd7fa5d7a0a0ad3887832efa2 100644 --- a/pallets/smith-members/src/lib.rs +++ b/pallets/smith-members/src/lib.rs @@ -71,22 +71,27 @@ pub use pallet::*; use pallet_authority_members::SessionIndex; pub use types::*; +/// Reasons for the removal of a Smith identity. #[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub enum SmithRemovalReason { + /// Membership was lost due to expiration or other reasons. LostMembership, + /// Smith was offline for too long. OfflineTooLong, + /// Smith was blacklisted. Blacklisted, } +/// Possible statuses of a Smith identity. #[derive(Encode, Decode, Copy, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] pub enum SmithStatus { - /// The identity has been invited by a smith but has not accepted yet + /// The identity has been invited by a Smith but has not accepted yet. Invited, - /// The identity has accepted to eventually become a smith + /// The identity has accepted to eventually become a Smith. Pending, - /// The identity has reached the requirements to become a smith and can now goGoOnline() or invite/certify other smiths + /// The identity has reached the requirements to become a Smith and can now perform Smith operations. Smith, - /// The identity has been removed from the smiths set but is kept to keep track of its certifications + /// The identity has been removed from the Smiths set but is kept to track its certifications. Excluded, } diff --git a/primitives/distance/src/lib.rs b/primitives/distance/src/lib.rs index 1d4690942ba82b0bbb72500f24910bda56827146..9e67b72f8ba6b6b4dacba77b9dfb31871e2453a9 100644 --- a/primitives/distance/src/lib.rs +++ b/primitives/distance/src/lib.rs @@ -29,6 +29,7 @@ use std::marker::PhantomData; pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"distanc0"; +/// Represents the result of a distance computation. #[derive(Clone, Decode, Encode, PartialEq, RuntimeDebug, TypeInfo)] pub struct ComputationResult { pub distances: sp_std::vec::Vec<Perbill>, diff --git a/primitives/membership/src/lib.rs b/primitives/membership/src/lib.rs index c98121711ad55d7e3504356af62b1e1b5539e6b6..96e37af823353829e8014756053b371d5a77bb11 100644 --- a/primitives/membership/src/lib.rs +++ b/primitives/membership/src/lib.rs @@ -27,7 +27,7 @@ use frame_support::pallet_prelude::{RuntimeDebug, Weight}; use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; -/// membership events +/// Represent membership-related events. pub enum Event<IdtyId> { /// A membership was acquired. MembershipAdded(IdtyId), @@ -37,6 +37,7 @@ pub enum Event<IdtyId> { MembershipRenewed(IdtyId), } +/// Represent membership data. #[derive( Encode, Decode, diff --git a/resources/metadata.scale b/resources/metadata.scale index bf88b3ce9a6e05e2a98b8c43493369f717191571..cd7176512ddbd3d7cfa4b633e8d3ef6a071d0813 100644 Binary files a/resources/metadata.scale and b/resources/metadata.scale differ