Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test-rustdoc #1266

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion polkadot/core-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub type Hash = sp_core::H256;

/// Unit type wrapper around [`type@Hash`] that represents a candidate hash.
///
/// This type is produced by [`CandidateReceipt::hash`].
/// This type is produced by `CandidateReceipt::hash`.
///
/// This type makes it easy to enforce that a hash is a candidate hash on the type level.
#[derive(Clone, Copy, Encode, Decode, Hash, Eq, PartialEq, Default, PartialOrd, Ord, TypeInfo)]
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/core/parachains-inherent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
//! Parachain backing and approval is an off-chain process, but the parachain needs to progress on
//! chain as well. To make it progress on chain a block producer needs to forward information about
//! the state of a parachain to the runtime. This information is forwarded through an inherent to
//! the runtime. Here we provide the [`ParachainInherentDataProvider`] that requests the relevant
//! the runtime. Here we provide the [`ParachainsInherentDataProvider`] that requests the relevant
//! data from the provisioner subsystem and creates the the inherent data that the runtime will use
//! to create an inherent.

Expand Down
4 changes: 2 additions & 2 deletions polkadot/node/core/pvf/common/src/executor_intf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl Executor {
/// # Safety
///
/// The caller must ensure that the compiled artifact passed here was:
/// 1) produced by [`prepare`],
/// 1) produced by `prepare`,
/// 2) was not modified,
///
/// Failure to adhere to these requirements might lead to crashes and arbitrary code execution.
Expand Down Expand Up @@ -171,7 +171,7 @@ impl Executor {
/// # Safety
///
/// The caller must ensure that the compiled artifact passed here was:
/// 1) produced by [`prepare`],
/// 1) produced by `prepare`,
/// 2) was not modified,
///
/// Failure to adhere to these requirements might lead to crashes and arbitrary code execution.
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/network/bridge/src/rx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl<N, AD> NetworkBridgeRx<N, AD> {
/// discovery service.
///
/// This assumes that the network service has had the notifications protocol for the network
/// bridge already registered. See [`peers_sets_info`](peers_sets_info).
/// bridge already registered. See [`peer_sets_info`].
pub fn new(
network_service: N,
authority_discovery_service: AD,
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/network/bridge/src/tx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl<N, AD> NetworkBridgeTx<N, AD> {
/// discovery service.
///
/// This assumes that the network service has had the notifications protocol for the network
/// bridge already registered. See [`peers_sets_info`](peers_sets_info).
/// bridge already registered. See [`peer_sets_info`].
pub fn new(
network_service: N,
authority_discovery_service: AD,
Expand Down
4 changes: 2 additions & 2 deletions polkadot/node/network/protocol/src/authority_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ use sc_network::{Multiaddr, PeerId};
/// Needed for mocking in tests mostly.
#[async_trait]
pub trait AuthorityDiscovery: Send + Debug + 'static {
/// Get the addresses for the given [`AuthorityId`] from the local address cache.
/// Get the addresses for the given [`AuthorityDiscoveryId`] from the local address cache.
async fn get_addresses_by_authority_id(
&mut self,
authority: AuthorityDiscoveryId,
) -> Option<HashSet<Multiaddr>>;
/// Get the [`AuthorityId`] for the given [`PeerId`] from the local address cache.
/// Get the [`AuthorityDiscoveryId`] for the given [`PeerId`] from the local address cache.
async fn get_authority_ids_by_peer_id(
&mut self,
peer_id: PeerId,
Expand Down
4 changes: 2 additions & 2 deletions polkadot/node/network/protocol/src/peer_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl<T> IndexMut<PeerSet> for PerPeerSet<T> {

/// Get `NonDefaultSetConfig`s for all available peer sets, at their default versions.
///
/// Should be used during network configuration (added to [`NetworkConfiguration::extra_sets`])
/// Should be used during network configuration (added to `NetworkConfiguration::extra_sets`)
/// or shortly after startup to register the protocols with the network service.
pub fn peer_sets_info(
is_authority: IsAuthority,
Expand Down Expand Up @@ -288,7 +288,7 @@ pub struct PeerSetProtocolNames {
}

impl PeerSetProtocolNames {
/// Construct [`PeerSetProtocols`] using `genesis_hash` and `fork_id`.
/// Construct [`PeerSetProtocolNames`] using `genesis_hash` and `fork_id`.
pub fn new(genesis_hash: Hash, fork_id: Option<&str>) -> Self {
let mut protocols = HashMap::new();
let mut names = HashMap::new();
Expand Down
4 changes: 2 additions & 2 deletions polkadot/node/primitives/src/disputes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ impl SignedDisputeStatement {
self.session_index
}

/// Convert a [`SignedFullStatement`] to a [`SignedDisputeStatement`]
/// Convert a unchecked backing statement to a [`SignedDisputeStatement`]
///
/// As [`SignedFullStatement`] contains only the validator index and
/// As the unchecked backing statement contains only the validator index and
/// not the validator public key, the public key must be passed as well,
/// along with the signing context.
///
Expand Down
8 changes: 4 additions & 4 deletions polkadot/node/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ impl CollationResult {
/// Collation function.
///
/// Will be called with the hash of the relay chain block the parachain block should be build on and
/// the [`ValidationData`] that provides information about the state of the parachain on the relay
/// chain.
/// the [`PersistedValidationData`] that provides information about the state of the parachain on
/// the relay chain.
///
/// Returns an optional [`CollationResult`].
#[cfg(not(target_os = "unknown"))]
Expand Down Expand Up @@ -498,7 +498,7 @@ impl std::fmt::Debug for CollationGenerationConfig {
}
}

/// Parameters for [`CollationGenerationMessage::SubmitCollation`].
/// Parameters for `CollationGenerationMessage::SubmitCollation`.
#[derive(Debug)]
pub struct SubmitCollationParams {
/// The relay-parent the collation is built against.
Expand Down Expand Up @@ -634,7 +634,7 @@ pub struct ErasureChunk {
}

impl ErasureChunk {
/// Convert bounded Vec Proof to regular Vec<Vec<u8>>
/// Convert bounded Vec Proof to regular `Vec<Vec<u8>>`
pub fn proof(&self) -> &Proof {
&self.proof
}
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/service/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Code related to benchmarking a [`crate::Client`].
//! Code related to benchmarking a node.

use polkadot_primitives::AccountId;
use sc_client_api::UsageProvider;
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/service/src/overseer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ where
pub overseer_message_channel_capacity_override: Option<usize>,
/// Request-response protocol names source.
pub req_protocol_names: ReqProtocolNames,
/// [`PeerSet`] protocol names to protocols mapping.
/// `PeerSet` protocol names to protocols mapping.
pub peerset_protocol_names: PeerSetProtocolNames,
/// The offchain transaction pool factory.
pub offchain_transaction_pool_factory: OffchainTransactionPoolFactory<Block>,
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/test/client/src/block_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub trait InitPolkadotBlockBuilder {
/// Init a Polkadot specific block builder at a specific block that works for the test runtime.
///
/// Same as [`InitPolkadotBlockBuilder::init_polkadot_block_builder`] besides that it takes a
/// [`BlockId`] to say which should be the parent block of the block that is being build.
/// `Hash` to say which should be the parent block of the block that is being build.
fn init_polkadot_block_builder_at(
&self,
hash: <Block as BlockT>::Hash,
Expand Down
5 changes: 3 additions & 2 deletions polkadot/parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
//! instance and exports a function `validate_block`.
//!
//! `validate` accepts as input two `i32` values, representing a pointer/length pair
//! respectively, that encodes [`ValidationParams`].
//! respectively, that encodes [`ValidationParams`](primitives::ValidationParams).
//!
//! `validate` returns an `u64` which is a pointer to an `u8` array and its length.
//! The data in the array is expected to be a SCALE encoded [`ValidationResult`].
//! The data in the array is expected to be a SCALE encoded
//! [`ValidationResult`](primitives::ValidationResult).
//!
//! ASCII-diagram demonstrating the return data format:
//!
Expand Down
6 changes: 3 additions & 3 deletions polkadot/primitives/src/v5/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ impl<H, N> OccupiedCore<H, N> {
pub struct ScheduledCore {
/// The ID of a para scheduled.
pub para_id: Id,
/// DEPRECATED: see: https://github.com/paritytech/polkadot/issues/7575
/// DEPRECATED: see: <https://github.com/paritytech/polkadot/issues/7575>
///
/// Will be removed in a future version.
pub collator: Option<CollatorId>,
Expand Down Expand Up @@ -1735,8 +1735,8 @@ pub struct SessionInfo {
///
/// Therefore:
/// ```ignore
/// assignment_keys.len() == validators.len() && validators.len() <= discovery_keys.len()
/// ```
/// assignment_keys.len() == validators.len() && validators.len() <= discovery_keys.len()
/// ```
pub assignment_keys: Vec<AssignmentId>,
/// Validators in shuffled ordering - these are the validator groups as produced
/// by the `Scheduler` module for the session and are typically referred to by
Expand Down
6 changes: 3 additions & 3 deletions polkadot/runtime/common/src/assigned_slots/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ pub mod v1 {
}
}

/// [`VersionUncheckedMigrateToV1`] wrapped in a
/// [`frame_support::migrations::VersionedRuntimeUpgrade`], ensuring the migration is only
/// performed when on-chain version is 0.
/// [`MigrateToV1`] wrapped in a
/// [`VersionedRuntimeUpgrade`](frame_support::migrations::VersionedRuntimeUpgrade), ensuring
/// the migration is only performed when on-chain version is 0.
#[cfg(feature = "experimental")]
pub type VersionCheckedMigrateToV1<T> = frame_support::migrations::VersionedRuntimeUpgrade<
0,
Expand Down
3 changes: 2 additions & 1 deletion polkadot/runtime/common/src/elections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

/// Implements the weight types for the elections module and a specific
/// runtime.
/// This macro should not be called directly; use [`impl_runtime_weights`] instead.
/// This macro should not be called directly; use
/// [`impl_runtime_weights`](crate::impl_runtime_weights!) instead.
#[macro_export]
macro_rules! impl_elections_weights {
($runtime:ident) => {
Expand Down
2 changes: 1 addition & 1 deletion polkadot/runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ parameter_types! {
}

/// Parameterized slow adjusting fee updated based on
/// https://research.web3.foundation/Polkadot/overview/token-economics#2-slow-adjusting-mechanism
/// <https://research.web3.foundation/Polkadot/overview/token-economics#2-slow-adjusting-mechanism>
pub type SlowAdjustingFeeUpdate<R> = TargetedFeeAdjustment<
R,
TargetBlockFullness,
Expand Down
2 changes: 1 addition & 1 deletion polkadot/runtime/common/src/purchase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub mod pallet {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// A [new] account was created.
/// A new account was created.
AccountCreated { who: T::AccountId },
/// Someone's account validity was updated.
ValidityUpdated { who: T::AccountId, validity: AccountValidity },
Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/parachains/src/assigner_on_demand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ pub mod pallet {
Pallet::<T>::do_place_order(sender, max_amount, para_id, AllowDeath)
}

/// Same as the [`place_order_allow_death`] call , but with a check that placing the order
/// will not reap the account.
/// Same as the [`place_order_allow_death`](Self::place_order_allow_death) call , but with a
/// check that placing the order will not reap the account.
///
/// Parameters:
/// - `origin`: The sender of the call, funds will be withdrawn from this account.
Expand Down
21 changes: 12 additions & 9 deletions polkadot/runtime/parachains/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ pub struct HostConfiguration<BlockNumber> {
///
/// If PVF pre-checking is enabled this should be greater than the maximum number of blocks
/// PVF pre-checking can take. Intuitively, this number should be greater than the duration
/// specified by [`pvf_voting_ttl`]. Unlike, [`pvf_voting_ttl`], this parameter uses blocks
/// as a unit.
/// specified by [`pvf_voting_ttl`](Self::pvf_voting_ttl). Unlike,
/// [`pvf_voting_ttl`](Self::pvf_voting_ttl), this parameter uses blocks as a unit.
#[cfg_attr(feature = "std", serde(alias = "validation_upgrade_frequency"))]
pub validation_upgrade_cooldown: BlockNumber,
/// The delay, in blocks, after which an upgrade of the validation code is applied.
Expand All @@ -113,14 +113,15 @@ pub struct HostConfiguration<BlockNumber> {
/// been completed.
///
/// Note, there are situations in which `expected_at` in the past. For example, if
/// [`paras_availability_period`] is less than the delay set by
/// this field or if PVF pre-check took more time than the delay. In such cases, the upgrade is
/// further at the earliest possible time determined by [`minimum_validation_upgrade_delay`].
/// [`paras_availability_period`](Self::paras_availability_period) is less than the delay set
/// by this field or if PVF pre-check took more time than the delay. In such cases, the upgrade
/// is further at the earliest possible time determined by
/// [`minimum_validation_upgrade_delay`](Self::minimum_validation_upgrade_delay).
///
/// The rationale for this delay has to do with relay-chain reversions. In case there is an
/// invalid candidate produced with the new version of the code, then the relay-chain can
/// revert [`validation_upgrade_delay`] many blocks back and still find the new code in the
/// storage by hash.
/// revert [`validation_upgrade_delay`](Self::validation_upgrade_delay) many blocks back and
/// still find the new code in the storage by hash.
///
/// [#4601]: https://github.com/paritytech/polkadot/issues/4601
pub validation_upgrade_delay: BlockNumber,
Expand Down Expand Up @@ -229,7 +230,8 @@ pub struct HostConfiguration<BlockNumber> {
pub pvf_voting_ttl: SessionIndex,
/// The lower bound number of blocks an upgrade can be scheduled.
///
/// Typically, upgrade gets scheduled [`validation_upgrade_delay`] relay-chain blocks after
/// Typically, upgrade gets scheduled
/// [`validation_upgrade_delay`](Self::validation_upgrade_delay) relay-chain blocks after
/// the relay-parent of the parablock that signalled the validation code upgrade. However,
/// in the case a pre-checking voting was concluded in a longer duration the upgrade will be
/// scheduled to the next block.
Expand All @@ -240,7 +242,8 @@ pub struct HostConfiguration<BlockNumber> {
/// To prevent that, we introduce the minimum number of blocks after which the upgrade can be
/// scheduled. This number is controlled by this field.
///
/// This value should be greater than [`paras_availability_period`].
/// This value should be greater than
/// [`paras_availability_period`](Self::paras_availability_period).
pub minimum_validation_upgrade_delay: BlockNumber,
}

Expand Down
6 changes: 3 additions & 3 deletions polkadot/runtime/parachains/src/dmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ impl From<QueueDownwardMessageError> for SendError {
}
}

/// An error returned by [`check_processed_downward_messages`] that indicates an acceptance check
/// didn't pass.
pub enum ProcessedDownwardMessagesAcceptanceErr {
/// An error returned by [`Pallet::check_processed_downward_messages`] that indicates an acceptance
/// check didn't pass.
pub(crate) enum ProcessedDownwardMessagesAcceptanceErr {
/// If there are pending messages then `processed_downward_messages` should be at least 1,
AdvancementRule,
/// `processed_downward_messages` should not be greater than the number of pending messages.
Expand Down
10 changes: 5 additions & 5 deletions polkadot/runtime/parachains/src/hrmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@ pub struct HrmpChannel {
pub recipient_deposit: Balance,
}

/// An error returned by [`check_hrmp_watermark`] that indicates an acceptance criteria check
/// didn't pass.
pub enum HrmpWatermarkAcceptanceErr<BlockNumber> {
/// An error returned by [`Pallet::check_hrmp_watermark`] that indicates an acceptance criteria
/// check didn't pass.
pub(crate) enum HrmpWatermarkAcceptanceErr<BlockNumber> {
AdvancementRule { new_watermark: BlockNumber, last_watermark: BlockNumber },
AheadRelayParent { new_watermark: BlockNumber, relay_chain_parent_number: BlockNumber },
LandsOnBlockWithNoMessages { new_watermark: BlockNumber },
}

/// An error returned by [`check_outbound_hrmp`] that indicates an acceptance criteria check
/// An error returned by [`Pallet::check_outbound_hrmp`] that indicates an acceptance criteria check
/// didn't pass.
pub enum OutboundHrmpAcceptanceErr {
pub(crate) enum OutboundHrmpAcceptanceErr {
MoreMessagesThanPermitted { sent: u32, permitted: u32 },
NotSorted { idx: u32 },
NoSuchChannel { idx: u32, channel_id: HrmpChannelId },
Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/parachains/src/inclusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,10 @@ enum AcceptanceCheckErr<BlockNumber> {
OutboundHrmp(hrmp::OutboundHrmpAcceptanceErr),
}

/// An error returned by [`check_upward_messages`] that indicates a violation of one of acceptance
/// An error returned by [`Pallet::check_upward_messages`] that indicates a violation of one of acceptance
/// criteria rules.
#[cfg_attr(test, derive(PartialEq))]
pub enum UmpAcceptanceCheckErr {
pub(crate) enum UmpAcceptanceCheckErr {
/// The maximal number of messages that can be submitted in one batch was exceeded.
MoreMessagesThanPermitted { sent: u32, permitted: u32 },
/// The maximal size of a single message was exceeded.
Expand Down
8 changes: 0 additions & 8 deletions polkadot/runtime/parachains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ pub trait FeeTracker {
}

/// Schedule a para to be initialized at the start of the next session with the given genesis data.
///
/// See [`paras::Pallet::schedule_para_initialize`] for more details.
pub fn schedule_para_initialize<T: paras::Config>(
id: ParaId,
genesis: paras::ParaGenesisArgs,
Expand All @@ -73,8 +71,6 @@ pub fn schedule_para_initialize<T: paras::Config>(
}

/// Schedule a para to be cleaned up at the start of the next session.
///
/// See [`paras::Pallet::schedule_para_cleanup`] for more details.
pub fn schedule_para_cleanup<T: paras::Config>(id: primitives::Id) -> Result<(), ()> {
<paras::Pallet<T>>::schedule_para_cleanup(id).map_err(|_| ())
}
Expand All @@ -90,8 +86,6 @@ pub fn schedule_parachain_downgrade<T: paras::Config>(id: ParaId) -> Result<(),
}

/// Schedules a validation code upgrade to a parachain with the given id.
///
/// This simply calls [`crate::paras::Pallet::schedule_code_upgrade_external`].
pub fn schedule_code_upgrade<T: paras::Config>(
id: ParaId,
new_code: ValidationCode,
Expand All @@ -100,8 +94,6 @@ pub fn schedule_code_upgrade<T: paras::Config>(
}

/// Sets the current parachain head with the given id.
///
/// This simply calls [`crate::paras::Pallet::set_current_head`].
pub fn set_current_head<T: paras::Config>(id: ParaId, new_head: HeadData) {
paras::Pallet::<T>::set_current_head(id, new_head)
}
2 changes: 1 addition & 1 deletion polkadot/runtime/parachains/src/paras_inherent/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<T> IndexedRetain<T> for Vec<T> {
}

/// Helper trait until `is_sorted_by` is stabilized.
/// TODO: https://github.com/rust-lang/rust/issues/53485
/// TODO: <https://github.com/rust-lang/rust/issues/53485>
pub trait IsSortedBy<T> {
fn is_sorted_by<F>(self, cmp: F) -> bool
where
Expand Down
Loading