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 all rustdoc warnings #793

Merged
merged 9 commits into from
Sep 5, 2023
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
2 changes: 0 additions & 2 deletions .config/nextest.toml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ jobs:
- run: cargo deny check licenses
cargo-doc-artifact:
runs-on: ubuntu-latest
# `cargo doc` requires `cargo check`, so we can share caches.
needs: check
timeout-minutes: 90
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v3
# Not sure installing `mold` is actually needed, but it's what the
Expand All @@ -281,7 +281,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "buildjet"
shared-key: cargo-check
shared-key: cargo-doc
save-if: ${{ github.ref == 'refs/heads/nightly' }}
workspaces: |
.
Expand Down
5 changes: 1 addition & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion adapters/celestia/src/celestia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ impl BlockHeader for CelestiaHeader {
}
}

/// We implement [`SlotData`] for [`CelestiaHeader`] in a similar fashion as for [`FilteredCelestiaBlock`]
/// We implement [`SlotData`] for [`CelestiaHeader`] in a similar fashion as for
/// [`FilteredCelestiaBlock`](crate::types::FilteredCelestiaBlock).
impl SlotData for CelestiaHeader {
type BlockHeader = CelestiaHeader;
type Cond = ChainValidityCondition;
Expand Down
4 changes: 2 additions & 2 deletions adapters/celestia/src/verifier/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const HRP: &str = "celestia";
const VARIANT: bech32::Variant = bech32::Variant::Bech32;

/// Representation of the address in the Celestia network
/// https://github.com/celestiaorg/celestia-specs/blob/e59efd63a2165866584833e91e1cb8a6ed8c8203/src/specs/data_structures.md#address
/// <https://github.com/celestiaorg/celestia-specs/blob/e59efd63a2165866584833e91e1cb8a6ed8c8203/src/specs/data_structures.md#address>
/// Spec says: "Addresses have a length of 32 bytes.", but in reality it is 32 `u5` elements, which can be compressed as 20 bytes.
/// TODO: Switch to bech32::u5 when it has repr transparent: https://github.com/Sovereign-Labs/sovereign-sdk/issues/646
/// TODO: Switch to bech32::u5 when it has repr transparent: <https://github.com/Sovereign-Labs/sovereign-sdk/issues/646>
#[derive(
Debug, PartialEq, Clone, Eq, Serialize, Deserialize, BorshDeserialize, BorshSerialize, Hash,
)]
Expand Down
17 changes: 7 additions & 10 deletions examples/demo-nft-module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ simplicity, each token represents only an ID and won't hold any metadata.
The Sovereign SDK provides a [module-template](../../module-system/module-implementations/module-template/README.md),
which is boilerplate that can be customized to easily build modules.

```ignore
```text

├── Cargo.toml
├── README.md
Expand All @@ -38,7 +38,7 @@ which is boilerplate that can be customized to easily build modules.

Here are defining basic dependencies in `Cargo.toml` that module needs to get started:

```toml, ignore
```toml
[dependencies]
anyhow = { anyhow = "1.0.62" }
sov-modules-api = { git = "https://github.com/Sovereign-Labs/sovereign-sdk.git", branch = "stable", features = ["macros"] }
Expand Down Expand Up @@ -110,7 +110,7 @@ Before we start implementing the `Module` trait, there are several preparatory s

1. Define `native` feature in `Cargo.toml` and add additional dependencies:

```toml, ignore
```toml
[dependencies]
anyhow = "1.0.62"
borsh = { version = "0.10.3", features = ["bytes"] }
Expand Down Expand Up @@ -140,19 +140,18 @@ Before we start implementing the `Module` trait, there are several preparatory s
pub enum CallMessage<C: sov_modules_api::Context> {
Mint {
/// The id of new token. Caller is an owner
id: u64
id: u64,
},
Transfer {
/// The address to which the token will be transferred.
to: C::Address,
/// The token id to transfer
/// The token id to transfer.
id: u64,
},
Burn {
id: u64,
}
}

```

As you can see, we derive the `borsh` serialization format for these messages. Unlike most serialization libraries,
Expand Down Expand Up @@ -243,7 +242,6 @@ impl<C: sov_modules_api::Context> NonFungibleToken<C> {
Ok(())
}
}

```

### Call message
Expand Down Expand Up @@ -351,7 +349,6 @@ use sov_modules_api::macros::rpc_gen;
use sov_modules_api::Context;
use sov_state::WorkingSet;


#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
/// Response for `getOwner` method
pub struct OwnerResponse<C: Context> {
Expand Down Expand Up @@ -381,7 +378,7 @@ that all public APIs function as intended.

Temporary storage is needed for testing, so we enable the `temp` feature of `sov-state` as a `dev-dependency`

```toml, ignore
```toml,text
[dev-dependencies]
sov-state = { git = "https://github.com/Sovereign-Labs/sovereign-sdk.git", branch = "stable", features = ["temp"] }
```
Expand Down Expand Up @@ -463,4 +460,4 @@ pub struct Runtime<C: sov_modules_api::Context> {
#[allow(unused)]
nft: demo_nft_module::NonFungibleToken<C>,
}
```
```
2 changes: 1 addition & 1 deletion examples/demo-rollup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ understand how to build your own state transition function, check out at the doc

### Run a local DA layer instance

1. Install Docker: https://www.docker.com.
1. Install Docker: <https://www.docker.com>.

2. Switch to the `examples/demo-rollup` directory (which is where this `README.md` is located!).

Expand Down
1 change: 1 addition & 0 deletions examples/demo-simple-stf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl StateTransitionFunction for CheckHashPreimageStf {

// This represents a proof of misbehavior by the sequencer, but we won't utilize it in this tutorial.
type MisbehaviorProof = ();
}
```

Now that we have defined the necessary types, we need to implement the following functions:
Expand Down
22 changes: 11 additions & 11 deletions full-node/db/sov-db/src/schema/tables.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
//! This module defines the following tables:
//!
//! Slot Tables:
//! - SlotNumber -> StoredSlot
//! - SlotNumber -> Vec<BatchNumber>
//! - `SlotNumber -> StoredSlot`
//! - `SlotNumber -> Vec<BatchNumber>`
//!
//! Batch Tables:
//! - BatchNumber -> StoredBatch
//! - BatchHash -> BatchNumber
//! - `BatchNumber -> StoredBatch`
//! - `BatchHash -> BatchNumber`
//!
//! Tx Tables:
//! - TxNumber -> (TxHash,Tx)
//! - TxHash -> TxNumber
//! - `TxNumber -> (TxHash,Tx)`
//! - `TxHash -> TxNumber`
//!
//! Event Tables:
//! - (EventKey, TxNumber) -> EventNumber
//! - EventNumber -> (EventKey, EventValue)
//! - `(EventKey, TxNumber) -> EventNumber`
//! - `EventNumber -> (EventKey, EventValue)`
//!
//! JMT Tables:
//! - KeyHash -> Key
//! - (Key, Version) -> JmtValue
//! - NodeKey -> Node
//! - `KeyHash -> Key`
//! - `(Key, Version) -> JmtValue`
//! - `NodeKey -> Node`

use borsh::{maybestd, BorshDeserialize, BorshSerialize};
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
Expand Down
2 changes: 1 addition & 1 deletion full-node/db/sov-schema-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl DB {
}

/// Open db in secondary mode. A secondary db is does not support writes, but can be dynamically caught up
/// to the primary instance by a manual call. See https://github.com/facebook/rocksdb/wiki/Read-only-and-Secondary-instances
/// to the primary instance by a manual call. See <https://github.com/facebook/rocksdb/wiki/Read-only-and-Secondary-instances>
/// for more details.
pub fn open_cf_as_secondary<P: AsRef<Path>>(
opts: &rocksdb::Options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ sov-rollup-interface = { path = "../../../rollup-interface" }
sov-schema-db = { path = "../../../full-node/db/sov-schema-db" }
sov-data-generators = { path = "../../utils/sov-data-generators" }
sov-modules-stf-template = { path = "../../sov-modules-stf-template", features = ["native"] }
sov-modules-macros = { path = "../../sov-modules-macros", features = ["native"] }

sov-chain-state = { path = "../sov-chain-state", features = ["native"] }
sov-value-setter = { path = "../examples/sov-value-setter", features = ["native"] }
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use sov_chain_state::{ChainState, ChainStateConfig};
use sov_modules_api::capabilities::{BlobRefOrOwned, BlobSelector};
use sov_modules_api::hooks::{ApplyBlobHooks, SlotHooks, TxHooks};
use sov_modules_api::macros::DefaultRuntime;
use sov_modules_api::transaction::Transaction;
use sov_modules_api::{BlobReaderTrait, Context, DaSpec, PublicKey, Spec};
use sov_modules_macros::{DefaultRuntime, DispatchCall, Genesis, MessageCodec};
use sov_modules_api::{
BlobReaderTrait, Context, DaSpec, DispatchCall, Genesis, MessageCodec, PublicKey, Spec,
};
use sov_modules_stf_template::{AppTemplate, Runtime, SequencerOutcome};
use sov_rollup_interface::mocks::MockZkvm;
use sov_value_setter::{ValueSetter, ValueSetterConfig};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ serde_json = { workspace = true, optional = true }
sov-bank = { path = "../sov-bank", version = "0.1" }
sov-chain-state = { path = "../sov-chain-state", version = "0.1" }
sov-modules-api = { path = "../../sov-modules-api", version = "0.1" }
sov-modules-macros = { path = "../../sov-modules-macros", version = "0.1" }
sov-state = { path = "../../sov-state", version = "0.1" }


Expand All @@ -38,7 +37,6 @@ native = [
"serde",
"serde_json",
"sov-modules-api/native",
"sov-modules-macros/native",
"sov-bank/native",
"sov-chain-state/native",
"sov-state/native",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ use call::Role;
use sov_bank::Amount;
use sov_chain_state::TransitionHeight;
use sov_modules_api::{
Context, DaSpec, Error, StoredCodeCommitment, ValidityConditionChecker, Zkvm,
Context, DaSpec, Error, ModuleInfo, StoredCodeCommitment, ValidityConditionChecker, Zkvm,
};
use sov_modules_macros::ModuleInfo;
use sov_state::{Storage, WorkingSet};

/// Configuration of the attester incentives module
Expand Down
20 changes: 12 additions & 8 deletions module-system/module-implementations/sov-bank/src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ impl<C: sov_modules_api::Context> Bank<C> {
}

/// Transfers the set of `coins` to the address specified by `to`.
/// Helper function that calls the [`transfer_from`] method from the bank module
pub fn transfer(
&self,
to: C::Address,
Expand All @@ -108,9 +107,11 @@ impl<C: sov_modules_api::Context> Bank<C> {
self.transfer_from(context.sender(), &to, coins, working_set)
}

/// Burns the set of `coins`. If there is no token at the address specified in the
/// `Coins` structure, return an error.
/// Calls the [`Token::burn`] function and updates the total supply of tokens.
/// Burns the set of `coins`.
///
/// If there is no token at the address specified in the
/// [`Coins`] structure, return an error; on success it updates the total
/// supply of tokens.
pub fn burn(
&self,
coins: Coins<C>,
Expand Down Expand Up @@ -145,7 +146,8 @@ impl<C: sov_modules_api::Context> Bank<C> {
/// Mints the `coins`to the address `mint_to_address` using the externally owned account ("EOA") supplied by
/// `context.sender()` as the authorizer.
/// Returns an error if the token address doesn't exist or `context.sender()` is not authorized to mint tokens.
/// Calls the [`Token::mint`] function and update the `self.tokens` set to store the new balance.
///
/// On success, it updates the `self.tokens` set to store the new balance.
pub fn mint_from_eoa(
&self,
coins: &Coins<C>,
Expand All @@ -158,7 +160,8 @@ impl<C: sov_modules_api::Context> Bank<C> {

/// Mints the `coins` to the address `mint_to_address` if `authorizer` is an allowed minter.
/// Returns an error if the token address doesn't exist or `context.sender()` is not authorized to mint tokens.
/// Calls the [`Token::mint`] function and update the `self.tokens` set to store the new minted address.
///
/// On success, it updates the `self.tokens` set to store the new minted address.
pub fn mint(
&self,
coins: &Coins<C>,
Expand Down Expand Up @@ -215,7 +218,8 @@ impl<C: sov_modules_api::Context> Bank<C> {

impl<C: sov_modules_api::Context> Bank<C> {
/// Transfers the set of `coins` from the address `from` to the address `to`.
/// Returns an error if the token address doesn't exist. Otherwise, call the [`Token::transfer`] function.
///
/// Returns an error if the token address doesn't exist.
pub fn transfer_from(
&self,
from: &C::Address,
Expand All @@ -239,7 +243,7 @@ impl<C: sov_modules_api::Context> Bank<C> {
Ok(CallResponse::default())
}

/// Helper function used by the rpc method [`balance_of`] to return the balance of the token stored at `token_address`
/// Helper function used by the rpc method [`balance_of`](Bank::balance_of) to return the balance of the token stored at `token_address`
/// for the user having the address `user_address` from the underlying storage. If the token address doesn't exist, or
/// if the user doesn't have tokens of that type, return `None`. Otherwise, wrap the resulting balance in `Some`.
pub fn get_balance_of(
Expand Down
3 changes: 2 additions & 1 deletion module-system/module-implementations/sov-bank/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use crate::call::prefix_from_address_with_parent;
pub type Amount = u64;

/// Structure that stores information specifying
/// a given `amount` (type [`Amount`]) of coins stored at a `token_address` (type [`Context::Address`]).
/// a given `amount` (type [`Amount`]) of coins stored at a `token_address`
/// (type [`sov_modules_api::Spec::Address`]).
#[cfg_attr(
feature = "native",
derive(serde::Serialize),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ tracing = { workspace = true }
hex = { workspace = true }

sov-modules-api = { path = "../../sov-modules-api", version = "0.1" }
sov-modules-macros = { path = "../../sov-modules-macros", version = "0.1" }
sov-state = { path = "../../sov-state", version = "0.1" }
sov-sequencer-registry = { path = "../sov-sequencer-registry", version = "0.1" }
sov-chain-state = { path = "../sov-chain-state" }
Expand All @@ -48,6 +47,5 @@ native = [
"serde_json",
"sov-modules-api/native",
"sov-state/native",
"sov-modules-macros/native",
"sov-sequencer-registry/native"
"sov-sequencer-registry/native",
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Response {
pub address: String,
}

/// TODO: https://github.com/Sovereign-Labs/sovereign-sdk/issues/626
/// TODO: <https://github.com/Sovereign-Labs/sovereign-sdk/issues/626>
#[rpc_gen(client, server, namespace = "blobStorage")]
impl<C: sov_modules_api::Context, Da: sov_modules_api::DaSpec> BlobStorage<C, Da> {
/// Queries the address of the module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ serde_json = { workspace = true, optional = true }
jsonrpsee = { workspace = true, features = ["macros", "client-core", "server"], optional = true }

sov-modules-api = { path = "../../sov-modules-api", version = "0.1" }
sov-modules-macros = { path = "../../sov-modules-macros", version = "0.1" }
sov-state = { path = "../../sov-state", version = "0.1" }


Expand All @@ -35,4 +34,4 @@ sov-rollup-interface = { path = "../../../rollup-interface", features = ["mocks"

[features]
default = []
native = ["serde", "serde_json", "jsonrpsee", "sov-state/native", "sov-modules-api/native", ]
native = ["serde", "serde_json", "jsonrpsee", "sov-state/native", "sov-modules-api/native"]
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ pub mod query;
use borsh::{BorshDeserialize, BorshSerialize};
#[cfg(feature = "native")]
pub use query::{ChainStateRpcImpl, ChainStateRpcServer};
use sov_modules_api::{Error, ValidityCondition, ValidityConditionChecker};
use sov_modules_macros::ModuleInfo;
use sov_modules_api::{Error, ModuleInfo, ValidityCondition, ValidityConditionChecker};
use sov_state::WorkingSet;

/// Type alias that contains the height of a given transition
Expand Down
Loading