From d343683ca9af2c18fa248f0eb79ce2f1e0c71208 Mon Sep 17 00:00:00 2001 From: Guillaume Thiolliere <gui.thiolliere@gmail.com> Date: Tue, 23 Mar 2021 17:40:52 +0100 Subject: [PATCH] improve doc (#8437) --- substrate/frame/aura/src/lib.rs | 4 +- substrate/frame/contracts/src/lib.rs | 6 +- substrate/frame/democracy/src/lib.rs | 4 +- substrate/frame/elections-phragmen/src/lib.rs | 6 +- substrate/frame/identity/src/lib.rs | 4 +- substrate/frame/im-online/src/lib.rs | 6 +- substrate/frame/multisig/src/lib.rs | 4 +- substrate/frame/nicks/src/lib.rs | 4 +- substrate/frame/proxy/src/lib.rs | 13 +---- .../randomness-collective-flip/src/lib.rs | 2 +- substrate/frame/recovery/src/lib.rs | 4 +- substrate/frame/scheduler/src/lib.rs | 6 +- substrate/frame/scored-pool/src/lib.rs | 6 +- substrate/frame/session/src/lib.rs | 6 +- substrate/frame/society/src/lib.rs | 4 +- substrate/frame/staking/src/lib.rs | 58 +++++++++---------- substrate/frame/sudo/src/lib.rs | 6 +- substrate/frame/timestamp/src/lib.rs | 6 +- substrate/frame/treasury/src/lib.rs | 6 +- substrate/frame/utility/src/lib.rs | 7 +-- substrate/frame/vesting/src/lib.rs | 7 +-- 21 files changed, 75 insertions(+), 94 deletions(-) diff --git a/substrate/frame/aura/src/lib.rs b/substrate/frame/aura/src/lib.rs index 40d17115412..a9b91737235 100644 --- a/substrate/frame/aura/src/lib.rs +++ b/substrate/frame/aura/src/lib.rs @@ -17,8 +17,8 @@ //! # Aura Module //! -//! - [`aura::Config`](./trait.Config.html) -//! - [`Module`](./struct.Module.html) +//! - [`Config`] +//! - [`Pallet`] //! //! ## Overview //! diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index 880bf0b8982..496d5f5d080 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -19,8 +19,8 @@ //! //! The Contract module provides functionality for the runtime to deploy and execute WebAssembly smart-contracts. //! -//! - [`contract::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! @@ -336,7 +336,7 @@ pub mod pallet { /// * `gas_limit`: The gas limit enforced when executing the constructor. /// * `code`: The contract code to deploy in raw bytes. /// * `data`: The input data to pass to the contract constructor. - /// * `salt`: Used for the address derivation. See [`Self::contract_address`]. + /// * `salt`: Used for the address derivation. See [`Pallet::contract_address`]. /// /// Instantiation is executed as follows: /// diff --git a/substrate/frame/democracy/src/lib.rs b/substrate/frame/democracy/src/lib.rs index 8790e0e487b..37a2fd5ce7c 100644 --- a/substrate/frame/democracy/src/lib.rs +++ b/substrate/frame/democracy/src/lib.rs @@ -17,8 +17,8 @@ //! # Democracy Pallet //! -//! - [`democracy::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index 26b9c9190a9..5031cb57e64 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -92,9 +92,9 @@ //! //! ### Module Information //! -//! - [`election_sp_phragmen::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) -//! - [`Module`](./struct.Module.html) +//! - [`Config`] +//! - [`Call`] +//! - [`Module`] #![cfg_attr(not(feature = "std"), no_std)] diff --git a/substrate/frame/identity/src/lib.rs b/substrate/frame/identity/src/lib.rs index fed32afa2e6..6d6e3170d51 100644 --- a/substrate/frame/identity/src/lib.rs +++ b/substrate/frame/identity/src/lib.rs @@ -17,8 +17,8 @@ //! # Identity Module //! -//! - [`identity::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! diff --git a/substrate/frame/im-online/src/lib.rs b/substrate/frame/im-online/src/lib.rs index ec8c6218b3f..d8f3fdc854b 100644 --- a/substrate/frame/im-online/src/lib.rs +++ b/substrate/frame/im-online/src/lib.rs @@ -30,9 +30,9 @@ //! as the [NetworkState](../../client/offchain/struct.NetworkState.html). //! It is submitted as an Unsigned Transaction via off-chain workers. //! -//! - [`im_online::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) -//! - [`Module`](./struct.Module.html) +//! - [`Config`] +//! - [`Call`] +//! - [`Module`] //! //! ## Interface //! diff --git a/substrate/frame/multisig/src/lib.rs b/substrate/frame/multisig/src/lib.rs index 3b434ec4840..1d3a83ccb68 100644 --- a/substrate/frame/multisig/src/lib.rs +++ b/substrate/frame/multisig/src/lib.rs @@ -18,8 +18,8 @@ //! # Multisig Module //! A module for doing multisig dispatch. //! -//! - [`multisig::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! diff --git a/substrate/frame/nicks/src/lib.rs b/substrate/frame/nicks/src/lib.rs index 6dee9ba79a6..02eb488c1b2 100644 --- a/substrate/frame/nicks/src/lib.rs +++ b/substrate/frame/nicks/src/lib.rs @@ -17,8 +17,8 @@ //! # Nicks Module //! -//! - [`nicks::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! diff --git a/substrate/frame/proxy/src/lib.rs b/substrate/frame/proxy/src/lib.rs index 5600fb6ea80..5e63e0cd8d3 100644 --- a/substrate/frame/proxy/src/lib.rs +++ b/substrate/frame/proxy/src/lib.rs @@ -23,17 +23,8 @@ //! wish to execute some duration prior to execution happens. In this case, the target account may //! reject the announcement and in doing so, veto the execution. //! -//! - [`proxy::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) -//! -//! ## Overview -//! -//! ## Interface -//! -//! ### Dispatchable Functions -//! -//! [`Call`]: ./enum.Call.html -//! [`Config`]: ./trait.Config.html +//! - [`Config`] +//! - [`Call`] // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/substrate/frame/randomness-collective-flip/src/lib.rs b/substrate/frame/randomness-collective-flip/src/lib.rs index 3e37a03b2e2..5ef76a33c21 100644 --- a/substrate/frame/randomness-collective-flip/src/lib.rs +++ b/substrate/frame/randomness-collective-flip/src/lib.rs @@ -25,7 +25,7 @@ //! //! ## Public Functions //! -//! See the [`Module`](./struct.Module.html) struct for details of publicly available functions. +//! See the [`Module`] struct for details of publicly available functions. //! //! ## Usage //! diff --git a/substrate/frame/recovery/src/lib.rs b/substrate/frame/recovery/src/lib.rs index 20e984c98d0..cb991e64945 100644 --- a/substrate/frame/recovery/src/lib.rs +++ b/substrate/frame/recovery/src/lib.rs @@ -17,8 +17,8 @@ //! # Recovery Pallet //! -//! - [`recovery::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! diff --git a/substrate/frame/scheduler/src/lib.rs b/substrate/frame/scheduler/src/lib.rs index abce8504e5a..9848c9853d0 100644 --- a/substrate/frame/scheduler/src/lib.rs +++ b/substrate/frame/scheduler/src/lib.rs @@ -18,9 +18,9 @@ //! # Scheduler //! A module for scheduling dispatches. //! -//! - [`scheduler::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) -//! - [`Module`](./struct.Module.html) +//! - [`Config`] +//! - [`Call`] +//! - [`Module`] //! //! ## Overview //! diff --git a/substrate/frame/scored-pool/src/lib.rs b/substrate/frame/scored-pool/src/lib.rs index ce2279b1500..da26872a007 100644 --- a/substrate/frame/scored-pool/src/lib.rs +++ b/substrate/frame/scored-pool/src/lib.rs @@ -37,9 +37,9 @@ //! from the `Pool` and `Members`; the entity is immediately replaced //! by the next highest scoring candidate in the pool, if available. //! -//! - [`scored_pool::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) -//! - [`Module`](./struct.Module.html) +//! - [`Config`] +//! - [`Call`] +//! - [`Module`] //! //! ## Interface //! diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index d9d5c81e8a5..e7b16808f72 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -20,9 +20,9 @@ //! The Session module allows validators to manage their session keys, provides a function for //! changing the session length, and handles session rotation. //! -//! - [`session::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) -//! - [`Module`](./struct.Module.html) +//! - [`Config`] +//! - [`Call`] +//! - [`Module`] //! //! ## Overview //! diff --git a/substrate/frame/society/src/lib.rs b/substrate/frame/society/src/lib.rs index 3546ea68d4d..a5ba2124c88 100644 --- a/substrate/frame/society/src/lib.rs +++ b/substrate/frame/society/src/lib.rs @@ -17,8 +17,8 @@ //! # Society Module //! -//! - [`society::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! diff --git a/substrate/frame/staking/src/lib.rs b/substrate/frame/staking/src/lib.rs index 77ef928b92a..fe1738ca333 100644 --- a/substrate/frame/staking/src/lib.rs +++ b/substrate/frame/staking/src/lib.rs @@ -19,9 +19,9 @@ //! //! The Staking module is used to manage funds at stake by network maintainers. //! -//! - [`staking::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) -//! - [`Module`](./struct.Module.html) +//! - [`Config`] +//! - [`Call`] +//! - [`Module`] //! //! ## Overview //! @@ -65,16 +65,16 @@ //! is paired with an active **controller** account, which issues instructions on how they shall be //! used. //! -//! An account pair can become bonded using the [`bond`](./enum.Call.html#variant.bond) call. +//! An account pair can become bonded using the [`bond`](Call::bond) call. //! //! Stash accounts can change their associated controller using the -//! [`set_controller`](./enum.Call.html#variant.set_controller) call. +//! [`set_controller`](Call::set_controller) call. //! //! There are three possible roles that any staked account pair can be in: `Validator`, `Nominator` -//! and `Idle` (defined in [`StakerStatus`](./enum.StakerStatus.html)). There are three +//! and `Idle` (defined in [`StakerStatus`]). There are three //! corresponding instructions to change between roles, namely: -//! [`validate`](./enum.Call.html#variant.validate), -//! [`nominate`](./enum.Call.html#variant.nominate), and [`chill`](./enum.Call.html#variant.chill). +//! [`validate`](Call::validate), +//! [`nominate`](Call::nominate), and [`chill`](Call::chill). //! //! #### Validating //! @@ -86,7 +86,7 @@ //! by nominators and their votes. //! //! An account can become a validator candidate via the -//! [`validate`](./enum.Call.html#variant.validate) call. +//! [`validate`](Call::validate) call. //! //! #### Nomination //! @@ -98,7 +98,7 @@ //! the misbehaving/offline validators as much as possible, simply because the nominators will also //! lose funds if they vote poorly. //! -//! An account can become a nominator via the [`nominate`](enum.Call.html#variant.nominate) call. +//! An account can become a nominator via the [`nominate`](Call::nominate) call. //! //! #### Rewards and Slash //! @@ -127,7 +127,7 @@ //! This means that if they are a nominator, they will not be considered as voters anymore and if //! they are validators, they will no longer be a candidate for the next election. //! -//! An account can step back via the [`chill`](enum.Call.html#variant.chill) call. +//! An account can step back via the [`chill`](Call::chill) call. //! //! ### Session managing //! @@ -175,7 +175,7 @@ //! ### Era payout //! //! The era payout is computed using yearly inflation curve defined at -//! [`T::RewardCurve`](./trait.Config.html#associatedtype.RewardCurve) as such: +//! [`Config::EraPayout`] as such: //! //! ```nocompile //! staker_payout = yearly_inflation(npos_token_staked / total_tokens) * total_tokens / era_per_year @@ -186,7 +186,7 @@ //! remaining_payout = max_yearly_inflation * total_tokens / era_per_year - staker_payout //! ``` //! The remaining reward is send to the configurable end-point -//! [`T::RewardRemainder`](./trait.Config.html#associatedtype.RewardRemainder). +//! [`Config::RewardRemainder`]. //! //! ### Reward Calculation //! @@ -198,29 +198,28 @@ //! //! Total reward is split among validators and their nominators depending on the number of points //! they received during the era. Points are added to a validator using -//! [`reward_by_ids`](./enum.Call.html#variant.reward_by_ids) or -//! [`reward_by_indices`](./enum.Call.html#variant.reward_by_indices). +//! [`reward_by_ids`](Module::reward_by_ids). //! -//! [`Module`](./struct.Module.html) implements -//! [`pallet_authorship::EventHandler`](../pallet_authorship/trait.EventHandler.html) to add reward +//! [`Module`] implements +//! [`pallet_authorship::EventHandler`] to add reward //! points to block producer and block producer of referenced uncles. //! //! The validator and its nominator split their reward as following: //! //! The validator can declare an amount, named -//! [`commission`](./struct.ValidatorPrefs.html#structfield.commission), that does not get shared +//! [`commission`](ValidatorPrefs::commission), that does not get shared //! with the nominators at each reward payout through its -//! [`ValidatorPrefs`](./struct.ValidatorPrefs.html). This value gets deducted from the total reward +//! [`ValidatorPrefs`]. This value gets deducted from the total reward //! that is paid to the validator and its nominators. The remaining portion is split among the //! validator and all of the nominators that nominated the validator, proportional to the value //! staked behind this validator (_i.e._ dividing the -//! [`own`](./struct.Exposure.html#structfield.own) or -//! [`others`](./struct.Exposure.html#structfield.others) by -//! [`total`](./struct.Exposure.html#structfield.total) in [`Exposure`](./struct.Exposure.html)). +//! [`own`](Exposure::own) or +//! [`others`](Exposure::others) by +//! [`total`](Exposure::total) in [`Exposure`]). //! //! All entities who receive a reward have the option to choose their reward destination through the -//! [`Payee`](./struct.Payee.html) storage item (see -//! [`set_payee`](enum.Call.html#variant.set_payee)), to be one of the following: +//! [`Payee`] storage item (see +//! [`set_payee`](Call::set_payee)), to be one of the following: //! //! - Controller account, (obviously) not increasing the staked value. //! - Stash account, not increasing the staked value. @@ -231,15 +230,15 @@ //! Any funds already placed into stash can be the target of the following operations: //! //! The controller account can free a portion (or all) of the funds using the -//! [`unbond`](enum.Call.html#variant.unbond) call. Note that the funds are not immediately +//! [`unbond`](Call::unbond) call. Note that the funds are not immediately //! accessible. Instead, a duration denoted by -//! [`BondingDuration`](./trait.Config.html#associatedtype.BondingDuration) (in number of eras) must +//! [`Config::BondingDuration`] (in number of eras) must //! pass until the funds can actually be removed. Once the `BondingDuration` is over, the -//! [`withdraw_unbonded`](./enum.Call.html#variant.withdraw_unbonded) call can be used to actually +//! [`withdraw_unbonded`](Call::withdraw_unbonded) call can be used to actually //! withdraw the funds. //! //! Note that there is a limitation to the number of fund-chunks that can be scheduled to be -//! unlocked in the future via [`unbond`](enum.Call.html#variant.unbond). In case this maximum +//! unlocked in the future via [`unbond`](Call::unbond). In case this maximum //! (`MAX_UNLOCKING_CHUNKS`) is reached, the bonded account _must_ first wait until a successful //! call to `withdraw_unbonded` to remove some of the chunks. //! @@ -256,7 +255,7 @@ //! //! ## GenesisConfig //! -//! The Staking module depends on the [`GenesisConfig`](./struct.GenesisConfig.html). The +//! The Staking module depends on the [`GenesisConfig`]. The //! `GenesisConfig` is optional and allow to set some initial stakers. //! //! ## Related Modules @@ -2471,7 +2470,6 @@ impl<T: Config> Module<T> { /// relatively to their points. /// /// COMPLEXITY: Complexity is `number_of_validator_to_reward x current_elected_len`. - /// If you need to reward lots of validator consider using `reward_by_indices`. pub fn reward_by_ids( validators_points: impl IntoIterator<Item = (T::AccountId, u32)> ) { diff --git a/substrate/frame/sudo/src/lib.rs b/substrate/frame/sudo/src/lib.rs index c7cc38a81c1..53797d8cfc1 100644 --- a/substrate/frame/sudo/src/lib.rs +++ b/substrate/frame/sudo/src/lib.rs @@ -17,8 +17,8 @@ //! # Sudo Module //! -//! - [`sudo::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! @@ -81,8 +81,6 @@ //! //! * [Democracy](../pallet_democracy/index.html) //! -//! [`Call`]: ./enum.Call.html -//! [`Config`]: ./trait.Config.html //! [`Origin`]: https://docs.substrate.dev/docs/substrate-types #![cfg_attr(not(feature = "std"), no_std)] diff --git a/substrate/frame/timestamp/src/lib.rs b/substrate/frame/timestamp/src/lib.rs index 002a8d1c989..d4675511968 100644 --- a/substrate/frame/timestamp/src/lib.rs +++ b/substrate/frame/timestamp/src/lib.rs @@ -19,9 +19,9 @@ //! //! The Timestamp pallet provides functionality to get and set the on-chain time. //! -//! - [`timestamp::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) -//! - [`Pallet`](./struct.Pallet.html) +//! - [`Config`] +//! - [`Call`] +//! - [`Pallet`] //! //! ## Overview //! diff --git a/substrate/frame/treasury/src/lib.rs b/substrate/frame/treasury/src/lib.rs index b5e2c7881bb..46098c14fb1 100644 --- a/substrate/frame/treasury/src/lib.rs +++ b/substrate/frame/treasury/src/lib.rs @@ -20,8 +20,8 @@ //! The Treasury module provides a "pot" of funds that can be managed by stakeholders in the system //! and a structure for making spending proposals from this pot. //! -//! - [`treasury::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! @@ -53,7 +53,7 @@ //! //! ## GenesisConfig //! -//! The Treasury module depends on the [`GenesisConfig`](./struct.GenesisConfig.html). +//! The Treasury module depends on the [`GenesisConfig`]. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/substrate/frame/utility/src/lib.rs b/substrate/frame/utility/src/lib.rs index 28345e5ffe7..f76c7252a8e 100644 --- a/substrate/frame/utility/src/lib.rs +++ b/substrate/frame/utility/src/lib.rs @@ -18,8 +18,8 @@ //! # Utility Module //! A stateless module with helpers for dispatch management which does no re-authentication. //! -//! - [`utility::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! @@ -48,9 +48,6 @@ //! //! #### For pseudonymal dispatch //! * `as_derivative` - Dispatch a call from a derivative signed origin. -//! -//! [`Call`]: ./enum.Call.html -//! [`Config`]: ./trait.Config.html // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/substrate/frame/vesting/src/lib.rs b/substrate/frame/vesting/src/lib.rs index 7b725f7486d..98f6067a687 100644 --- a/substrate/frame/vesting/src/lib.rs +++ b/substrate/frame/vesting/src/lib.rs @@ -17,8 +17,8 @@ //! # Vesting Module //! -//! - [`vesting::Config`](./trait.Config.html) -//! - [`Call`](./enum.Call.html) +//! - [`Config`] +//! - [`Call`] //! //! ## Overview //! @@ -41,9 +41,6 @@ //! - `vest` - Update the lock, reducing it in line with the amount "vested" so far. //! - `vest_other` - Update the lock of another account, reducing it in line with the amount //! "vested" so far. -//! -//! [`Call`]: ./enum.Call.html -//! [`Config`]: ./trait.Config.html #![cfg_attr(not(feature = "std"), no_std)] -- GitLab