diff --git a/.github/actions/rust/action.yml b/.github/actions/rust/action.yml new file mode 100644 index 000000000..f028c612e --- /dev/null +++ b/.github/actions/rust/action.yml @@ -0,0 +1,13 @@ +name: "Rust" +description: | + Common steps for CI + + See +runs: + using: composite + steps: + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - uses: cargo-bins/cargo-binstall@v1.10.6 + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1bdcd37f..b14656fa0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -175,33 +175,3 @@ jobs: - name: Run the script run: ./scripts/prove_stdio.sh artifacts/witness_b3_b6.json - - lints: - name: Rustdoc, Formatting and Clippy - runs-on: ubuntu-latest - timeout-minutes: 10 - if: ${{ ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') }} - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - components: rustfmt, clippy - - - name: Set up rust cache - uses: Swatinem/rust-cache@v2 - with: - cache-on-failure: true - - - name: Run cargo fmt - run: cargo fmt --all --check - - - name: Run cargo clippy - run: cargo clippy --all-targets -- -D warnings -A incomplete-features - - - name: Run cargo clippy (with `cdk_erigon` flag) - run: cargo clippy --package zero --all-targets --no-default-features --features cdk_erigon -- -D warnings -A incomplete-features - - - name: Rustdoc - run: cargo doc --all diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..308492b6d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,52 @@ +name: lint + +on: + push: + branches: [develop, main] + pull_request: + branches: + - "**" + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + BINSTALL_NO_CONFIRM: true + +jobs: + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/rust + - run: cargo clippy --all-targets -- -D warnings + - run: cargo clippy --all-targets --no-default-features --features cdk_erigon -- -D warnings + udeps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/rust + - run: cargo binstall cargo-udeps + - run: cargo udeps --quiet + - run: cargo udeps --quiet --tests --benches --examples + rustdoc: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/rust + - run: cargo doc --all + cargo-fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/rust + - run: cargo fmt --check + taplo-fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/rust + - run: cargo binstall taplo-cli + - run: taplo fmt --check diff --git a/Cargo.lock b/Cargo.lock index 03223ee5f..3f717b5f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -757,7 +757,7 @@ dependencies = [ "assert2-macros", "diff", "is-terminal", - "yansi 1.0.1", + "yansi", ] [[package]] @@ -1196,32 +1196,6 @@ name = "camino" version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.23", - "serde", - "serde_json", - "thiserror", -] [[package]] name = "cast" @@ -3770,16 +3744,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "pretty_assertions" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" -dependencies = [ - "diff", - "yansi 0.5.1", -] - [[package]] name = "pretty_env_logger" version = "0.5.0" @@ -4413,9 +4377,6 @@ name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] [[package]] name = "semver-parser" @@ -5100,8 +5061,6 @@ dependencies = [ "nunny", "plonky2", "plonky2_maybe_rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_assertions", - "pretty_env_logger", "rlp", "serde", "serde_json", @@ -5749,12 +5708,6 @@ dependencies = [ "time", ] -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "yansi" version = "1.0.1" @@ -5770,7 +5723,6 @@ dependencies = [ "anyhow", "async-stream", "axum", - "cargo_metadata", "clap", "compat", "directories", @@ -5798,7 +5750,6 @@ dependencies = [ "serde_path_to_error", "thiserror", "tokio", - "toml", "tower 0.4.13", "trace_decoder", "tracing", diff --git a/Cargo.toml b/Cargo.toml index 9cbc60fd4..0bd15a3bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,6 +76,8 @@ paste = "1.0.15" pest = "2.7.10" pest_derive = "2.7.10" pretty_env_logger = "0.5.0" +proc-macro2 = "1.0" +quote = "1.0" rand = "0.8.5" rand_chacha = "0.3.1" ripemd = "0.1.3" @@ -83,11 +85,12 @@ rlp = "0.5.2" rlp-derive = "0.1.0" ruint = "1.12.3" serde = "1.0.203" -serde-big-array = "0.5.1" serde_json = "1.0.118" serde_path_to_error = "0.1.16" +serde-big-array = "0.5.1" sha2 = "0.10.8" static_assertions = "1.1.0" +syn = "2.0" thiserror = "1.0.61" tiny-keccak = "2.0.2" tokio = { version = "1.38.0", features = ["full"] } @@ -95,6 +98,7 @@ toml = "0.8.14" tower = "0.4" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } +trybuild = "1.0" u4 = "0.1.0" uint = "0.9.5" url = "2.5.2" @@ -115,11 +119,5 @@ plonky2_maybe_rayon = "0.2.0" plonky2_util = { git = "https://github.com/0xPolygonZero/plonky2.git", rev = "dc77c77f2b06500e16ad4d7f1c2b057903602eed" } starky = { git = "https://github.com/0xPolygonZero/plonky2.git", rev = "dc77c77f2b06500e16ad4d7f1c2b057903602eed" } -# proc macro related dependencies -proc-macro2 = "1.0" -quote = "1.0" -syn = "2.0" -trybuild = "1.0" - [workspace.lints.clippy] too_long_first_doc_paragraph = "allow" diff --git a/common/Cargo.toml b/common/Cargo.toml index c11038439..808a31068 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -9,9 +9,9 @@ keywords.workspace = true categories.workspace = true [dependencies] -ethereum-types = { workspace = true } -keccak-hash = { workspace = true } +ethereum-types.workspace = true [dev-dependencies] -bytes = { workspace = true } -rlp = { workspace = true } +bytes.workspace = true +keccak-hash.workspace = true +rlp.workspace = true diff --git a/compat/Cargo.toml b/compat/Cargo.toml index f52e57c45..7c7ce2238 100644 --- a/compat/Cargo.toml +++ b/compat/Cargo.toml @@ -10,5 +10,5 @@ keywords.workspace = true categories.workspace = true [dependencies] -alloy = { workspace = true } -__compat_primitive_types = { workspace = true } +__compat_primitive_types.workspace = true +alloy.workspace = true diff --git a/evm_arithmetization/Cargo.toml b/evm_arithmetization/Cargo.toml index ffdb8d2f5..278bbc40b 100644 --- a/evm_arithmetization/Cargo.toml +++ b/evm_arithmetization/Cargo.toml @@ -15,47 +15,45 @@ homepage.workspace = true keywords.workspace = true [dependencies] -anyhow = { workspace = true } -bytes = { workspace = true } -env_logger = { workspace = true } -ethereum-types = { workspace = true } +anyhow.workspace = true +bytes.workspace = true +env_logger.workspace = true +ethereum-types.workspace = true +hashbrown.workspace = true hex = { workspace = true, optional = true } -hex-literal = { workspace = true } -itertools = { workspace = true } -keccak-hash = { workspace = true } -log = { workspace = true } -plonky2_maybe_rayon = { workspace = true, features = ["parallel"] } -num = { workspace = true } -num-bigint = { workspace = true } -once_cell = { workspace = true } -pest = { workspace = true } -pest_derive = { workspace = true } +hex-literal.workspace = true +itertools.workspace = true +keccak-hash.workspace = true +log.workspace = true +mpt_trie.workspace = true +num.workspace = true +num-bigint.workspace = true +once_cell.workspace = true +pest.workspace = true +pest_derive.workspace = true plonky2 = { workspace = true, features = ["parallel"] } -plonky2_util = { workspace = true } -starky = { workspace = true, features = ["parallel"] } -rand = { workspace = true } -rand_chacha = { workspace = true } -rlp = { workspace = true } -rlp-derive = { workspace = true } +plonky2_maybe_rayon = { workspace = true, features = ["parallel"] } +plonky2_util.workspace = true +rand.workspace = true +rand_chacha.workspace = true +rlp.workspace = true +rlp-derive.workspace = true serde = { workspace = true, features = ["derive"] } -sha2 = { workspace = true } -static_assertions = { workspace = true } -hashbrown = { workspace = true } -thiserror = { workspace = true } -tiny-keccak = { workspace = true } -serde_json = { workspace = true } -serde-big-array = { workspace = true } - -# Local dependencies -mpt_trie = { workspace = true } +serde-big-array.workspace = true +serde_json.workspace = true +sha2.workspace = true smt_trie = { workspace = true, optional = true } -zk_evm_common = { workspace = true } -zk_evm_proc_macro = { workspace = true } +starky = { workspace = true, features = ["parallel"] } +static_assertions.workspace = true +thiserror.workspace = true +tiny-keccak.workspace = true +zk_evm_common.workspace = true +zk_evm_proc_macro.workspace = true [dev-dependencies] -criterion = { workspace = true } -hex = { workspace = true } -ripemd = { workspace = true } +criterion.workspace = true +hex.workspace = true +ripemd.workspace = true [features] default = ["eth_mainnet"] diff --git a/mpt_trie/Cargo.toml b/mpt_trie/Cargo.toml index 732a07377..fcdf14663 100644 --- a/mpt_trie/Cargo.toml +++ b/mpt_trie/Cargo.toml @@ -12,30 +12,30 @@ homepage.workspace = true exclude = ["test_data/*"] [dependencies] -bytes = { workspace = true } -enum-as-inner = { workspace = true } -ethereum-types = { workspace = true } -hex = { workspace = true } -keccak-hash = { workspace = true } +bytes.workspace = true +enum-as-inner.workspace = true +ethereum-types.workspace = true +hex.workspace = true +impl-codec.workspace = true +impl-num-traits.workspace = true +impl-rlp.workspace = true +impl-serde.workspace = true +keccak-hash.workspace = true +log.workspace = true +num-traits.workspace = true parking_lot = { workspace = true, features = ["serde"] } -thiserror = { workspace = true } -log = { workspace = true } -num-traits = { workspace = true } -uint = { workspace = true } -rlp = { workspace = true } +rlp.workspace = true serde = { workspace = true, features = ["derive", "rc"] } -impl-rlp = { workspace = true } -impl-codec = { workspace = true } -impl-serde = { workspace = true } -impl-num-traits = { workspace = true } -zk_evm_common = {workspace = true} +thiserror.workspace = true +uint.workspace = true +zk_evm_common.workspace = true [dev-dependencies] -eth_trie = { workspace = true } -pretty_env_logger = { workspace = true } -rand = { workspace = true } -rlp-derive = { workspace = true } -serde_json = { workspace = true } +eth_trie.workspace = true +pretty_env_logger.workspace = true +rand.workspace = true +rlp-derive.workspace = true +serde_json.workspace = true [features] default = ["trie_debug"] diff --git a/proc_macro/Cargo.toml b/proc_macro/Cargo.toml index c3ee894e4..0c35af660 100644 --- a/proc_macro/Cargo.toml +++ b/proc_macro/Cargo.toml @@ -17,9 +17,9 @@ name = "tests" path = "tests/compiletest.rs" [dependencies] -proc-macro2 = { workspace = true } -quote = { workspace = true } -syn = { workspace = true } +proc-macro2.workspace = true +quote.workspace = true +syn.workspace = true [dev-dependencies] -trybuild = { workspace = true } +trybuild.workspace = true diff --git a/smt_trie/Cargo.toml b/smt_trie/Cargo.toml index 08a05a0fb..6df15c11c 100644 --- a/smt_trie/Cargo.toml +++ b/smt_trie/Cargo.toml @@ -11,14 +11,14 @@ repository.workspace = true homepage.workspace = true keywords.workspace = true -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] -ethereum-types = { workspace = true } -hex-literal = { workspace = true } -plonky2 = { workspace = true } -rand = { workspace = true } +ethereum-types.workspace = true +plonky2.workspace = true +rand.workspace = true serde = { workspace = true, features = ["derive", "rc"] } +[dev-dependencies] +hex-literal.workspace = true + [lints] workspace = true diff --git a/taplo.toml b/taplo.toml new file mode 100644 index 000000000..ab616665e --- /dev/null +++ b/taplo.toml @@ -0,0 +1,9 @@ +[formatting] +reorder_keys = false + +[[rule]] +include = ["**/Cargo.toml"] +keys = ["dependencies", "dev-dependencies"] + +[rule.formatting] +reorder_keys = true diff --git a/trace_decoder/Cargo.toml b/trace_decoder/Cargo.toml index 8f6a63159..de9b389a2 100644 --- a/trace_decoder/Cargo.toml +++ b/trace_decoder/Cargo.toml @@ -10,54 +10,50 @@ homepage.workspace = true keywords.workspace = true [dependencies] -alloy = { workspace = true } +alloy.workspace = true alloy-compat = "0.1.0" -anyhow = { workspace = true } -bitflags = { workspace = true } -bitvec = { workspace = true } -bytes = { workspace = true } -ciborium = { workspace = true } -ciborium-io = { workspace = true } +anyhow.workspace = true +bitflags.workspace = true +bitvec.workspace = true +bytes.workspace = true +ciborium.workspace = true +ciborium-io.workspace = true copyvec = "0.2.0" -either = { workspace = true } -enum-as-inner = { workspace = true } -ethereum-types = { workspace = true } -hex = { workspace = true } -hex-literal = { workspace = true } -itertools = { workspace = true } -keccak-hash = { workspace = true } -log = { workspace = true } +either.workspace = true +enum-as-inner.workspace = true +ethereum-types.workspace = true +evm_arithmetization.workspace = true +hex.workspace = true +hex-literal.workspace = true +itertools.workspace = true +keccak-hash.workspace = true +log.workspace = true +mpt_trie.workspace = true nunny = { workspace = true, features = ["serde"] } -plonky2 = { workspace = true } -rlp = { workspace = true } -serde = { workspace = true } +plonky2.workspace = true +rlp.workspace = true +serde.workspace = true stackstack = "0.3.0" strum = { version = "0.26.3", features = ["derive"] } -thiserror = { workspace = true } -u4 = { workspace = true } -winnow = { workspace = true } - -# Local dependencies -evm_arithmetization = { workspace = true } -mpt_trie = { workspace = true } -smt_trie = { workspace = true } -zk_evm_common = { workspace = true } +thiserror.workspace = true +u4.workspace = true +winnow.workspace = true +zk_evm_common.workspace = true [dev-dependencies] -alloy = { workspace = true } +alloy.workspace = true alloy-compat = "0.1.0" assert2 = "0.3.15" camino = "1.1.9" -clap = { workspace = true } -criterion = { workspace = true } +clap.workspace = true +criterion.workspace = true glob = "0.3.1" libtest-mimic = "0.7.3" -plonky2_maybe_rayon = { workspace = true } -pretty_assertions = "1.4.0" -zero = { workspace = true } -pretty_env_logger = { workspace = true } -serde_json = { workspace = true } -serde_path_to_error = { workspace = true } +plonky2_maybe_rayon.workspace = true +serde_json.workspace = true +serde_path_to_error.workspace = true +smt_trie.workspace = true +zero.workspace = true [features] default = ["eth_mainnet"] diff --git a/zero/Cargo.toml b/zero/Cargo.toml index 5ccb57c96..22c2a8bfb 100644 --- a/zero/Cargo.toml +++ b/zero/Cargo.toml @@ -9,55 +9,50 @@ keywords.workspace = true categories.workspace = true [dependencies] -__compat_primitive_types = { workspace = true } -alloy = { workspace = true } +__compat_primitive_types.workspace = true +alloy.workspace = true alloy-compat = "0.1.0" -anyhow = { workspace = true } -async-stream = { workspace = true } -axum = { workspace = true } -cargo_metadata = { workspace = true } +anyhow.workspace = true +async-stream.workspace = true +axum.workspace = true clap = { workspace = true, features = ["derive", "string"] } +compat.workspace = true directories = "5.0.1" -dotenvy = { workspace = true } -futures = { workspace = true } -hashbrown = { workspace = true } -hex = { workspace = true } -itertools = { workspace = true } -keccak-hash = { workspace = true } -lru = { workspace = true } -num-traits = { workspace = true } -once_cell = { workspace = true } -paladin-core = { workspace = true } -plonky2 = { workspace = true } -plonky2_maybe_rayon = { workspace = true } +dotenvy.workspace = true +evm_arithmetization.workspace = true +futures.workspace = true +hashbrown.workspace = true +hex.workspace = true +itertools.workspace = true +keccak-hash.workspace = true +lru.workspace = true +mpt_trie.workspace = true +num-traits.workspace = true +once_cell.workspace = true +paladin-core.workspace = true +plonky2.workspace = true +plonky2_maybe_rayon.workspace = true regex = "1.5.4" -rlp = {workspace = true} +rlp.workspace = true ruint = { workspace = true, features = ["num-traits", "primitive-types"] } -serde = { workspace = true } -serde_json = { workspace = true } -serde_path_to_error = { workspace = true } -thiserror = { workspace = true } -tokio = { workspace = true } -toml = { workspace = true } +serde.workspace = true +serde_json.workspace = true +serde_path_to_error.workspace = true +thiserror.workspace = true +tokio.workspace = true tower = { workspace = true, features = ["retry"] } -tracing = { workspace = true } -tracing-subscriber = { workspace = true } -url = { workspace = true } - -# Local dependencies -compat = { workspace = true } -evm_arithmetization = { workspace = true } -mpt_trie = { workspace = true } -trace_decoder = { workspace = true } -zk_evm_common = { workspace = true } +trace_decoder.workspace = true +tracing.workspace = true +tracing-subscriber.workspace = true +url.workspace = true +zk_evm_common.workspace = true [target.'cfg(not(target_env = "msvc"))'.dependencies] jemallocator = "0.5.4" [build-dependencies] -anyhow = { workspace = true } -cargo_metadata = { workspace = true } +anyhow.workspace = true vergen-git2 = { version = "1.0.0", features = ["build"] }