Skip to content

Commit

Permalink
build(core): fix use of c-kzg flag and cleanup dependencies (#1927)
Browse files Browse the repository at this point in the history
**Motivation**
We were having to add dependencies with `default-features = false`
everywhere, which also didn't scale, since if one dependency adds the
flag, it is added everywhere. We need to disable certain flags to be
able to prove with ZK.

**Description**
- Ordered crates alphabetically
- Just kept `cmd/ethrex` as the default when running cargo build.
- Removed `c-kzg` as a default flag in our crates. Added them to the
commands that require them: ethrex, ef_tests
- Changed dependencies to use the workspace version.
  • Loading branch information
mpaulucci authored Feb 13, 2025
1 parent a6e439c commit 3834cb2
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 54 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

27 changes: 14 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[workspace]
members = [
"cmd/ef_tests/blockchain",
"cmd/ef_tests/state",
"cmd/ethrex",
"cmd/ethrex_l2",
"cmd/hive_report",
"cmd/loc",
"crates/blockchain",
"crates/blockchain/dev",
"crates/common",
"crates/common/rlp",
"crates/l2/",
"crates/l2/contracts",
"crates/l2/prover",
"crates/l2/sdk",
"crates/networking/p2p",
"crates/networking/rpc",
"crates/storage/store",
"crates/vm",
"crates/storage/trie",
"crates/common/rlp",
"cmd/ethrex",
"cmd/ef_tests/blockchain",
"cmd/ef_tests/state",
"cmd/ethrex_l2",
"cmd/hive_report",
"crates/vm",
"crates/vm/levm",
"crates/vm/levm/bench/revm_comparison",
"crates/l2/",
"crates/l2/prover",
"crates/l2/contracts",
"crates/l2/sdk",
"cmd/loc",
]
resolver = "2"

default-members = ["cmd/ethrex", "cmd/ethrex_l2", "crates/l2/prover", "cmd/loc"]
default-members = ["cmd/ethrex"]

[workspace.package]
version = "0.1.0"
Expand All @@ -37,6 +37,7 @@ ethrex-p2p = { path = "./crates/networking/p2p" }
ethrex-rpc = { path = "./crates/networking/rpc" }
ethrex-storage = { path = "./crates/storage/store" }
ethrex-vm = { path = "./crates/vm" }
ethrex-levm = { path = "./crates/vm/levm" }
ethrex-trie = { path = "./crates/storage/trie" }
ethrex-rlp = { path = "./crates/common/rlp" }
ethrex-l2 = { path = "./crates/l2" }
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ loc-stats:
fi

loc-detailed:
cargo run --release --bin loc -- --detailed
cargo run --release -p loc --bin loc -- --detailed

loc-compare-detailed:
cargo run --release --bin loc -- --compare-detailed
cargo run --release -p loc --bin loc -- --compare-detailed

hive-stats:
make hive QUIET=true
Expand Down
6 changes: 5 additions & 1 deletion cmd/ef_tests/blockchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ethrex-blockchain.workspace = true
ethrex-common.workspace = true
ethrex-storage.workspace = true
ethrex-rlp.workspace = true
ethrex-vm.workspace = true

serde.workspace = true
serde_json.workspace = true
bytes.workspace = true
Expand All @@ -21,6 +21,10 @@ datatest-stable = "0.2.9"
[lib]
path = "./lib.rs"

[features]
default = ["c-kzg"]
c-kzg = ["ethrex-blockchain/c-kzg"]

[[test]]
name = "cancun"
harness = false
Expand Down
12 changes: 9 additions & 3 deletions cmd/ef_tests/state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ version.workspace = true
edition.workspace = true

[dependencies]
ethrex-blockchain = { workspace = true }
ethrex-blockchain.workspace = true
ethrex-common.workspace = true
ethrex-storage.workspace = true
ethrex-rlp.workspace = true
ethrex-vm = { workspace = true }
ethrex-levm = { path = "../../../crates/vm/levm" }
ethrex-vm.workspace = true
ethrex-levm.workspace = true

serde.workspace = true
serde_json.workspace = true
bytes.workspace = true
Expand All @@ -35,6 +36,11 @@ hex = "0.4.3"
[lib]
path = "./lib.rs"

[features]
default = ["c-kzg", "blst"]
c-kzg = ["ethrex-vm/c-kzg", "ethrex-levm/c-kzg", "ethrex-common/c-kzg"]
blst = ["ethrex-vm/blst"]

[[test]]
name = "all"
harness = false
6 changes: 4 additions & 2 deletions cmd/ethrex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ethrex-blockchain.workspace = true
ethrex-rpc.workspace = true
ethrex-common.workspace = true
ethrex-p2p.workspace = true
ethrex-storage = { workspace = true }
ethrex-storage.workspace = true
ethrex-vm.workspace = true
ethrex-rlp.workspace = true
ethrex-l2 = { workspace = true, optional = true }
Expand Down Expand Up @@ -42,9 +42,11 @@ name = "ethrex"
path = "./ethrex.rs"

[features]
default = ["libmdbx"]
default = ["libmdbx", "c-kzg", "blst"]
dev = ["dep:ethrex-dev"]
c-kzg = ["ethrex-vm/c-kzg", "ethrex-common/c-kzg", "ethrex-blockchain/c-kzg", "ethrex-p2p/c-kzg"]
metrics = ["ethrex-blockchain/metrics", "ethrex-l2/metrics"]
libmdbx = ["dep:libmdbx", "ethrex-storage/libmdbx"]
redb = ["dep:redb", "ethrex-storage/redb"]
blst = ["ethrex-vm/blst"]
l2 = ["dep:ethrex-l2", "ethrex-vm/l2"]
16 changes: 8 additions & 8 deletions cmd/ethrex_l2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ version.workspace = true
edition.workspace = true

[dependencies]
ethrex-l2.workspace = true
ethrex-sdk.workspace = true
ethrex-common.workspace = true
ethrex-blockchain.workspace = true
ethrex-prover.workspace = true
ethrex-rlp.workspace = true
ethrex-rpc.workspace = true

serde_json.workspace = true
serde.workspace = true
bytes.workspace = true
Expand All @@ -26,14 +34,6 @@ strum = "0.26.3"
secp256k1.workspace = true
keccak-hash.workspace = true

ethrex-l2.workspace = true
ethrex-sdk.workspace = true
ethrex-common.workspace = true
ethrex-blockchain.workspace = true
ethrex-prover.workspace = true
ethrex-rlp.workspace = true
ethrex-rpc.workspace = true

[[bin]]
name = "ethrex_l2"
path = "./src/main.rs"
16 changes: 9 additions & 7 deletions crates/blockchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ethrex-levm = { path = "../vm/levm", default-features = false }
ethrex-rlp.workspace = true
ethrex-common.workspace = true
ethrex-storage.workspace = true
ethrex-vm.workspace = true
ethrex-levm.workspace = true

thiserror.workspace = true
sha3.workspace = true
tracing.workspace = true
bytes.workspace = true
cfg-if = "1.0.0"

ethrex-rlp.workspace = true
ethrex-common = { path = "../common", default-features = false }
ethrex-storage = { path = "../storage/store", default-features = false }
ethrex-vm = { path = "../vm", default-features = false }


k256 = { version = "0.13.3", features = ["ecdh"] }

Expand All @@ -30,7 +32,7 @@ hex = "0.4.3"
path = "./blockchain.rs"

[features]
default = ["c-kzg"]
default = []
libmdbx = ["ethrex-common/libmdbx", "ethrex-storage/default", "ethrex-vm/libmdbx"]
c-kzg = ["ethrex-common/c-kzg", "ethrex-levm/c-kzg"]
c-kzg = ["ethrex-common/c-kzg", "ethrex-vm/c-kzg", "ethrex-levm/c-kzg"]
metrics = ["ethrex-metrics/transactions"]
2 changes: 1 addition & 1 deletion crates/blockchain/metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ thiserror.workspace = true
serde_json.workspace = true
serde.workspace = true

ethrex-common = { path = "../../common", default-features = false }
ethrex-common.workspace = true


prometheus = { version = "0.13.4", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
ethrex-rlp.workspace = true
ethrex-trie = { path = "../storage/trie", default-features = false }
ethrex-trie.workspace = true

tracing.workspace = true
tinyvec = "1.6.0"
Expand All @@ -31,7 +31,7 @@ lazy_static.workspace = true
hex-literal.workspace = true

[features]
default = ["c-kzg"]
default = []
libmdbx = ["ethrex-trie/libmdbx"]
redb = ["ethrex-trie/redb"]
c-kzg = ["dep:c-kzg"]
Expand Down
2 changes: 1 addition & 1 deletion crates/l2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ethrex-rpc.workspace = true
ethrex-blockchain.workspace = true
ethrex-storage.workspace = true
ethrex-vm.workspace = true
ethrex-dev = { path = "../../crates/blockchain/dev" }
ethrex-dev = { path = "../../crates/blockchain/dev", default-features = false }
hex.workspace = true
bytes.workspace = true
jsonwebtoken.workspace = true
Expand Down
1 change: 0 additions & 1 deletion crates/l2/prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ risc0-zkvm = { version = "1.2.2" }
sp1-sdk = "3.4.0"

[dev-dependencies]
ethrex-vm.workspace = true
ethrex-storage.workspace = true
ethrex-blockchain.workspace = true

Expand Down
4 changes: 4 additions & 0 deletions crates/networking/p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ hex-literal = "0.4.1"

[lib]
path = "./p2p.rs"

[features]
default = ["c-kzg"]
c-kzg = ["ethrex-blockchain/c-kzg", "ethrex-common/c-kzg"]
4 changes: 2 additions & 2 deletions crates/storage/store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ edition = "2021"

[dependencies]
ethrex-rlp.workspace = true
ethrex-common = { path = "../../common", default-features = false }
ethrex-trie = { path = "../../storage/trie", default-features = false }
ethrex-common.workspace = true
ethrex-trie.workspace = true

ethereum-types.workspace = true
anyhow = "1.0.86"
Expand Down
17 changes: 9 additions & 8 deletions crates/vm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[package]
name = "ethrex-vm"
version = "0.1.0"
edition = "2021"
version.workspace = true
edition.workspace = true

[dependencies]
ethrex-common = { path = "../common", default-features = false }
ethrex-storage = { path = "../storage/store", default-features = false }
ethrex-levm = { path = "./levm", default-features = false }
ethrex-trie = { path = "../storage/trie", default-features = false }
ethrex-rlp = { path = "../common/rlp", default-features = false }
ethrex-common.workspace = true
ethrex-storage.workspace = true
ethrex-levm.workspace = true
ethrex-trie.workspace = true
ethrex-rlp.workspace = true

revm = { version = "18.0.0", features = [
"serde",
"std",
Expand Down Expand Up @@ -38,7 +39,7 @@ ethereum-types.workspace = true
path = "./vm.rs"

[features]
default = ["c-kzg", "blst"]
default = []
l2 = []
c-kzg = ["revm/c-kzg", "ethrex-levm/c-kzg", "ethrex-common/c-kzg"]
blst = ["revm/blst"]
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/levm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version.workspace = true
edition.workspace = true

[dependencies]
ethrex-common = { path = "../../common", default-features = false }
ethrex-common.workspace = true
ethrex-rlp.workspace = true
revm-primitives = { version = "14.0.0", features = [
"std",
Expand Down Expand Up @@ -40,7 +40,7 @@ colored = "2.1.0"
spinoff = "0.8.0"

[features]
default = ["c-kzg"]
default = []
c-kzg = ["ethrex-common/c-kzg"]
ethereum_foundation_tests = []

Expand Down

0 comments on commit 3834cb2

Please sign in to comment.