Skip to content

Commit

Permalink
fix: feature propagation (#11888)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Seitz <[email protected]>
Co-authored-by: Oliver <[email protected]>
  • Loading branch information
3 people authored Oct 19, 2024
1 parent 6c026da commit cf4a445
Show file tree
Hide file tree
Showing 59 changed files with 876 additions and 197 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,serde-bincode-compat,serde,test-utils,arbitrary,bench",
# 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 correctly 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
27 changes: 26 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ pprof = "0.13"
proptest = "1.4"
proptest-derive = "0.5"
serial_test = { default-features = false, version = "3" }
similar-asserts = { default-features = false, version = "1.5.0" }
similar-asserts = { version = "1.5.0", features = ["serde"] }
tempfile = "3.8"
test-fuzz = "6"

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 @@ -103,14 +103,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
23 changes: 21 additions & 2 deletions crates/blockchain-tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,24 @@ alloy-genesis.workspace = true
alloy-consensus.workspace = true

[features]
test-utils = []
optimism = ["reth-primitives/optimism", "reth-provider/optimism"]
test-utils = [
"reth-chainspec/test-utils",
"reth-consensus/test-utils",
"reth-evm/test-utils",
"reth-network/test-utils",
"reth-primitives/test-utils",
"reth-revm/test-utils",
"reth-stages-api/test-utils",
"reth-db/test-utils",
"reth-db-api/test-utils",
"reth-provider/test-utils",
"reth-trie-db/test-utils",
"reth-trie/test-utils"
]
optimism = [
"reth-primitives/optimism",
"reth-provider/optimism",
"reth-execution-types/optimism",
"reth-db/optimism",
"reth-db-api/optimism"
]
14 changes: 9 additions & 5 deletions crates/chain-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ revm.workspace = true

[features]
test-utils = [
"alloy-signer",
"alloy-signer-local",
"alloy-consensus",
"rand",
"revm"
"alloy-signer",
"alloy-signer-local",
"alloy-consensus",
"rand",
"revm",
"reth-chainspec/test-utils",
"reth-primitives/test-utils",
"reth-trie/test-utils",
"revm?/test-utils"
]
29 changes: 22 additions & 7 deletions crates/chainspec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,26 @@ 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",
"reth-ethereum-forks/arbitrary",
"reth-primitives-traits/arbitrary",
"reth-trie-common/arbitrary",
"alloy-consensus/arbitrary",
"alloy-eips/arbitrary",
"alloy-primitives/arbitrary",
"alloy-trie/arbitrary"
]
test-utils = [
"reth-primitives-traits/test-utils",
"reth-trie-common/test-utils"
]
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 @@ -46,4 +46,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 @@ -78,8 +78,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"
]
10 changes: 8 additions & 2 deletions crates/consensus/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,11 @@ derive_more.workspace = true

[features]
default = ["std"]
std = []
test-utils = []
std = [
"reth-primitives/std",
"alloy-primitives/std",
"alloy-eips/std"
]
test-utils = [
"reth-primitives/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"
]
Loading

0 comments on commit cf4a445

Please sign in to comment.