Skip to content

Commit

Permalink
Enable clippy check for Cargo.toml files (#401)
Browse files Browse the repository at this point in the history
One of the benefits is that we get warned, when we depend on multiple
version of the same crate. That's inefficient and can lead to subtle
errors.

As an example, you can run this to see the different versions of `syn`:

```console
$ cargo tree --invert  syn
error: There are multiple `syn` packages in your project, and the specification `syn` is ambiguous.
Please re-run this command with one of the following specifications:
  [email protected]
  [email protected]
```

And then be more specific to see the offenders that still depend on the
old version of `syn`:

```console
$ cargo tree --invert syn@1
syn v1.0.109
└── unroll v0.1.5 (proc-macro)
    ├── plonky2 v0.2.2
    │   └── mpcs v0.1.0 (/home/matthias/scroll/prog/ceno6/mpcs)
    │       └── ceno_zkvm v0.1.0 (/home/matthias/scroll/prog/ceno6/ceno_zkvm)
    │   [dev-dependencies]
    │   └── poseidon v0.1.0 (/home/matthias/scroll/prog/ceno6/poseidon)
    │       ├── ff_ext v0.1.0 (/home/matthias/scroll/prog/ceno6/ff_ext)
    │       │   ├── ceno_zkvm v0.1.0 (/home/matthias/scroll/prog/ceno6/ceno_zkvm)
    │       │   ├── mpcs v0.1.0 (/home/matthias/scroll/prog/ceno6/mpcs) (*)
    │       │   ├── multilinear_extensions v0.1.0 (/home/matthias/scroll/prog/ceno6/multilinear_extensions)
    │       │   │   ├── ceno_zkvm v0.1.0 (/home/matthias/scroll/prog/ceno6/ceno_zkvm)
    │       │   │   ├── mpcs v0.1.0 (/home/matthias/scroll/prog/ceno6/mpcs) (*)
    │       │   │   └── sumcheck v0.1.0 (/home/matthias/scroll/prog/ceno6/sumcheck)
    │       │   │       └── ceno_zkvm v0.1.0 (/home/matthias/scroll/prog/ceno6/ceno_zkvm)
    │       │   ├── sumcheck v0.1.0 (/home/matthias/scroll/prog/ceno6/sumcheck) (*)
    │       │   └── transcript v0.1.0 (/home/matthias/scroll/prog/ceno6/transcript)
    │       │       ├── ceno_zkvm v0.1.0 (/home/matthias/scroll/prog/ceno6/ceno_zkvm)
    │       │       ├── mpcs v0.1.0 (/home/matthias/scroll/prog/ceno6/mpcs) (*)
    │       │       └── sumcheck v0.1.0 (/home/matthias/scroll/prog/ceno6/sumcheck) (*)
    │       ├── mpcs v0.1.0 (/home/matthias/scroll/prog/ceno6/mpcs) (*)
    │       └── transcript v0.1.0 (/home/matthias/scroll/prog/ceno6/transcript) (*)
    ├── plonky2_field v0.2.2
    │   └── plonky2 v0.2.2 (*)
    └── poseidon v0.1.0 (/home/matthias/scroll/prog/ceno6/poseidon) (*)
```

For now I've just whitelisted the existing offenders, but in the future
a new PR can work on shrinking that list.

---------

Co-authored-by: Zhang Zhuo <[email protected]>
  • Loading branch information
matthiasgoergens and lispc authored Nov 28, 2024
1 parent 1f5b990 commit b729caf
Show file tree
Hide file tree
Showing 23 changed files with 74 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ members = [
resolver = "2"

[workspace.package]
categories = ["cryptography", "zk", "blockchain", "ceno"]
edition = "2021"
keywords = ["cryptography", "zk", "blockchain", "ceno"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/scroll-tech/ceno"
version = "0.1.0"

[workspace.dependencies]
Expand Down
5 changes: 5 additions & 0 deletions ceno_emul/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
categories.workspace = true
description = "A Risc-V emulator for Ceno"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "ceno_emul"
readme.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions ceno_emul/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(clippy::cargo)]
mod addr;
pub use addr::*;

Expand Down
5 changes: 5 additions & 0 deletions ceno_rt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
categories.workspace = true
description = "Ceno runtime library"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "ceno_rt"
readme = "README.md"
repository.workspace = true
version.workspace = true

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions ceno_rt/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(clippy::cargo)]
#![feature(strict_overflow_ops)]
#![no_std]

Expand Down
5 changes: 5 additions & 0 deletions ceno_zkvm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
categories.workspace = true
description = "Ceno ZKVM"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "ceno_zkvm"
readme.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions ceno_zkvm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(clippy::cargo)]
#![feature(box_patterns)]
#![feature(stmt_expr_attributes)]
#![feature(variant_count)]
Expand Down
10 changes: 10 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# TODO(Matthias): review and see which exception we can remove over time.
# Eg removing syn is blocked by ark-ff-asm cutting a new release
# (https://github.com/arkworks-rs/algebra/issues/813) amongst other things.
allowed-duplicate-crates = [
"syn",
"windows-sys",
"regex-automata",
"regex-syntax",
"itertools",
]
4 changes: 4 additions & 0 deletions examples-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[package]
categories.workspace = true
description = "Build scripts for ceno examples"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "ceno-examples"
repository.workspace = true
version.workspace = true
1 change: 1 addition & 0 deletions examples-builder/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#![deny(clippy::cargo)]
include!(concat!(env!("OUT_DIR"), "/vars.rs"));
1 change: 1 addition & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
edition = "2021"
name = "examples"
readme = "README.md"
resolver = "2"
version = "0.1.0"

Expand Down
5 changes: 5 additions & 0 deletions ff_ext/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
categories.workspace = true
description = "Extra functionality for the ff ((finite fields) crate"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "ff_ext"
readme.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions ff_ext/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(clippy::cargo)]
pub use ff;
use ff::FromUniformBytes;
use goldilocks::SmallField;
Expand Down
5 changes: 5 additions & 0 deletions mpcs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
categories.workspace = true
description = "Multilinear Polynomial Commitment Scheme"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "mpcs"
readme.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions mpcs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(clippy::cargo)]
use ff_ext::ExtensionField;
use itertools::Itertools;
use multilinear_extensions::mle::DenseMultilinearExtension;
Expand Down
5 changes: 5 additions & 0 deletions multilinear_extensions/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
categories.workspace = true
description = "Multilinear extensions for the Ceno project"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "multilinear_extensions"
readme.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions multilinear_extensions/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(clippy::cargo)]
pub mod mle;
pub mod util;
pub mod virtual_poly;
Expand Down
5 changes: 5 additions & 0 deletions poseidon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
categories.workspace = true
description = "Poseidon hash function"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "poseidon"
readme.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions poseidon/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(clippy::cargo)]
extern crate core;

pub(crate) mod constants;
Expand Down
5 changes: 5 additions & 0 deletions sumcheck/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
categories.workspace = true
description = "Sumcheck protocol implementation"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "sumcheck"
readme.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions sumcheck/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(clippy::cargo)]
#[cfg(feature = "non_pow2_rayon_thread")]
pub mod local_thread_pool;
mod macros;
Expand Down
5 changes: 5 additions & 0 deletions transcript/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[package]
categories.workspace = true
description = "Transcript generation for Ceno"
edition.workspace = true
keywords.workspace = true
license.workspace = true
name = "transcript"
readme.workspace = true
repository.workspace = true
version.workspace = true

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions transcript/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![deny(clippy::cargo)]
//! This repo is not properly implemented
//! Transcript APIs are placeholders; the actual logic is to be implemented later.
#![feature(generic_arg_infer)]
Expand Down

0 comments on commit b729caf

Please sign in to comment.