Fix some doc link (#10329)

* fix some doc link

* fmt
This commit is contained in:
Guillaume Thiolliere
2021-11-22 19:48:53 +09:00
committed by GitHub
parent cac9d85cb3
commit fcfb766366
25 changed files with 52 additions and 46 deletions
+2 -2
View File
@@ -27,9 +27,9 @@
//! started via the [`start_mining_worker`] function. It returns a worker
//! handle together with a future. The future must be pulled. Through
//! the worker handle, you can pull the metadata needed to start the
//! mining process via [`MiningWorker::metadata`], and then do the actual
//! mining process via [`MiningHandle::metadata`], and then do the actual
//! mining on a standalone thread. Finally, when a seal is found, call
//! [`MiningWorker::submit`] to build the block.
//! [`MiningHandle::submit`] to build the block.
//!
//! The auxiliary storage for PoW engine only stores the total difficulty.
//! For other storage requirements for particular PoW algorithm (such as
@@ -459,11 +459,11 @@ pub struct Config {
/// The total amount of memory in bytes an instance can request.
///
/// If specified, the runtime will be able to allocate only that much of wasm memory.
/// This is the total number and therefore the [`heap_pages`] is accounted for.
/// This is the total number and therefore the [`Config::heap_pages`] is accounted for.
///
/// That means that the initial number of pages of a linear memory plus the [`heap_pages`]
/// multiplied by the wasm page size (64KiB) should be less than or equal to `max_memory_size`,
/// otherwise the instance won't be created.
/// That means that the initial number of pages of a linear memory plus the
/// [`Config::heap_pages`] multiplied by the wasm page size (64KiB) should be less than or
/// equal to `max_memory_size`, otherwise the instance won't be created.
///
/// Moreover, `memory.grow` will fail (return -1) if the sum of sizes of currently mounted
/// and additional pages exceeds `max_memory_size`.
+1 -1
View File
@@ -440,7 +440,7 @@ enum Register {
/// Report a telemetry.
///
/// Translates to [`tracing::info`], but contains an additional verbosity parameter which the log
/// Translates to `tracing::info`, but contains an additional verbosity parameter which the log
/// record is tagged with. Additionally the verbosity parameter is added to the record as a
/// key-value pair.
///
+6 -5
View File
@@ -19,11 +19,11 @@
//!
//! A semi-sorted list, where items hold an `AccountId` based on some `VoteWeight`. The `AccountId`
//! (`id` for short) might be synonym to a `voter` or `nominator` in some context, and `VoteWeight`
//! signifies the chance of each id being included in the final [`VoteWeightProvider::iter`].
//! signifies the chance of each id being included in the final [`SortedListProvider::iter`].
//!
//! It implements [`sp_election_provider_support::SortedListProvider`] to provide a semi-sorted list
//! of accounts to another pallet. It needs some other pallet to give it some information about the
//! weights of accounts via [`sp_election_provider_support::VoteWeightProvider`].
//! It implements [`frame_election_provider_support::SortedListProvider`] to provide a semi-sorted
//! list of accounts to another pallet. It needs some other pallet to give it some information about
//! the weights of accounts via [`frame_election_provider_support::VoteWeightProvider`].
//!
//! This pallet is not configurable at genesis. Whoever uses it should call appropriate functions of
//! the `SortedListProvider` (e.g. `on_insert`, or `regenerate`) at their genesis.
@@ -38,7 +38,8 @@
//!
//! # Details
//!
//! - items are kept in bags, which are delineated by their range of weight (See [`BagThresholds`]).
//! - items are kept in bags, which are delineated by their range of weight (See
//! [`Config::BagThresholds`]).
//! - for iteration, bags are chained together from highest to lowest and elements within the bag
//! are iterated from head to tail.
//! - items within a bag are iterated in order of insertion. Thus removing an item and re-inserting
+3 -3
View File
@@ -17,8 +17,8 @@
//! Implementation of a "bags list": a semi-sorted list where ordering granularity is dictated by
//! configurable thresholds that delineate the boundaries of bags. It uses a pattern of composite
//! data structures, where multiple storage items are masked by one outer API. See [`ListNodes`],
//! [`ListBags`] for more information.
//! data structures, where multiple storage items are masked by one outer API. See
//! [`crate::ListNodes`], [`crate::ListBags`] for more information.
//!
//! The outer API of this module is the [`List`] struct. It wraps all acceptable operations on top
//! of the aggregate linked list. All operations with the bags list should happen through this
@@ -460,7 +460,7 @@ impl<T: Config> List<T> {
}
}
/// A Bag is a doubly-linked list of ids, where each id is mapped to a [`ListNode`].
/// A Bag is a doubly-linked list of ids, where each id is mapped to a [`Node`].
///
/// Note that we maintain both head and tail pointers. While it would be possible to get away with
/// maintaining only a head pointer and cons-ing elements onto the front of the list, it's more
@@ -44,7 +44,8 @@ pub type Hash = [u8; 32];
/// Generic hasher trait.
///
/// Implement the function to support custom way of hashing data.
/// The implementation must return a [Hash] type, so only 32-byte output hashes are supported.
/// The implementation must return a [Hash](type@Hash) type, so only 32-byte output hashes are
/// supported.
pub trait Hasher {
/// Hash given arbitrary-length piece of data.
fn hash(data: &[u8]) -> Hash;
@@ -173,7 +174,7 @@ impl Visitor for () {
///
/// # Panic
///
/// The function will panic if given [`leaf_index`] is greater than the number of leaves.
/// The function will panic if given `leaf_index` is greater than the number of leaves.
pub fn merkle_proof<H, I, T>(leaves: I, leaf_index: usize) -> MerkleProof<T>
where
H: Hasher,
+1 -1
View File
@@ -149,7 +149,7 @@ pub mod pallet {
/// Details of next BEEFY authority set.
///
/// This storage entry is used as cache for calls to [`update_beefy_next_authority_set`].
/// This storage entry is used as cache for calls to `update_beefy_next_authority_set`.
#[pallet::storage]
#[pallet::getter(fn beefy_next_authorities)]
pub type BeefyNextAuthorities<T: Config> =
+3 -3
View File
@@ -1266,21 +1266,21 @@ macro_rules! impl_benchmark_test {
/// fn bench_accumulate_dummy() {
/// new_test_ext().execute_with(|| {
/// assert_ok!(test_benchmark_accumulate_dummy::<Test>());
/// }
/// })
/// }
///
/// #[test]
/// fn bench_set_dummy() {
/// new_test_ext().execute_with(|| {
/// assert_ok!(test_benchmark_set_dummy::<Test>());
/// }
/// })
/// }
///
/// #[test]
/// fn bench_sort_vector() {
/// new_test_ext().execute_with(|| {
/// assert_ok!(test_benchmark_sort_vector::<Test>());
/// }
/// })
/// }
/// }
/// ```
+1 -1
View File
@@ -202,7 +202,7 @@ pub mod pallet {
type Schedule: Get<Schedule<Self>>;
/// The deposit that must be placed into the contract's account to instantiate it.
/// This is in **addition** to the [`pallet_balances::Pallet::ExistenialDeposit`].
/// This is in **addition** to the [`Currency::minimum_balance`].
/// The minimum balance for a contract's account can be queried using
/// [`Pallet::subsistence_threshold`].
#[pallet::constant]
@@ -183,8 +183,8 @@
//! are helpful for logging and are thus nested as:
//! - [`ElectionError::Miner`]: wraps a [`unsigned::MinerError`].
//! - [`ElectionError::Feasibility`]: wraps a [`FeasibilityError`].
//! - [`ElectionError::OnChainFallback`]: wraps a
//! [`frame_election_provider_support::onchain::Error`].
//! - [`ElectionError::Fallback`]: wraps a fallback error.
//! - [`ElectionError::DataProvider`]: wraps a static str.
//!
//! Note that there could be an overlap between these sub-errors. For example, A
//! `SnapshotUnavailable` can happen in both miner and feasibility check phase.
@@ -1244,14 +1244,14 @@ impl<T: Config> Pallet<T> {
}
}
/// Logic for [`<Pallet as Hooks>::on_initialize`] when signed phase is being opened.
/// Logic for `<Pallet as Hooks>::on_initialize` when signed phase is being opened.
pub fn on_initialize_open_signed() {
log!(info, "Starting signed phase round {}.", Self::round());
<CurrentPhase<T>>::put(Phase::Signed);
Self::deposit_event(Event::SignedPhaseStarted { round: Self::round() });
}
/// Logic for [`<Pallet as Hooks<T>>::on_initialize`] when unsigned phase is being opened.
/// Logic for `<Pallet as Hooks<T>>::on_initialize` when unsigned phase is being opened.
pub fn on_initialize_open_unsigned(enabled: bool, now: T::BlockNumber) {
let round = Self::round();
log!(info, "Starting unsigned phase round {} enabled {}.", round, enabled);
@@ -384,7 +384,7 @@ pub trait NposSolver {
) -> Result<ElectionResult<Self::AccountId, Self::Accuracy>, Self::Error>;
}
/// A wrapper for [`sp_npos_elections::seq_phragmen`] that implements [`super::NposSolver`]. See the
/// A wrapper for [`sp_npos_elections::seq_phragmen`] that implements [`NposSolver`]. See the
/// documentation of [`sp_npos_elections::seq_phragmen`] for more info.
pub struct SequentialPhragmen<AccountId, Accuracy, Balancing = ()>(
sp_std::marker::PhantomData<(AccountId, Accuracy, Balancing)>,
@@ -408,8 +408,8 @@ impl<
}
}
/// A wrapper for [`sp_npos_elections::phragmms`] that implements [`NposSolver`]. See the
/// documentation of [`sp_npos_elections::phragmms`] for more info.
/// A wrapper for [`sp_npos_elections::phragmms()`] that implements [`NposSolver`]. See the
/// documentation of [`sp_npos_elections::phragmms()`] for more info.
pub struct PhragMMS<AccountId, Accuracy, Balancing = ()>(
sp_std::marker::PhantomData<(AccountId, Accuracy, Balancing)>,
);
@@ -57,7 +57,7 @@ pub struct OnChainSequentialPhragmen<T: Config>(PhantomData<T>);
///
/// WARNING: the user of this pallet must ensure that the `Accuracy` type will work nicely with the
/// normalization operation done inside `seq_phragmen`. See
/// [`sp_npos_elections::assignment::try_normalize`] for more info.
/// [`sp_npos_elections::Assignment::try_normalize`] for more info.
pub trait Config: frame_system::Config {
/// The accuracy used to compute the election:
type Accuracy: PerThing128;
+1 -1
View File
@@ -219,7 +219,7 @@ where
weight
}
/// Execute given block, but don't do any of the [`final_checks`].
/// Execute given block, but don't do any of the `final_checks`.
///
/// Should only be used for testing.
#[cfg(feature = "try-runtime")]
+3 -2
View File
@@ -69,7 +69,8 @@ pub mod pallet {
/// Convert a balance into a number used for election calculation. This must fit into a
/// `u64` but is allowed to be sensibly lossy. The `u64` is used to communicate with the
/// [`sp_npos_elections`] crate which accepts u64 numbers and does operations in 128.
/// [`frame_election_provider_support`] crate which accepts u64 numbers and does operations
/// in 128.
/// Consequently, the backward convert is used convert the u128s from sp-elections back to a
/// [`BalanceOf`].
type CurrencyToVote: CurrencyToVote<BalanceOf<Self>>;
@@ -146,7 +147,7 @@ pub mod pallet {
type OffendingValidatorsThreshold: Get<Perbill>;
/// Something that can provide a sorted list of voters in a somewhat sorted way. The
/// original use case for this was designed with [`pallet_bags_list::Pallet`] in mind. If
/// original use case for this was designed with `pallet_bags_list::Pallet` in mind. If
/// the bags-list is not desired, [`impls::UseNominatorsMap`] is likely the desired option.
type SortedListProvider: SortedListProvider<Self::AccountId>;
@@ -84,6 +84,7 @@
//! }]
//! pattern = [{ System: frame_system }]
//! tokens = [{ ::{Pallet, Call} }]
//! }
//! }]
//! pattern = [{ Balances: pallet_balances }]
//! tokens = [{ ::{Pallet, Call} }]
+1 -1
View File
@@ -1749,7 +1749,7 @@ pub mod pallet_prelude {
/// ```
///
/// The optional attribute `#[pallet::unbounded]` allows to declare the storage as unbounded.
/// When implementating the storage info (when #[pallet::generate_storage_info]` is specified
/// When implementating the storage info (when `#[pallet::generate_storage_info]` is specified
/// on the pallet struct placeholder), the size of the storage will be declared as unbounded.
/// This can be useful for storage which can never go into PoV (Proof of Validity).
///
@@ -130,7 +130,7 @@ impl<T, S> BoundedVec<T, S> {
self.0.retain(f)
}
/// Exactly the same semantics as [`Vec::get_mut`].
/// Exactly the same semantics as [`slice::get_mut`].
pub fn get_mut<I: SliceIndex<[T]>>(
&mut self,
index: I,
@@ -90,7 +90,7 @@ impl<T, S> WeakBoundedVec<T, S> {
self.0.retain(f)
}
/// Exactly the same semantics as [`Vec::get_mut`].
/// Exactly the same semantics as [`slice::get_mut`].
pub fn get_mut<I: SliceIndex<[T]>>(
&mut self,
index: I,
+1 -1
View File
@@ -301,7 +301,7 @@ pub trait PrivilegeCmp<Origin> {
/// Implementation of [`PrivilegeCmp`] that only checks for equal origins.
///
/// This means it will either return [`Origin::Equal`] or `None`.
/// This means it will either return [`Ordering::Equal`] or `None`.
pub struct EqualPrivilegeOnly;
impl<Origin: PartialEq> PrivilegeCmp<Origin> for EqualPrivilegeOnly {
fn cmp_privilege(left: &Origin, right: &Origin) -> Option<Ordering> {
+2 -1
View File
@@ -301,7 +301,8 @@ pub mod pallet {
/// What to do if the runtime wants to change the code to something new.
///
/// The default (`()`) implementation is responsible for setting the correct storage
/// entry and emitting corresponding event and log item. (see [`update_code_in_storage`]).
/// entry and emitting corresponding event and log item. (see
/// [`Pallet::update_code_in_storage`]).
/// It's unlikely that this needs to be customized, unless you are writing a parachain using
/// `Cumulus`, where the actual code change is deferred.
type OnSetCode: SetCode<Self>;
+5 -4
View File
@@ -21,7 +21,8 @@ use crate::{crypto::Signature, ValidatorSetId};
/// A commitment signed by GRANDPA validators as part of BEEFY protocol.
///
/// The commitment contains a [payload] extracted from the finalized block at height [block_number].
/// The commitment contains a [payload](Commitment::payload) extracted from the finalized block at
/// height [block_number](Commitment::block_number).
/// GRANDPA validators collect signatures on commitments and a stream of such signed commitments
/// (see [SignedCommitment]) forms the BEEFY protocol.
#[derive(Clone, Debug, PartialEq, Eq, codec::Encode, codec::Decode)]
@@ -33,7 +34,7 @@ pub struct Commitment<TBlockNumber, TPayload> {
/// validator set. The protocol does not enforce any particular format of this data,
/// nor how often it should be present in commitments, however the light client has to be
/// provided with full validator set whenever it performs the transition (i.e. importing first
/// block with [validator_set_id] incremented).
/// block with [validator_set_id](Commitment::validator_set_id) incremented).
pub payload: TPayload,
/// Finalized block number this commitment is for.
@@ -51,8 +52,8 @@ pub struct Commitment<TBlockNumber, TPayload> {
///
/// Validator set is changing once per epoch. The Light Client must be provided by details
/// about the validator set whenever it's importing first commitment with a new
/// `validator_set_id`. Validator set data MUST be verifiable, for instance using [payload]
/// information.
/// `validator_set_id`. Validator set data MUST be verifiable, for instance using
/// [payload](Commitment::payload) information.
pub validator_set_id: ValidatorSetId,
}
@@ -88,7 +88,7 @@ pub(crate) fn syn_err(message: &'static str) -> syn::Error {
/// ```
///
/// The given struct provides function to convert from/to `Assignment` as part of
/// [`sp_npos_elections::Solution`] trait:
/// `sp_npos_elections::Solution` trait:
///
/// - `fn from_assignment<..>(..)`
/// - `fn into_assignment<..>(..)`
@@ -201,7 +201,7 @@ impl<VoterIndex, TargetIndex, P: PerThing> IndexAssignment<VoterIndex, TargetInd
}
}
/// A type alias for [`IndexAssignment`] made from [`crate::Solution`].
/// A type alias for [`IndexAssignment`] made from [`crate::NposSolution`].
pub type IndexAssignmentOf<C> = IndexAssignment<
<C as crate::NposSolution>::VoterIndex,
<C as crate::NposSolution>::TargetIndex,
+1 -1
View File
@@ -89,7 +89,7 @@ pub type HostFuncType<T> = fn(&mut T, &[Value]) -> Result<ReturnValue, HostError
/// will be used by the guest module.
///
/// The memory can't be directly accessed by supervisor, but only
/// through designated functions [`get`](Memory::get) and [`set`](Memory::set).
/// through designated functions [`get`](SandboxMemory::get) and [`set`](SandboxMemory::set).
pub trait SandboxMemory: Sized + Clone {
/// Construct a new linear memory instance.
///
@@ -125,7 +125,7 @@ pub fn constant_ratio(existential_weight: VoteWeight, n_bags: usize) -> f64 {
/// The last element is always `VoteWeight::MAX`.
///
/// All other elements are computed from the previous according to the formula
/// `threshold[k + 1] = (threshold[k] * ratio).max(threshold[k] + 1);
/// `threshold[k + 1] = (threshold[k] * ratio).max(threshold[k] + 1);`
pub fn thresholds(
existential_weight: VoteWeight,
constant_ratio: f64,