Skip to content

Commit

Permalink
fix: feature propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
liamaharon committed Oct 19, 2024
1 parent 9c8f5d8 commit c154a1c
Show file tree
Hide file tree
Showing 36 changed files with 325 additions and 84 deletions.
40 changes: 40 additions & 0 deletions .config/zepter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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,optimism,dev,asm-keccak,jemalloc,jemalloc-prof,tracy-allocator",
# 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",
# Auxillary flags:
"--offline",
"--locked",
"--show-path",
"--quiet",
]
default:
# Running `zepter` with no subcommand will check & fix.
- [$check.0, "--fix"]

# Will be displayed when any workflow fails:
help:
text: |
Reth uses the Zepter CLI to detect abnormalities in Cargo features, e.g. missing propagation.
It looks like one more 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/paradigmxyz/reth/pull/11888"
- "https://github.com/ggwpez/zepter"
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,22 @@ jobs:
env:
RUSTFLAGS: -D warnings

# Check crates correclty propagate features
feature-propagation:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: fetch deps
run: |
# Eagerly pull dependencies
time cargo metadata --format-version=1 --locked > /dev/null
- name: run zepter
run: |
cargo install zepter -f --locked
zepter --version
time zepter run check
lint-success:
name: lint success
runs-on: ubuntu-latest
Expand All @@ -236,6 +252,7 @@ jobs:
- grafana
- no-test-deps
- features
- feature-propagation
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
Expand Down
13 changes: 10 additions & 3 deletions bin/reth-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,16 @@ reth-tracing.workspace = true
[features]
default = ["jemalloc"]

asm-keccak = ["reth-primitives/asm-keccak"]

jemalloc = ["reth-cli-util/jemalloc"]
asm-keccak = [
"reth-primitives/asm-keccak",
"reth-node-core/asm-keccak",
"alloy-primitives/asm-keccak"
]

jemalloc = [
"reth-cli-util/jemalloc",
"reth-node-core/jemalloc"
]
jemalloc-prof = ["reth-cli-util/jemalloc-prof"]
tracy-allocator = ["reth-cli-util/tracy-allocator"]

Expand Down
11 changes: 9 additions & 2 deletions bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,21 @@ default = ["jemalloc"]

dev = ["reth-cli-commands/dev"]

asm-keccak = ["reth-node-core/asm-keccak", "reth-primitives/asm-keccak"]
asm-keccak = [
"reth-node-core/asm-keccak",
"reth-primitives/asm-keccak",
"alloy-primitives/asm-keccak"
]

jemalloc = [
"reth-cli-util/jemalloc",
"reth-node-core/jemalloc",
"reth-node-metrics/jemalloc",
]
jemalloc-prof = ["reth-cli-util/jemalloc"]
jemalloc-prof = [
"reth-cli-util/jemalloc",
"reth-cli-util/jemalloc-prof"
]
tracy-allocator = ["reth-cli-util/tracy-allocator"]

min-error-logs = ["tracing/release_max_level_error"]
Expand Down
8 changes: 7 additions & 1 deletion crates/blockchain-tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,10 @@ alloy-consensus.workspace = true

[features]
test-utils = []
optimism = ["reth-primitives/optimism", "reth-provider/optimism"]
optimism = [
"reth-primitives/optimism",
"reth-provider/optimism",
"reth-execution-types/optimism",
"reth-db/optimism",
"reth-db-api/optimism"
]
13 changes: 8 additions & 5 deletions crates/chainspec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ alloy-genesis.workspace = true
[features]
default = ["std"]
std = [
"alloy-chains/std",
"alloy-eips/std",
"alloy-genesis/std",
"alloy-primitives/std",
"alloy-trie/std",
"alloy-chains/std",
"alloy-eips/std",
"alloy-genesis/std",
"alloy-primitives/std",
"alloy-trie/std",
"reth-primitives-traits/std",
"alloy-consensus/std",
"once_cell/std"
]
arbitrary = ["alloy-chains/arbitrary"]
test-utils = []
10 changes: 9 additions & 1 deletion crates/consensus/auto-seal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,12 @@ tokio-stream.workspace = true
tracing.workspace = true

[features]
optimism = ["reth-provider/optimism", "reth-optimism-consensus"]
optimism = [
"reth-provider/optimism",
"reth-optimism-consensus",
"reth-beacon-consensus/optimism",
"reth-execution-types/optimism",
"reth-optimism-consensus?/optimism",
"reth-primitives/optimism",
"revm-primitives/optimism"
]
10 changes: 6 additions & 4 deletions crates/consensus/beacon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ assert_matches.workspace = true

[features]
optimism = [
"reth-chainspec",
"reth-primitives/optimism",
"reth-provider/optimism",
"reth-blockchain-tree/optimism",
"reth-chainspec",
"reth-primitives/optimism",
"reth-provider/optimism",
"reth-blockchain-tree/optimism",
"reth-db/optimism",
"reth-db-api/optimism"
]
5 changes: 4 additions & 1 deletion crates/consensus/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ derive_more.workspace = true

[features]
default = ["std"]
std = []
std = [
"reth-primitives/std",
"alloy-primitives/std"
]
test-utils = []
6 changes: 5 additions & 1 deletion crates/engine/local/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ op-alloy-rpc-types-engine = { workspace = true, optional = true }
workspace = true

[features]
optimism = ["op-alloy-rpc-types-engine"]
optimism = [
"op-alloy-rpc-types-engine",
"reth-beacon-consensus/optimism",
"reth-provider/optimism"
]
5 changes: 4 additions & 1 deletion crates/engine/util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ tracing.workspace = true

[features]
optimism = [
"reth-beacon-consensus/optimism",
"reth-beacon-consensus/optimism",
"reth-primitives/optimism",
"reth-provider/optimism",
"revm-primitives/optimism"
]
11 changes: 7 additions & 4 deletions crates/ethereum-forks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ default = ["std", "serde", "rustc-hash"]
arbitrary = ["dep:arbitrary", "dep:proptest", "dep:proptest-derive"]
serde = ["dep:serde"]
std = [
"alloy-chains/std",
"alloy-primitives/std",
"thiserror-no-std/std",
"rustc-hash/std",
"alloy-chains/std",
"alloy-primitives/std",
"thiserror-no-std/std",
"rustc-hash/std",
"alloy-consensus/std",
"once_cell/std",
"serde?/std"
]
rustc-hash = ["dep:rustc-hash"]
12 changes: 11 additions & 1 deletion crates/ethereum/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,14 @@ alloy-genesis.workspace = true

[features]
default = ["std"]
std = []
std = [
"reth-consensus/std",
"reth-primitives/std",
"reth-revm/std",
"alloy-consensus/std",
"alloy-eips/std",
"alloy-genesis/std",
"alloy-primitives/std",
"revm-primitives/std",
"secp256k1/std"
]
13 changes: 12 additions & 1 deletion crates/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,16 @@ parking_lot.workspace = true

[features]
default = ["std"]
std = ["dep:metrics", "dep:reth-metrics"]
std = [
"dep:metrics",
"dep:reth-metrics",
"reth-consensus/std",
"reth-primitives/std",
"reth-primitives-traits/std",
"reth-revm/std",
"alloy-eips/std",
"alloy-primitives/std",
"revm-primitives/std",
"revm/std"
]
test-utils = ["dep:parking_lot"]
7 changes: 6 additions & 1 deletion crates/evm/execution-errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ derive_more.workspace = true

[features]
default = ["std"]
std = ["reth-consensus/std"]
std = [
"reth-consensus/std",
"alloy-eips/std",
"alloy-primitives/std",
"revm-primitives/std"
]
8 changes: 7 additions & 1 deletion crates/evm/execution-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,10 @@ default = ["std"]
optimism = ["reth-primitives/optimism", "revm/optimism"]
serde = ["dep:serde", "reth-trie/serde", "revm/serde"]
serde-bincode-compat = ["reth-primitives/serde-bincode-compat", "reth-trie/serde-bincode-compat", "serde_with"]
std = []
std = [
"reth-primitives/std",
"alloy-eips/std",
"alloy-primitives/std",
"revm/std",
"serde?/std"
]
7 changes: 6 additions & 1 deletion crates/net/p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@ tokio = { workspace = true, features = ["full"] }
[features]
default = ["std"]
test-utils = ["reth-consensus/test-utils", "parking_lot"]
std = ["reth-consensus/std"]
std = [
"reth-consensus/std",
"reth-primitives/std",
"alloy-eips/std",
"alloy-primitives/std"
]
12 changes: 9 additions & 3 deletions crates/node/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ tempfile.workspace = true

[features]
optimism = [
"reth-primitives/optimism"
"reth-primitives/optimism",
"reth-db/optimism"
]
# Features for vergen to generate correct env vars
jemalloc = []
asm-keccak = []
jemalloc = [
"reth-cli-util/jemalloc"
]
asm-keccak = [
"reth-primitives/asm-keccak",
"alloy-primitives/asm-keccak"
]

[build-dependencies]
vergen = { version = "8.0.0", features = ["build", "cargo", "git", "gitcl"] }
10 changes: 9 additions & 1 deletion crates/optimism/bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ tracy-allocator = ["reth-cli-util/tracy-allocator"]

asm-keccak = ["reth-optimism-cli/asm-keccak", "reth-optimism-node/asm-keccak"]

optimism = ["reth-optimism-cli/optimism", "reth-optimism-node/optimism"]
optimism = [
"reth-optimism-cli/optimism",
"reth-optimism-node/optimism",
"reth-optimism-consensus/optimism",
"reth-optimism-evm/optimism",
"reth-optimism-payload-builder/optimism",
"reth-optimism-rpc/optimism",
"reth-provider/optimism"
]

min-error-logs = ["tracing/release_max_level_error"]
min-warn-logs = ["tracing/release_max_level_warn"]
Expand Down
18 changes: 10 additions & 8 deletions crates/optimism/chainspec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ op-alloy-rpc-types.workspace = true
[features]
default = ["std"]
std = [
"alloy-chains/std",
"alloy-genesis/std",
"alloy-primitives/std",
"op-alloy-rpc-types/std",
"reth-chainspec/std",
"reth-ethereum-forks/std",
"reth-primitives-traits/std",
"reth-optimism-forks/std",
"alloy-chains/std",
"alloy-genesis/std",
"alloy-primitives/std",
"op-alloy-rpc-types/std",
"reth-chainspec/std",
"reth-ethereum-forks/std",
"reth-primitives-traits/std",
"reth-optimism-forks/std",
"alloy-consensus/std",
"once_cell/std"
]
13 changes: 8 additions & 5 deletions crates/optimism/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ reth-cli-commands.workspace = true

[features]
optimism = [
"reth-primitives/optimism",
"reth-optimism-evm/optimism",
"reth-provider/optimism",
"reth-node-core/optimism",
"reth-optimism-node/optimism",
"reth-primitives/optimism",
"reth-optimism-evm/optimism",
"reth-provider/optimism",
"reth-node-core/optimism",
"reth-optimism-node/optimism",
"reth-execution-types/optimism",
"reth-db/optimism",
"reth-db-api/optimism"
]
asm-keccak = [
"alloy-primitives/asm-keccak",
Expand Down
21 changes: 16 additions & 5 deletions crates/optimism/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,21 @@ alloy-consensus.workspace = true

[features]
default = ["std"]
std = []
std = [
"reth-consensus/std",
"reth-primitives/std",
"reth-revm/std",
"alloy-consensus/std",
"alloy-eips/std",
"alloy-genesis/std",
"alloy-primitives/std",
"revm-primitives/std",
"revm/std"
]
optimism = [
"reth-primitives/optimism",
"reth-execution-types/optimism",
"reth-optimism-consensus/optimism",
"revm/optimism",
"reth-primitives/optimism",
"reth-execution-types/optimism",
"reth-optimism-consensus/optimism",
"revm/optimism",
"revm-primitives/optimism"
]
Loading

0 comments on commit c154a1c

Please sign in to comment.