Skip to content

feat(op-reth): make chainspec reth-codec opt-in#21178

Closed
fakedev9999 wants to merge 1 commit into
ethereum-optimism:developfrom
fakedev9999:fakedev9999/op-reth-chainspec-reth-codec-opt-in
Closed

feat(op-reth): make chainspec reth-codec opt-in#21178
fakedev9999 wants to merge 1 commit into
ethereum-optimism:developfrom
fakedev9999:fakedev9999/op-reth-chainspec-reth-codec-opt-in

Conversation

@fakedev9999

Copy link
Copy Markdown
Contributor

Summary

Makes the reth-codec feature opt-in for reth-optimism-chainspec (on by default to preserve behavior), so type-only consumers can avoid the native zstd-sys C build.

Why

reth-optimism-chainspec force-enables reth-codec on its reth-optimism-primitives dependency:

reth-optimism-primitives = { workspace = true, features = ["serde", "reth-codec"] }

Because this is in the dependency line (not gated by a feature), it is unconditional: every consumer of reth-optimism-chainspec transitively pulls
reth-optimism-primitives/reth-codec → op-alloy-consensus/reth-codec → reth-zstd-compressors → zstd → zstd-sys (native C).

reth-optimism-chainspec itself has no Compact / reth_codec / reth_zstd usage — the feature is only there for downstream convenience. The forced native zstd C build breaks std targets without a C cross-compiler — e.g. the riscv64im-succinct-zkvm zkVM target, where zstd-sys fails (cc: unrecognized argument -mabi=lp64).

Change

rust/op-reth/crates/chainspec/Cargo.toml:

  • Drop reth-codec from the unconditional reth-optimism-primitives dep features (keep serde).
  • Add reth-codec = ["reth-optimism-primitives/reth-codec"].
  • Add reth-codec to default (was default = ["std"]["std", "reth-codec"]).

Backward compatibility

  • Default consumers: unchanged — default still enables reth-codec.
  • Type-only / zkVM consumers: set default-features = false to drop reth-codec and the reth-zstd-compressors/zstd/zstd-sys chain.
  • No public API names changed; reth-optimism-chainspec builds the same with default features.

Validation

Downstream (succinctlabs/rsp, SP1 zkVM rsp-client-op ELF for riscv64im-succinct-zkvm): with this applied (+ default-features = false on the chainspec edge), zstd-sys/zstd/reth-zstd-compressors are absent from the compiled feature graph. Default (host) builds are unaffected.

reth-optimism-chainspec force-enabled reth-codec on reth-optimism-primitives via
its dependency line, unconditionally pulling reth-zstd-compressors → zstd → zstd-sys
(native C) into every consumer — even type-only ones. The chainspec crate has no
Compact/zstd usage of its own. Gate reth-codec behind an opt-in feature (on by
default to preserve behavior) so zkVM/type-only consumers can drop the native zstd
C build with default-features = false.
@einar-oplabs

Copy link
Copy Markdown
Contributor

@claude review once

@einar-oplabs einar-oplabs self-requested a review June 17, 2026 13:54
@einar-oplabs einar-oplabs self-assigned this Jun 17, 2026

@einar-oplabs einar-oplabs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

@einar-oplabs

Copy link
Copy Markdown
Contributor

/ci authorize 7aeccf1

@einar-oplabs einar-oplabs enabled auto-merge June 17, 2026 13:56
@einar-oplabs einar-oplabs disabled auto-merge June 18, 2026 14:46
@einar-oplabs

Copy link
Copy Markdown
Contributor

@fakedev9999 Please rebase on origin/develop.

Context: cd rust && just deny fails on your branch, but seems to pass after a rebase.

@einar-oplabs einar-oplabs added the M-community Meta: community help wanted label Jun 18, 2026
@einar-oplabs

Copy link
Copy Markdown
Contributor

Superceded by #21483.

Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M-community Meta: community help wanted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants