Skip to content

Commit 8768d1a

Browse files
authored
fix: clippy with no-default and docs in CI (#104)
1 parent 86e2539 commit 8768d1a

19 files changed

Lines changed: 127 additions & 37 deletions

File tree

.github/workflows/sanity.yaml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,28 @@ jobs:
5151
- name: Run Clippy with stable
5252
run: cargo clippy --all-targets --all-features -- -D warnings
5353

54+
clippy-no-default:
55+
name: Clippy (no default features)
56+
runs-on: warp-ubuntu-latest-x64-32x
57+
steps:
58+
- uses: actions/checkout@v5
59+
- name: Cache Rust toolchain
60+
uses: actions/cache@v3
61+
with:
62+
path: |
63+
~/.cargo/registry
64+
~/.cargo/git
65+
target
66+
key: ${{ runner.os }}-rust-stable-${{ hashFiles('**/Cargo.lock') }}
67+
- name: Set up Rust Stable
68+
uses: actions-rs/toolchain@v1
69+
with:
70+
toolchain: stable
71+
override: true
72+
components: clippy
73+
- name: Run Clippy with stable
74+
run: cargo clippy --all-targets --no-default-features -- -D warnings
75+
5476
typos:
5577
name: Typos
5678
runs-on: warp-ubuntu-latest-x64-32x
@@ -81,4 +103,27 @@ jobs:
81103
toolchain: stable
82104
override: true
83105
- name: Run tests with stable
84-
run: cargo test --all-targets --all-features
106+
run: cargo test --all-targets --all-features
107+
108+
doc:
109+
name: Docs
110+
runs-on: warp-ubuntu-latest-x64-32x
111+
steps:
112+
- uses: actions/checkout@v5
113+
- name: Cache Rust toolchain
114+
uses: actions/cache@v3
115+
with:
116+
path: |
117+
~/.cargo/registry
118+
~/.cargo/git
119+
target
120+
key: ${{ runner.os }}-rust-stable-${{ hashFiles('**/Cargo.lock') }}
121+
- name: Set up Rust Stable
122+
uses: actions-rs/toolchain@v1
123+
with:
124+
toolchain: stable
125+
override: true
126+
- name: Build documentation
127+
env:
128+
RUSTDOCFLAGS: -D warnings
129+
run: cargo doc --no-deps --document-private-items --all-features --examples

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub mod steps;
2828
/// Orderpool utils
2929
pub mod orderpool2;
3030

31-
/// Externally available test utilities
31+
// Externally available test utilities
3232
#[cfg(any(test, feature = "test-utils"))]
3333
pub mod test_utils;
3434

src/orderpool2/prioritized_pool/step.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,11 @@ use {
88
crate::{
99
alloy::{
1010
consensus::Transaction,
11-
consensus::transaction::Recovered,
1211
primitives::{Address, B256},
1312
},
1413
orderpool2::{AccountNonce, BundleNonce},
1514
payload::CheckpointExt,
16-
platform::types::Transaction as PlatformTransaction,
17-
prelude::{
18-
Bundle,
19-
Checkpoint,
20-
ControlFlow,
21-
Optimism,
22-
Platform,
23-
Step,
24-
StepContext,
25-
},
15+
prelude::{Bundle, Checkpoint, ControlFlow, Platform, Step, StepContext},
2616
reth,
2717
},
2818
parking_lot::Mutex,
@@ -34,6 +24,13 @@ use {
3424
},
3525
};
3626

27+
#[cfg(feature = "optimism")]
28+
use crate::{
29+
alloy::consensus::transaction::Recovered,
30+
platform::types::Transaction as PlatformTransaction,
31+
prelude::Optimism,
32+
};
33+
3734
#[derive(Clone)]
3835
pub struct BundleWithNonces<B, P> {
3936
bundle: B,
@@ -84,6 +81,7 @@ where
8481
}
8582
}
8683

84+
#[cfg(feature = "optimism")]
8785
impl OrderpoolOrder for Recovered<PlatformTransaction<Optimism>> {
8886
type ID = B256;
8987

src/payload/block.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ impl<P: Platform> BlockContext<P> {
6666
/// [`StateProviderFactory::state_by_block_hash`]
6767
/// - The chainspec of the chain we're building for.
6868
///
69-
/// [`PayloadJobGenerator::new_payload_job`]: reth_payload_builder::PayloadJobGenerator::new_payload_job
70-
/// [`StateProviderFactory::state_by_block_hash`]: reth::providers::StateProviderFactory::state_by_block_hash
69+
/// [`PayloadJobGenerator::new_payload_job`]: crate::reth::payload::builder::PayloadJobGenerator::new_payload_job
7170
pub fn new(
7271
parent: SealedHeader<types::Header<P>>,
7372
attribs: types::PayloadBuilderAttributes<P>,

src/payload/exec.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<P: Platform> Executable<P> {
6969
/// executable is invalid, no execution result will be produced.
7070
///
7171
/// For details on what makes an executable invalid see the
72-
/// [`execute_transaction`] and [`execute_bundle`] methods.
72+
/// [`Self::execute_transaction`] and [`Self::execute_bundle`] methods.
7373
pub fn execute<DB>(
7474
self,
7575
block: &BlockContext<P>,
@@ -97,8 +97,11 @@ impl<P: Platform> Executable<P> {
9797
/// - Transactions that fail gracefully (revert or halt) will produce an
9898
/// execution result and state changes. It is up to higher levels of the
9999
/// system to decide what to do with such transactions, e.g., whether to
100-
/// remove them from the payload or not (see [`RevertProtection`]).
101-
fn execute_transaction<DB>(
100+
/// remove them from the payload or not (see
101+
/// [`RemoveRevertedTransactions`]).
102+
///
103+
/// [`RemoveRevertedTransactions`]: crate::steps::RemoveRevertedTransactions
104+
pub fn execute_transaction<DB>(
102105
tx: Recovered<types::Transaction<P>>,
103106
block: &BlockContext<P>,
104107
db: &DB,
@@ -165,7 +168,8 @@ impl<P: Platform> Executable<P> {
165168
/// gas used, nonces incremented, etc. Cleaning up transactions that are
166169
/// allowed to fail and are optional from a bundle is beyond the scope
167170
/// of this method. This is implemented by higher levels of the system,
168-
/// such as the [`RevertProtection`] step in the pipelines API.
171+
/// such as the [`RemoveRevertedTransactions`] step in the pipelines
172+
/// API.
169173
/// - If the bundle does not allow this failed transaction to fail, but
170174
/// the transaction is optional, then it will be removed from the
171175
/// bundle. The bundle stays valid.
@@ -184,7 +188,9 @@ impl<P: Platform> Executable<P> {
184188
/// the execution has a certain balance in some account, etc. If this check
185189
/// fails, the bundle will be considered invalid, and no execution result
186190
/// will be produced.
187-
fn execute_bundle<DB>(
191+
///
192+
/// [`RemoveRevertedTransactions`]: crate::steps::RemoveRevertedTransactions
193+
pub fn execute_bundle<DB>(
188194
bundle: types::Bundle<P>,
189195
block: &BlockContext<P>,
190196
db: &DB,

src/payload/ext/cached_state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ impl<S> CachedStateProvider<S>
5050
where
5151
S: StateProvider,
5252
{
53-
/// Creates a new [`CachedStateProvider`] from an [`ExecutionCache`], state
54-
/// provider, and [`CachedStateMetrics`].
53+
/// Creates a new [`CachedStateProvider`] from an [`ExecutionCache`],
54+
/// and [`StateProvider`].
5555
pub const fn new_with_caches(
5656
state_provider: S,
5757
caches: ExecutionCache,

src/pipelines/exec/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
//!
1010
//! Before running the pipeline, the payload will have the platform-specific
1111
//! [`BlockBuilder::apply_pre_execution_changes`] applied to its state.
12+
//!
13+
//! [`BlockBuilder::apply_pre_execution_changes`]: crate::reth::evm::execute::BlockBuilder::apply_pre_execution_changes
1214
1315
use {
1416
super::{StepInstance, service::ServiceContext},

src/pipelines/exec/scope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//!
55
//! Take this pipeline as an example:
66
//!
7-
//! ```
7+
//! ```text
88
//! Pipeline::default()────────────────────────┐
99
//! .with_prologue(PrologueStep) │
1010
//! .with_step(Step1_1) │

src/pipelines/step/context.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ impl<P: Platform> StepContext<P> {
4343
/// Access to the state of the chain at the beginning of block that we are
4444
/// building. This state does not include any changes made by the pipeline
4545
/// during the payload building process. It does however include changes
46-
/// applied by platform-specific [`BlockBuilder::apply_pre_execution_changes`]
46+
/// applied by platform-specific
47+
/// [`BlockBuilder::apply_pre_execution_changes`]
4748
/// for this block.
49+
///
50+
/// [`BlockBuilder::apply_pre_execution_changes`]: crate::reth::evm::execute::BlockBuilder::apply_pre_execution_changes
4851
pub fn provider(&self) -> &dyn StateProvider {
4952
self.block.base_state()
5053
}

src/pipelines/step/instance.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,11 @@ impl<P: Platform> StepInstance<P> {
280280
/// Initializes metrics recording for this step.
281281
///
282282
/// The input string is the metric name assigned to this step. This name is
283-
/// not known before the pipeline instance is fully built and converted into a
284-
/// service using [`PipelineServiceBuilder`]. It should be called only once.
283+
/// not known before the pipeline instance is fully built and converted
284+
/// into a service using [`PipelineServiceBuilder`]. It should be called
285+
/// only once.
286+
///
287+
/// [`PipelineServiceBuilder`]: crate::pipelines::service::PipelineServiceBuilder
285288
pub(crate) fn init_metrics(&self, name: &str) {
286289
// Initialize the metrics name for this step.
287290
self.name.init_metrics(name);

0 commit comments

Comments
 (0)