Skip to content

Commit da3269b

Browse files
authored
feat: more lints (#154)
* more lints * update ci * lint
1 parent c188cd8 commit da3269b

File tree

8 files changed

+68
-14
lines changed

8 files changed

+68
-14
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- uses: actions/checkout@v4
5454
- uses: dtolnay/rust-toolchain@master
5555
with:
56-
toolchain: "1.88"
56+
toolchain: "1.90"
5757
components: clippy
5858
- name: cargo cache
5959
uses: Swatinem/rust-cache@v2
@@ -84,7 +84,7 @@ jobs:
8484
- uses: actions/checkout@v4
8585
- uses: dtolnay/rust-toolchain@master
8686
with:
87-
toolchain: "1.88"
87+
toolchain: "1.90"
8888
- name: cargo cache
8989
uses: Swatinem/rust-cache@v2
9090
- name: cargo test scroll

Cargo.toml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,30 @@ resolver = "2"
1313
[workspace.package]
1414
version = "2.0.0"
1515
edition = "2021"
16-
rust-version = "1.88"
16+
rust-version = "1.90"
1717
authors = ["Scroll developers"]
1818
license = "MIT OR Apache-2.0"
1919
homepage = "https://github.com/scroll-tech/stateless-block-verifier"
2020
repository = "https://github.com/scroll-tech/stateless-block-verifier"
2121

22+
[workspace.lints.rust]
23+
missing-docs = "warn"
24+
missing-debug-implementations = "warn"
25+
unused-qualifications = "warn"
26+
27+
[workspace.lints.clippy]
28+
# some useful lints from pedantic group
29+
assigning-clones = "warn"
30+
cast-lossless = "warn"
31+
redundant-else = "warn"
32+
single-match-else = "warn"
33+
elidable-lifetime-names = "warn"
34+
uninlined-format-args = "warn"
35+
unnecessary-box-returns = "warn"
36+
unnecessary-debug-formatting = "warn"
37+
# this is useful if we forget to align versions of alloy/revm when upgrading reth
38+
multiple-crate-versions = "warn"
39+
2240
[workspace.dependencies]
2341
# https://github.com/alloy-rs/alloy
2442
alloy = { version = "1.0.41", default-features = false }
@@ -123,10 +141,6 @@ tag = "scroll-v91"
123141
default-features = false
124142
features = ["std"]
125143

126-
[workspace.lints.rust]
127-
missing-docs = "deny"
128-
missing-debug-implementations = "deny"
129-
130144
[patch.crates-io]
131145
revm = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }
132146
revm-bytecode = { git = "https://github.com/scroll-tech/revm", tag = "scroll-v91" }

clippy.toml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Please re-check this list when updating dependencies, keep it minimal.
2+
allowed-duplicate-crates = [
3+
"ark-ff",
4+
"ark-ff-asm",
5+
"ark-ff-macros",
6+
"ark-serialize",
7+
"ark-std",
8+
"nybbles",
9+
"digest",
10+
"fastrlp",
11+
"getrandom",
12+
"itertools",
13+
"rand",
14+
"rand_chacha",
15+
"rand_core",
16+
"schemars",
17+
"secp256k1",
18+
"secp256k1-sys",
19+
"syn",
20+
"tracing-subscriber",
21+
"windows-sys",
22+
"windows-targets",
23+
"windows_aarch64_gnullvm",
24+
"windows_aarch64_msvc",
25+
"windows_i686_gnu",
26+
"windows_i686_gnullvm",
27+
"windows_i686_msvc",
28+
"windows_x86_64_gnu",
29+
"windows_x86_64_gnullvm",
30+
"windows_x86_64_msvc",
31+
32+
# revisit these when fully remove rkyv
33+
"foldhash",
34+
"hashbrown",
35+
"indexmap",
36+
37+
# FIXME: remove after upgrade risc0-ethereum-trie
38+
"alloy-trie",
39+
]

crates/core/src/executor/ethereum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct EvmExecutor<'a> {
1717
block: &'a RecoveredBlock<Block>,
1818
}
1919

20-
impl<'a> crate::EvmExecutor<'a> {
20+
impl<'a> EvmExecutor<'a> {
2121
/// Create a new EVM executor
2222
pub fn new(
2323
chain_spec: Arc<ChainSpec>,

crates/core/src/verifier/ethereum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ mod tests {
4141
) {
4242
let witness: BlockWitness = serde_json::from_str(witness_json).unwrap();
4343
let chain_spec = get_chain_spec(Chain::from_id(witness.chain_id)).unwrap();
44-
crate::verifier::run(&[witness], chain_spec).unwrap();
44+
run(&[witness], chain_spec).unwrap();
4545
}
4646
}

crates/primitives/src/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ pub mod rpc {
112112
};
113113

114114
/// Transaction object used in RPC.
115+
#[allow(unused_qualifications)]
115116
pub type RpcTransaction<T = super::consensus::TxEnvelope> = alloy_rpc_types_eth::Transaction<T>;
116117

117118
/// Block representation for RPC.

crates/utils/src/rpc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ pub trait ProviderExt: Provider<Network> {
6868
#[cfg(not(feature = "scroll"))]
6969
async fn dump_block_ancestors(
7070
&self,
71-
number: sbv_primitives::BlockNumber,
71+
number: BlockNumber,
7272
ancestors: Option<usize>,
73-
) -> TransportResult<Option<Vec<sbv_primitives::types::rpc::Block>>> {
73+
) -> TransportResult<Option<Vec<Block>>> {
7474
use std::future::IntoFuture;
7575

7676
let ancestors = ancestors
7777
.unwrap_or_default()
7878
.clamp(1, (number as usize).min(256));
7979

8080
let ancestors = futures::future::try_join_all((1..=ancestors).map(|offset| {
81-
let block_number = number - offset as sbv_primitives::BlockNumber;
81+
let block_number = number - offset as BlockNumber;
8282
self.get_block_by_number(block_number.into()).into_future()
8383
}))
8484
.await?;
@@ -188,7 +188,7 @@ impl<'a, P: ProviderExt> DumpBlockWitness<'a, P> {
188188
#[cfg(not(feature = "scroll"))]
189189
pub fn with_cached_ancestor_blocks<I>(mut self, iter: I) -> Self
190190
where
191-
I: IntoIterator<Item = sbv_primitives::types::rpc::Block>,
191+
I: IntoIterator<Item = Block>,
192192
{
193193
self.builder = self.builder.ancestor_blocks(iter);
194194
self

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "1.88"
2+
channel = "1.90"

0 commit comments

Comments
 (0)