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 cargo doc #1788

Merged
merged 7 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
27 changes: 27 additions & 0 deletions .github/workflows/cargo-doc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Cargo Doc

on:
push:
branches:
- master
pull_request: {}

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- run: cargo doc

- name: Deploy
if: ${{ github.ref == 'ref/head/master' }}
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.IBC_RS_DOC_PRIVATE_KEY }}
external_repository: informalsystems/ibc-rs-doc
publish_dir: ./target/doc
2 changes: 1 addition & 1 deletion docs/architecture/adr-007-error.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Context

This document describes the reason behind the switch from using
[`anomaly`](https://docs.rs/anomaly) for error handling to
`anomaly` for error handling to
the [`flex-error`](https://docs.rs/flex-error/) crate that is developed in-house.

## Decision
Expand Down
2 changes: 1 addition & 1 deletion modules/src/applications/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod ics27_interchain_accounts {
/// of the full port identifier, which has a
/// complex structure.
///
/// https://github.com/cosmos/ibc/tree/master/spec/app/ics-027-interchain-accounts#registering--controlling-flows
/// <https://github.com/cosmos/ibc/tree/master/spec/app/ics-027-interchain-accounts#registering--controlling-flows>
pub const PORT_ID_PREFIX: &str = "ics27-1.";

/// ICS27 application current version.
Expand Down
3 changes: 1 addition & 2 deletions modules/src/clients/ics07_tendermint/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ impl ClientState {
elapsed > self.trusting_period
}

/// Helper method to produce a
/// [`tendermint_light_client::light_client::Options`] struct for use in
/// Helper method to produce a [`Options`] struct for use in
/// Tendermint-specific light client verification.
pub fn as_light_client_options(&self) -> Result<Options, Error> {
Ok(Options {
Expand Down
2 changes: 1 addition & 1 deletion modules/src/core/ics23_commitment/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct MerkleProof {

/// Convert to ics23::CommitmentProof
/// The encoding and decoding shouldn't fail since ics23::CommitmentProof and ibc_proto::ics23::CommitmentProof should be the same
/// Ref. https://github.com/informalsystems/ibc-rs/issues/853
/// Ref. <https://github.com/informalsystems/ibc-rs/issues/853>
impl From<RawMerkleProof> for MerkleProof {
fn from(proof: RawMerkleProof) -> Self {
let proofs: Vec<CommitmentProof> = proof
Expand Down
1 change: 0 additions & 1 deletion modules/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#![allow(clippy::large_enum_variant)]
#![deny(
warnings,
// missing_docs,
trivial_casts,
trivial_numeric_casts,
unused_import_braces,
Expand Down
2 changes: 1 addition & 1 deletion modules/src/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Timestamp {
self.time.map(Into::into)
}

/// Convert a `Timestamp` to an optional [`Tendermint::Time`]
/// Convert a `Timestamp` to an optional [`tendermint::Time`]
pub fn into_tm_time(self) -> Option<Time> {
self.time
}
Expand Down
7 changes: 4 additions & 3 deletions relayer/src/chain/handle/requests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! Domain-type definitions for requests that a
//! [`ChainHandle`] can accept. These types trickle
//! down to the [`ChainEndpoint`] trait. Any chain
//! that the ibc-relayer library supports will have
//! [`ChainHandle`](crate::chain::handle::ChainHandle) can accept.
//! These types trickle down to the
//! [`ChainEndpoint`](crate::chain::ChainEndpoint) trait.
Comment on lines +2 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, but stylistically footnote-style markup reads better in code, like in my suggestion above.

//! Any chain that the ibc-relayer library supports will have
//! to implement these requests.

use ibc::core::{
Expand Down
3 changes: 2 additions & 1 deletion relayer/src/chain/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use prost_types::Any;
/// (`Vec<Any>`), which has an associated tracking
/// number.
///
/// A [`TrackedMsgs`] correlates with a [`TrackedEvents`]
/// A [`TrackedMsgs`] correlates with a
/// [`TrackedEvents`](crate::link::operational_data::TrackedEvents)
/// by sharing the same `tracking_id`.
#[derive(Debug, Clone)]
pub struct TrackedMsgs {
Expand Down
6 changes: 3 additions & 3 deletions relayer/src/config/reload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl ConfigReload {
/// the path to the configuration file to reload,
/// the current configuration and a channel through which
/// to send the computed [`ConfigUpdate`]s to the
/// [`crate::supervisor::Supervisor`].
/// supervisor.
pub fn new(
path: impl Into<PathBuf>,
current: Arc<RwLock<Config>>,
Expand All @@ -60,7 +60,7 @@ impl ConfigReload {
/// This method will read and parse the configuration from the
/// file, then perform a diff between the current configuration
/// and the newly parsed one, and finally send the computed
/// [`ConfigUpdate`]s to the [`crate::supervisor::Supervisor`].
/// [`ConfigUpdate`]s to the supervisor.
///
/// See also: [`ConfigReload::update_config`]
pub fn reload(&self) -> Result<bool, Error> {
Expand All @@ -69,7 +69,7 @@ impl ConfigReload {
}

/// Compute a diff between the current configuration and the given one,
/// and send the computed [`ConfigUpdate`]s to the [`crate::supervisor::Supervisor`].
/// and send the computed [`ConfigUpdate`]s to the supervisor.
pub fn update_config(&self, new: Config) -> Result<bool, Error> {
let updates = self.compute_updates(&new)?;

Expand Down
1 change: 1 addition & 0 deletions relayer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![forbid(unsafe_code)]
#![deny(
warnings,
trivial_casts,
trivial_numeric_casts,
unused_import_braces,
Expand Down
2 changes: 1 addition & 1 deletion relayer/src/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::link::error::LinkError;
use crate::link::relay_path::RelayPath;

pub mod error;
mod operational_data;
pub mod operational_data;
mod pending;
mod relay_path;
mod relay_sender;
Expand Down
6 changes: 3 additions & 3 deletions relayer/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ impl Packet {
/// An object determines the amount of parallelism that can
/// be exercised when processing [`IbcEvent`](ibc::events::IbcEvent)
/// between two chains. For each [`Object`], a corresponding
/// [`Worker`](crate::worker::Worker) is spawned and all [`IbcEvent`](ibc::events::IbcEvent)s mapped
/// to an [`Object`] are sent to the associated [`Worker`](crate::worker::Worker)
/// [`WorkerHandle`](crate::worker::WorkerHandle) is spawned and all [`IbcEvent`](ibc::events::IbcEvent)s mapped
/// to an [`Object`] are sent to the associated [`WorkerHandle`](crate::worker::WorkerHandle)
/// for processing.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[serde(tag = "type")]
Expand Down Expand Up @@ -187,7 +187,7 @@ define_error! {
}

impl Object {
/// Returns `true` if this [`Object`] is for a [`Worker`](crate::worker::Worker)
/// Returns `true` if this [`Object`] is for a [`WorkerHandle`](crate::worker::WorkerHandle)
/// which is interested in new block events originating from the chain with
/// the given [`ChainId`]. Returns `false` otherwise.
pub fn notify_new_block(&self, src_chain_id: &ChainId) -> bool {
Expand Down
8 changes: 4 additions & 4 deletions relayer/src/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ibc::{

use crate::{
chain::{handle::ChainHandle, HealthCheck},
config::{ChainConfig, Config},
config::{ChainConfig, Config, SharedConfig},
event::{
self,
monitor::{Error as EventError, ErrorDetail as EventErrorDetail, EventBatch},
Expand Down Expand Up @@ -84,7 +84,7 @@ pub struct SupervisorOptions {
value is dropped.
*/
pub fn spawn_supervisor(
config: Arc<RwLock<Config>>,
config: SharedConfig,
registry: SharedRegistry<impl ChainHandle>,
rest_rx: Option<rest::Receiver>,
options: SupervisorOptions,
Expand Down Expand Up @@ -382,7 +382,7 @@ fn collect_event<F>(
}
}

fn collect_events(
pub fn collect_events(
config: &Config,
workers: &WorkerMap,
src_chain: &impl ChainHandle,
Expand Down Expand Up @@ -840,7 +840,7 @@ fn update_config<Chain: ChainHandle>(
}
}

/// Describes the result of [`collect_events`](Supervisor::collect_events).
/// Describes the result of [`collect_events`].
#[derive(Clone, Debug)]
pub struct CollectedEvents {
/// The height at which these events were emitted from the chain.
Expand Down
4 changes: 2 additions & 2 deletions relayer/src/supervisor/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::{
Error,
};

/// A context for spawning workers within the [`crate::supervisor::Supervisor`].
/// A context for spawning workers within the supervisor.
pub struct SpawnContext<'a, Chain: ChainHandle> {
config: &'a Config,
registry: &'a mut Registry<Chain>,
Expand Down Expand Up @@ -186,7 +186,7 @@ impl<'a, Chain: ChainHandle> SpawnContext<'a, Chain> {
}
}

/// Spawns all the [`Worker`](crate::worker::Worker)s that will
/// Spawns all the [`WorkerHandle`](crate::worker::WorkerHandle)s that will
/// handle a given channel for a given source chain.
pub fn spawn_workers_for_channel(
&mut self,
Expand Down
2 changes: 1 addition & 1 deletion relayer/src/util/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl TaskHandle {

Note that because the background tasks are meant to run forever,
this would likely never return unless errors occurred or if
the step runner returns [`TaskError::Abort`] to abort prematurely.
the step runner returns [`Next::Abort`] to abort prematurely.
*/
pub fn join(mut self) {
if let Some(handle) = mem::take(&mut self.join_handle.0) {
Expand Down
2 changes: 1 addition & 1 deletion relayer/src/worker/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ibc::{core::ics02_client::events::NewBlock, Height};

use crate::event::monitor::EventBatch;

/// A command for a [`Worker`](crate::worker::Worker).
/// A command for a [`WorkerHandle`](crate::worker::WorkerHandle).
#[derive(Debug, Clone)]
pub enum WorkerCmd {
/// A batch of packet events need to be relayed
Expand Down
14 changes: 7 additions & 7 deletions relayer/src/worker/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{

use super::{spawn_worker_tasks, WorkerHandle, WorkerId};

/// Manage the lifecycle of [`Worker`]s associated with [`Object`]s.
/// Manage the lifecycle of [`WorkerHandle`]s associated with [`Object`]s.
#[derive(Debug)]
pub struct WorkerMap {
workers: HashMap<Object, WorkerHandle>,
Expand All @@ -34,17 +34,17 @@ impl Default for WorkerMap {
impl WorkerMap {
/// Create a new worker map, which will spawn workers with
/// the given channel for sending messages back to the
/// [`Supervisor`](crate::supervisor::Supervisor).
/// [supervisor](crate::supervisor::SupervisorHandle).
pub fn new() -> Self {
Self::default()
}

/// Returns `true` if there is a spawned [`Worker`] associated with the given [`Object`].
/// Returns `true` if there is a spawned [`WorkerHandle`] associated with the given [`Object`].
pub fn contains(&self, object: &Object) -> bool {
self.workers.contains_key(object)
}

/// Remove the [`Worker`] associated with the given [`Object`] from
/// Remove the [`WorkerHandle`] associated with the given [`Object`] from
/// the map and wait for its thread to terminate.
pub fn remove_stopped(&mut self, id: WorkerId, object: Object) -> bool {
match self.workers.remove(&object) {
Expand Down Expand Up @@ -89,7 +89,7 @@ impl WorkerMap {
}
}

/// Returns all the [`Worker`] which are interested in new block events originating
/// Returns all the [`WorkerHandle`] which are interested in new block events originating
/// from the chain with the given [`ChainId`].
/// See: [`Object::notify_new_block`]
pub fn to_notify<'a>(
Expand All @@ -116,7 +116,7 @@ impl WorkerMap {
/// Get a handle to the worker in charge of handling events associated
/// with the given [`Object`].
///
/// This function will spawn a new [`Worker`] if one does not exists already.
/// This function will spawn a new [`WorkerHandle`] if one does not exists already.
pub fn get_or_spawn<Chain: ChainHandle>(
&mut self,
object: Object,
Expand All @@ -132,7 +132,7 @@ impl WorkerMap {
}
}

/// Spawn a new [`Worker`], only if one does not exists already.
/// Spawn a new [`WorkerHandle`], only if one does not exists already.
///
/// Returns whether or not the worker was actually spawned.
pub fn spawn<Chain: ChainHandle>(
Expand Down
1 change: 1 addition & 0 deletions tools/integration-test/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(warnings)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
#![doc = include_str!("../README.md")]
Expand Down
3 changes: 2 additions & 1 deletion tools/integration-test/src/types/binary/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ impl<ChainA: ChainHandle, ChainB: ChainHandle> ExportEnv for ConnectedChains<Cha
Newtype wrapper for [`ChainHandle`] to stop the chain handle when
this value is dropped.
Note that we cannot stop the chain on drop for [`ProdChainHandle`]
Note that we cannot stop the chain on drop for
[`ProdChainHandle`](ibc_relayer::chain::handle::ProdChainHandle)
itself, as the chain handles can be cloned. But for testing purposes,
we alway stop the chain handle when this "canonical" chain handle
is dropped.
Expand Down