diff --git a/.config/zepter.yaml b/.config/zepter.yaml new file mode 100644 index 00000000..0b7ed439 --- /dev/null +++ b/.config/zepter.yaml @@ -0,0 +1,39 @@ +version: + format: 1 + # Minimum zepter version that is expected to work. This is just for printing a nice error + # message when someone tries to use an older version. + binary: 0.13.2 + +# The examples in the following comments assume crate `A` to have a dependency on crate `B`. +workflows: + check: + - [ + "lint", + # Check that `A` activates the features of `B`. + "propagate-feature", + # These are the features to check: + "--features=std,serde", + # Do not try to add a new section into `[features]` of `A` only because `B` expose that feature. There are edge-cases where this is still needed, but we can add them manually. + "--left-side-feature-missing=ignore", + # Ignore the case that `A` it outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on. + "--left-side-outside-workspace=ignore", + # limit to the workspace + "--workspace", + "--show-path", + "--quiet", + ] + default: + # Running `zepter` with no subcommand will check & fix. + - [$check.0, "--fix"] + +# Will be displayed when any workflow fails: +help: + text: | + Maili uses the Zepter CLI to detect abnormalities in Cargo features, e.g. missing propagation. + + It looks like one more checks failed; please check the console output. + + You can try to automatically address them by installing zepter (`cargo install zepter --locked`) and simply running `zepter` in the workspace root. + links: + - "https://github.com/op-rs/maili/pull/134" + - "https://github.com/ggwpez/zepter" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..d97aa5dd --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,22 @@ +name: lint + +on: + pull_request: + merge_group: + push: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + # Check crates correctly propagate features + feature-propagation: + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v4 + - run: | + cargo install zepter + zepter --version + time zepter run check diff --git a/crates/network/Cargo.toml b/crates/network/Cargo.toml index 29de3612..bbaa5954 100644 --- a/crates/network/Cargo.toml +++ b/crates/network/Cargo.toml @@ -25,3 +25,13 @@ alloy-network.workspace = true alloy-primitives.workspace = true alloy-rpc-types-eth.workspace = true alloy-signer.workspace = true + +[features] +std = [ + "op-alloy-consensus/std", + "op-alloy-rpc-types/std" +] +serde = [ + "op-alloy-consensus/serde", + "op-alloy-rpc-types/serde" +] diff --git a/crates/op-alloy/Cargo.toml b/crates/op-alloy/Cargo.toml index b2865838..198d7d16 100644 --- a/crates/op-alloy/Cargo.toml +++ b/crates/op-alloy/Cargo.toml @@ -30,9 +30,11 @@ op-alloy-rpc-types = { workspace = true, optional = true } default = ["std", "k256", "serde"] std = [ - "op-alloy-consensus?/std", - "op-alloy-rpc-types?/std", - "op-alloy-rpc-types-engine?/std", + "op-alloy-consensus?/std", + "op-alloy-rpc-types?/std", + "op-alloy-rpc-types-engine?/std", + "op-alloy-network?/std", + "op-alloy-provider?/std" ] full = [ @@ -54,8 +56,11 @@ arbitrary = [ ] serde = [ - "op-alloy-consensus?/serde", - "op-alloy-rpc-types-engine?/serde", + "op-alloy-consensus?/serde", + "op-alloy-rpc-types-engine?/serde", + "op-alloy-network?/serde", + "op-alloy-provider?/serde", + "op-alloy-rpc-types?/serde" ] # `no_std` support diff --git a/crates/provider/Cargo.toml b/crates/provider/Cargo.toml index 001703c1..baaca2dd 100644 --- a/crates/provider/Cargo.toml +++ b/crates/provider/Cargo.toml @@ -27,3 +27,11 @@ alloy-rpc-types-engine = { workspace = true, features = ["serde"] } # misc async-trait.workspace = true + +[features] +std = [ + "op-alloy-rpc-types-engine/std" +] +serde = [ + "op-alloy-rpc-types-engine/serde" +] diff --git a/crates/rpc-types-engine/Cargo.toml b/crates/rpc-types-engine/Cargo.toml index a3436b64..d8801c1f 100644 --- a/crates/rpc-types-engine/Cargo.toml +++ b/crates/rpc-types-engine/Cargo.toml @@ -52,9 +52,10 @@ std = [ "op-alloy-consensus/std", ] serde = [ - "dep:serde", - "dep:alloy-serde", - "alloy-rpc-types-engine/serde", + "dep:serde", + "dep:alloy-serde", + "alloy-rpc-types-engine/serde", + "op-alloy-consensus/serde" ] arbitrary = [ "std", diff --git a/crates/rpc-types/Cargo.toml b/crates/rpc-types/Cargo.toml index 20a497ba..4ecebc92 100644 --- a/crates/rpc-types/Cargo.toml +++ b/crates/rpc-types/Cargo.toml @@ -46,10 +46,11 @@ similar-asserts.workspace = true [features] default = ["std"] std = [ - "alloy-network-primitives/std", - "alloy-eips/std", - "alloy-primitives/std", - "alloy-rpc-types-eth/std", + "alloy-network-primitives/std", + "alloy-eips/std", + "alloy-primitives/std", + "alloy-rpc-types-eth/std", + "op-alloy-consensus/std" ] arbitrary = [ "std", @@ -62,3 +63,6 @@ k256 = [ "alloy-rpc-types-eth/k256", "op-alloy-consensus/k256", ] +serde = [ + "op-alloy-consensus/serde" +]