diff --git a/.cargo/config.toml b/.cargo/config.toml index 2ed5838..3bf5f97 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -15,3 +15,6 @@ rustflags = [ "-Clink-arg=-sSTACK_SIZE=128kb", "-Clink-arg=-sNODEJS_CATCH_EXIT=0" ] + +[build] +rustdocflags = ["-D", "warnings"] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3306e29..48954b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,3 +57,6 @@ jobs: - name: Test cargo workspace run: make test-workspace + + - name: Test docs + run: make doc diff --git a/Makefile b/Makefile index 25cb54f..74990d7 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ install-revive-explorer \ format \ clippy \ + doc \ machete \ test \ test-integration \ @@ -52,11 +53,14 @@ format: clippy: cargo clippy --all-features --workspace --tests --benches -- --deny warnings +doc: + cargo doc --all-features --workspace --document-private-items --no-deps + machete: cargo install cargo-machete cargo machete -test: format clippy machete test-workspace install-revive-runner install-revive-explorer +test: format clippy machete test-workspace install-revive-runner install-revive-explorer doc test-integration: install-bin cargo test --package revive-integration @@ -65,7 +69,7 @@ test-resolc: install cargo test --package resolc test-workspace: install - cargo test --workspace --exclude revive-llvm-builder + cargo test --workspace --exclude revive-llvm-builder --doc test-wasm: install-wasm npm run test:wasm diff --git a/crates/differential/src/go_duration.rs b/crates/differential/src/go_duration.rs index f7c15d0..5db8a01 100644 --- a/crates/differential/src/go_duration.rs +++ b/crates/differential/src/go_duration.rs @@ -3,8 +3,8 @@ use std::time::Duration; /// Parse a go formatted duration. /// /// Sources: -/// - https://crates.io/crates/go-parse-duration (fixed an utf8 bug) -/// - https://github.com/golang/go/blob/master/src/time/format.go +/// - (fixed an utf8 bug) +/// - pub fn parse_go_duration(value: &str) -> Result { parse_duration(value).map(|ns| Duration::from_nanos(ns.unsigned_abs())) } diff --git a/crates/explorer/src/dwarfdump_analyzer.rs b/crates/explorer/src/dwarfdump_analyzer.rs index 6ceccd6..00dadb3 100644 --- a/crates/explorer/src/dwarfdump_analyzer.rs +++ b/crates/explorer/src/dwarfdump_analyzer.rs @@ -188,7 +188,7 @@ impl DwarfdumpAnalyzer { } } -/// Given a slice of u64 values, returns a Vec where each element +/// Given a slice of u64 values, returns a `Vec` where each element /// is linearly scaled into the closed interval [1, 10]. fn scale_to(data: &[u64], scale_max: u64) -> Vec { if data.is_empty() { diff --git a/crates/llvm-context/src/polkavm/context/mod.rs b/crates/llvm-context/src/polkavm/context/mod.rs index 99c7d4b..199d4a0 100644 --- a/crates/llvm-context/src/polkavm/context/mod.rs +++ b/crates/llvm-context/src/polkavm/context/mod.rs @@ -664,7 +664,7 @@ impl<'ctx> Context<'ctx> { } /// Builds an aligned stack allocation at the current position. - /// Use this if [`build_alloca_at_entry`] might change program semantics. + /// Use this if [`Self::build_alloca_at_entry`] might change program semantics. /// Otherwise, alloca should always be built at the function prelude! pub fn build_alloca + Clone + Copy>( &self, diff --git a/crates/runner/src/lib.rs b/crates/runner/src/lib.rs index e289f86..207060a 100644 --- a/crates/runner/src/lib.rs +++ b/crates/runner/src/lib.rs @@ -1,6 +1,6 @@ //! Experimental test runner for testing [pallet-revive](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/revive) contracts. -//! The crate exposes a single function [`run_tests`] that takes a [`Specs`] that defines in a declarative way: -//! - The Genesis configuration +//! The crate implements [`Specs`] that defines tests a declarative way: +//! - The Genesis configuration. //! - A list of [`SpecsAction`] that will be executed in order. //! //! ## Example diff --git a/crates/runner/src/specs.rs b/crates/runner/src/specs.rs index db0a3e6..815a820 100644 --- a/crates/runner/src/specs.rs +++ b/crates/runner/src/specs.rs @@ -220,7 +220,7 @@ impl Default for Specs { impl Specs { /// Get the list of actions to perform - /// A default [`SpecAction::VerifyCall`] is injected after each Instantiate or Call action when + /// A default [`SpecsAction::VerifyCall`] is injected after each Instantiate or Call action when /// missing and not in differential mode pub fn actions(&self) -> Vec { self.actions diff --git a/crates/runtime-api/src/calling_convention.rs b/crates/runtime-api/src/calling_convention.rs index d480422..9a53f07 100644 --- a/crates/runtime-api/src/calling_convention.rs +++ b/crates/runtime-api/src/calling_convention.rs @@ -1,6 +1,6 @@ use inkwell::{builder::Builder, context::Context, module::Module, values::IntValue}; -/// Creates a module that sets the PolkaVM minimum stack size to [`size`] if linked in. +/// Creates a module that sets the PolkaVM minimum stack size to `size` if linked in. pub fn min_stack_size<'context>( context: &'context Context, module_name: &str, diff --git a/crates/runtime-api/src/lib.rs b/crates/runtime-api/src/lib.rs index b0e5987..297227f 100644 --- a/crates/runtime-api/src/lib.rs +++ b/crates/runtime-api/src/lib.rs @@ -1,10 +1,11 @@ //! This crate vendors the [PolkaVM][0] C API and provides a LLVM module for interacting //! with the `pallet-revive` runtime API. //! At present, the contracts pallet requires blobs to export `call` and `deploy`, -//! and offers a bunch of [runtime API methods][1]. The provided [module] implements +//! and offers a bunch of [runtime API methods][1]. The provided implements //! those exports and imports. -//! [0]: [https://crates.io/crates/polkavm] -//! [1]: [https://docs.rs/pallet-contracts/26.0.0/pallet_contracts/api_doc/index.html] +//! +//! [0]: [] +//! [1]: [] pub mod calling_convention; pub mod immutable_data; diff --git a/crates/stdlib/src/lib.rs b/crates/stdlib/src/lib.rs index dd886a2..8634a78 100644 --- a/crates/stdlib/src/lib.rs +++ b/crates/stdlib/src/lib.rs @@ -1,7 +1,8 @@ //! This crate vendors EVM related standard library functionality and provides a LLVM module, //! exporting the standard library functions. -//! The standard library code is inherited and adapted from [0]. -//! [0]: [https://github.com/matter-labs/era-compiler-llvm/blob/v1.4.1/llvm/lib/Target/PolkaVM/polkavm-stdlib.ll] +//! The standard library code is inherited and adapted from [the era compiler][0]. +//! +//! [0]: [] use inkwell::{context::Context, memory_buffer::MemoryBuffer, module::Module, support::LLVMString}; diff --git a/crates/yul/src/parser/statement/expression/function_call/name.rs b/crates/yul/src/parser/statement/expression/function_call/name.rs index a230fbf..450f9e3 100644 --- a/crates/yul/src/parser/statement/expression/function_call/name.rs +++ b/crates/yul/src/parser/statement/expression/function_call/name.rs @@ -198,7 +198,7 @@ pub enum Name { BlobHash, /// difficulty of the current block Difficulty, - /// https://eips.ethereum.org/EIPS/eip-4399 + /// Prevrandao, /// current mining beneficiary CoinBase,