diff --git a/substrate/client/executor/common/src/runtime_blob/globals_snapshot.rs b/substrate/client/executor/common/src/runtime_blob/globals_snapshot.rs index a43814e1d4..acdefef2e6 100644 --- a/substrate/client/executor/common/src/runtime_blob/globals_snapshot.rs +++ b/substrate/client/executor/common/src/runtime_blob/globals_snapshot.rs @@ -47,7 +47,9 @@ pub trait InstanceGlobals { /// A set of exposed mutable globals. /// /// This is set of globals required to create a [`GlobalsSnapshot`] and that are collected from -/// a runtime blob that was instrumented by [`InstrumentModule::expose_mutable_globals`]. +/// a runtime blob that was instrumented by +/// [`RuntimeBlob::expose_mutable_globals`](super::RuntimeBlob::expose_mutable_globals`). + /// /// If the code wasn't instrumented then it would be empty and snapshot would do nothing. pub struct ExposedMutableGlobalsSet(Vec); diff --git a/substrate/client/executor/wasmtime/src/runtime.rs b/substrate/client/executor/wasmtime/src/runtime.rs index 8389bb0876..0a3c0488a2 100644 --- a/substrate/client/executor/wasmtime/src/runtime.rs +++ b/substrate/client/executor/wasmtime/src/runtime.rs @@ -296,8 +296,8 @@ pub struct DeterministicStackLimit { /// after translation into machine code. It is also not quite trivial. /// /// Therefore, this number should be choosen conservatively. It must be so large so that it can - /// fit the [`logical_max`] logical values on the stack, according to the current instrumentation - /// algorithm. + /// fit the [`logical_max`](Self::logical_max) logical values on the stack, according to the current + /// instrumentation algorithm. /// /// This value cannot be 0. pub native_stack_max: u32, @@ -315,8 +315,9 @@ pub struct Semantics { /// This is not a problem for a standard substrate runtime execution because it's up to the /// runtime itself to make sure that it doesn't involve any non-determinism. /// - /// Since this feature depends on instrumentation, it can be set only if [`CodeSupplyMode::Verbatim`] - /// is used. + /// Since this feature depends on instrumentation, it can be set only if runtime is + /// instantiated using the runtime blob, e.g. using [`create_runtime`]. + // I.e. if [`CodeSupplyMode::Verbatim`] is used. pub fast_instance_reuse: bool, /// Specifiying `Some` will enable deterministic stack height. That is, all executor invocations @@ -326,8 +327,9 @@ pub struct Semantics { /// This is achieved by a combination of running an instrumentation pass on input code and /// configuring wasmtime accordingly. /// - /// Since this feature depends on instrumentation, it can be set only if [`CodeSupplyMode::Verbatim`] - /// is used. + /// Since this feature depends on instrumentation, it can be set only if runtime is + /// instantiated using the runtime blob, e.g. using [`create_runtime`]. + // I.e. if [`CodeSupplyMode::Verbatim`] is used. pub deterministic_stack_limit: Option, /// Controls whether wasmtime should compile floating point in a way that doesn't allow for diff --git a/substrate/client/network/src/config.rs b/substrate/client/network/src/config.rs index 36ae1e831b..a6aa5feea5 100644 --- a/substrate/client/network/src/config.rs +++ b/substrate/client/network/src/config.rs @@ -127,9 +127,9 @@ pub struct Params { /// Request response configuration for the state request protocol. /// /// Can be constructed either via - /// [`crate::state_requests::generate_protocol_config`] allowing outgoing but not + /// [`crate::block_request_handler::generate_protocol_config`] allowing outgoing but not /// incoming requests, or constructed via - /// [`crate::state_requests::handler::StateRequestHandler::new`] allowing + /// [`crate::state_request_handler::StateRequestHandler::new`] allowing /// both outgoing and incoming requests. pub state_request_protocol_config: RequestResponseConfig, } diff --git a/substrate/client/network/src/light_client_requests/handler.rs b/substrate/client/network/src/light_client_requests/handler.rs index c0932a4664..1cfae0a3cb 100644 --- a/substrate/client/network/src/light_client_requests/handler.rs +++ b/substrate/client/network/src/light_client_requests/handler.rs @@ -19,7 +19,8 @@ //! Helper for incoming light client requests. //! //! Handle (i.e. answer) incoming light client requests from a remote peer received via -//! [`crate::request_responses::RequestResponsesBehaviour`] with [`LightClientRequestHandler`]. +//! [`crate::request_responses::RequestResponsesBehaviour`] with +//! [`LightClientRequestHandler`](handler::LightClientRequestHandler). use codec::{self, Encode, Decode}; use crate::{ diff --git a/substrate/client/network/src/light_client_requests/sender.rs b/substrate/client/network/src/light_client_requests/sender.rs index 7cb224344a..77efa1b982 100644 --- a/substrate/client/network/src/light_client_requests/sender.rs +++ b/substrate/client/network/src/light_client_requests/sender.rs @@ -18,15 +18,16 @@ //! Helper for outgoing light client requests. //! -//! Call [`LightClientRequestSender::send_request`] to send out light client requests. It will: +//! Call [`LightClientRequestSender::request`](sender::LightClientRequestSender::request) +//! to send out light client requests. It will: //! //! 1. Build the request. //! //! 2. Forward the request to [`crate::request_responses::RequestResponsesBehaviour`] via -//! [`OutEvent::SendRequest`]. +//! [`OutEvent::SendRequest`](sender::OutEvent::SendRequest). //! //! 3. Wait for the response and forward the response via the [`futures::channel::oneshot::Sender`] provided earlier -//! with [`LightClientRequestSender::send_request`]. +//! with [`LightClientRequestSender::request`](sender::LightClientRequestSender::request). use codec::{self, Encode, Decode}; use crate::{ diff --git a/substrate/frame/contracts/rpc/runtime-api/src/lib.rs b/substrate/frame/contracts/rpc/runtime-api/src/lib.rs index 943931ec0c..bb65e1b837 100644 --- a/substrate/frame/contracts/rpc/runtime-api/src/lib.rs +++ b/substrate/frame/contracts/rpc/runtime-api/src/lib.rs @@ -39,7 +39,7 @@ sp_api::decl_runtime_apis! { { /// Perform a call from a specified account to a given contract. /// - /// See [`pallet_contracts::Pallet::call`]. + /// See `pallet_contracts::Pallet::call`. fn call( origin: AccountId, dest: AccountId, @@ -50,7 +50,7 @@ sp_api::decl_runtime_apis! { /// Instantiate a new contract. /// - /// See [`pallet_contracts::Pallet::instantiate`]. + /// See `pallet_contracts::Pallet::instantiate`. fn instantiate( origin: AccountId, endowment: Balance, diff --git a/substrate/frame/election-provider-multi-phase/src/lib.rs b/substrate/frame/election-provider-multi-phase/src/lib.rs index 65a31e8ee9..d66b971d80 100644 --- a/substrate/frame/election-provider-multi-phase/src/lib.rs +++ b/substrate/frame/election-provider-multi-phase/src/lib.rs @@ -126,7 +126,7 @@ //! //! A call to `T::ElectionProvider::elect` is made, and `Ok(_)` cannot be returned, then the pallet //! proceeds to the [`Phase::Emergency`]. During this phase, any solution can be submitted from -//! [`T::ForceOrigin`], without any checking. Once submitted, the forced solution is kept in +//! [`Config::ForceOrigin`], without any checking. Once submitted, the forced solution is kept in //! [`QueuedSolution`] until the next call to `T::ElectionProvider::elect`, where it is returned and //! [`Phase`] goes back to `Off`. //! diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index db4af14328..a3232ac0d2 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -402,8 +402,9 @@ pub mod pallet { /// origin is removed as a runner-up. /// - `origin` is a current member. In this case, the deposit is unreserved and origin is /// removed as a member, consequently not being a candidate for the next round anymore. - /// Similar to [`remove_members`], if replacement runners exists, they are immediately - /// used. If the prime is renouncing, then no prime will exist until the next round. + /// Similar to [`remove_member`](Self::remove_member), if replacement runners exists, + /// they are immediately used. If the prime is renouncing, then no prime will exist until + /// the next round. /// /// The dispatch origin of this call must be signed, and have one of the above roles. /// diff --git a/substrate/frame/elections/src/lib.rs b/substrate/frame/elections/src/lib.rs index b536713935..54bdb1f90d 100644 --- a/substrate/frame/elections/src/lib.rs +++ b/substrate/frame/elections/src/lib.rs @@ -484,8 +484,9 @@ pub mod pallet { /// Set candidate approvals. Approval slots stay valid as long as candidates in those slots /// are registered. /// - /// Locks `value` from the balance of `origin` indefinitely. Only [`retract_voter`] or - /// [`reap_inactive_voter`] can unlock the balance. + /// Locks `value` from the balance of `origin` indefinitely. Only + /// [`retract_voter`](Self::retract_voter) or + /// [`reap_inactive_voter`](Self::reap_inactive_voter) can unlock the balance. /// /// `hint` argument is interpreted differently based on: /// - if `origin` is setting approvals for the first time: The index will be checked for @@ -493,7 +494,7 @@ pub mod pallet { /// - if the hint is correctly pointing to a hole, no fee is deducted from `origin`. /// - Otherwise, the call will succeed but the index is ignored and simply a push to the /// last chunk with free space happens. If the new push causes a new chunk to be - /// created, a fee indicated by [`VotingFee`] is deducted. + /// created, a fee indicated by [`Config::VotingFee`] is deducted. /// - if `origin` is already a voter: the index __must__ be valid and point to the correct /// position of the `origin` in the current voters list. /// @@ -521,7 +522,11 @@ pub mod pallet { /// must now be either unregistered or registered to a candidate that registered the slot /// after the voter gave their last approval set. /// - /// Both indices must be provided as explained in [`voter_at`] function. + /// Both indices must be provided according to the following principle: + /// Voter index does not take holes into account. This means that any account submitting an + /// index at any point in time should submit: + /// `VOTER_SET_SIZE * set_index + local_index`, meaning that you are ignoring all holes in + /// the first `set_index` sets. /// /// May be called by anyone. Returns the voter deposit to `signed`. /// @@ -596,9 +601,13 @@ pub mod pallet { /// Remove a voter. All votes are cancelled and the voter deposit is returned. /// - /// The index must be provided as explained in [`voter_at`] function. + /// The index must be provided according to the following principle: + /// Voter index does not take holes into account. This means that any account submitting an + /// index at any point in time should submit: + /// `VOTER_SET_SIZE * set_index + local_index`, meaning that you are ignoring all holes in + /// the first `set_index` sets. /// - /// Also removes the lock on the balance of the voter. See [`do_set_approvals()`]. + /// Also removes the lock on the balance of the voter. /// /// # /// - O(1). @@ -624,8 +633,9 @@ pub mod pallet { /// /// Account must have enough transferrable funds in it to pay the bond. /// - /// NOTE: if `origin` has already assigned approvals via [`set_approvals`], - /// it will NOT have any usable funds to pass candidacy bond and must first retract. + /// NOTE: if `origin` has already assigned approvals via + /// [`set_approvals`](Self::set_approvals), it will NOT have any usable funds to pass + /// candidacy bond and must first retract. /// Note that setting approvals will lock the entire balance of the voter until /// retraction or being reported. /// diff --git a/substrate/frame/scheduler/src/lib.rs b/substrate/frame/scheduler/src/lib.rs index a3520f3b21..f1abea29e1 100644 --- a/substrate/frame/scheduler/src/lib.rs +++ b/substrate/frame/scheduler/src/lib.rs @@ -461,7 +461,7 @@ pub mod pallet { /// Schedule a named task after a delay. /// /// # - /// Same as [`schedule_named`]. + /// Same as [`schedule_named`](Self::schedule_named). /// # #[pallet::weight(::WeightInfo::schedule_named(T::MaxScheduledPerBlock::get()))] pub fn schedule_named_after( diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index 933aff0297..5095ed0154 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -241,7 +241,7 @@ pub trait SessionManager { /// Same as `new_session`, but it this should only be called at genesis. /// /// The session manager might decide to treat this in a different way. Default impl is simply - /// using [`new_session`]. + /// using [`new_session`](Self::new_session). fn new_session_genesis(new_index: SessionIndex) -> Option> { Self::new_session(new_index) } diff --git a/substrate/frame/staking/src/lib.rs b/substrate/frame/staking/src/lib.rs index 98db60d1b5..340e1a2a3f 100644 --- a/substrate/frame/staking/src/lib.rs +++ b/substrate/frame/staking/src/lib.rs @@ -1204,7 +1204,7 @@ pub mod pallet { /// The last planned session scheduled by the session pallet. /// - /// This is basically in sync with the call to [`SessionManager::new_session`]. + /// This is basically in sync with the call to [`pallet_session::SessionManager::new_session`]. #[pallet::storage] #[pallet::getter(fn current_planned_session)] pub type CurrentPlannedSession = StorageValue<_, SessionIndex, ValueQuery>; @@ -1511,8 +1511,8 @@ pub mod pallet { /// The dispatch origin for this call must be _Signed_ by the stash, not the controller. /// /// Use this if there are additional funds in your stash account that you wish to bond. - /// Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount - /// that can be added. + /// Unlike [`bond`](Self::bond) or [`unbond`](Self::unbond) this function does not impose any limitation + /// on the amount that can be added. /// /// Emits `Bonded`. /// @@ -1849,7 +1849,7 @@ pub mod pallet { /// The dispatch origin must be Root. /// /// # - /// Same as [`set_validator_count`]. + /// Same as [`Self::set_validator_count`]. /// # #[pallet::weight(T::WeightInfo::set_validator_count())] pub fn increase_validator_count( @@ -1866,7 +1866,7 @@ pub mod pallet { /// The dispatch origin must be Root. /// /// # - /// Same as [`set_validator_count`]. + /// Same as [`Self::set_validator_count`]. /// # #[pallet::weight(T::WeightInfo::set_validator_count())] pub fn scale_validator_count(origin: OriginFor, factor: Percent) -> DispatchResult { diff --git a/substrate/test-utils/test-runner/src/client.rs b/substrate/test-utils/test-runner/src/client.rs index 4c562fbc66..4cadfe58c6 100644 --- a/substrate/test-utils/test-runner/src/client.rs +++ b/substrate/test-utils/test-runner/src/client.rs @@ -64,7 +64,7 @@ pub enum ConfigOrChainSpec { /// Chain spec object ChainSpec(Box, TaskExecutor) } -/// Creates all the client parts you need for [`Node`] +/// Creates all the client parts you need for [`Node`](crate::node::Node) pub fn client_parts(config_or_chain_spec: ConfigOrChainSpec) -> Result, sc_service::Error> where T: ChainInfo + 'static, @@ -216,4 +216,4 @@ pub fn client_parts(config_or_chain_spec: ConfigOrChainSpec) -> Result