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
+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>;