fix(types): make malachitebft-signing-ed25519 a required dependency - #237
fix(types): make malachitebft-signing-ed25519 a required dependency#237mehmetkr-31 wants to merge 1 commit into
Conversation
osr21
left a comment
There was a problem hiding this comment.
Reviewed the diff against the verification I did on #236 — this is the right resolution and the mechanics are complete:
- The dependency edit is behavior-preserving for every existing consumer: previously all in-workspace consumers got the dep via
default = ["signer-local"](nobody useddefault-features = falseon this crate); now they get it unconditionally. Same compiled graph, same["rand", "serde"]features on the dep — which is whyCargo.lockis untouched, and that untouched lockfile is itself evidence the change only moves declarations, not resolution. - Dropping the now-empty
defaultrather than leavingdefault = []is right — an empty default table is noise that invites someone to wonder what used to live there. Git history answers that better.
On the two calls you flagged:
1. Removal without the alias — as argued in more detail on #236, the no-op alias protects a consumer class that provably cannot exist. Any external crate spelling features = ["signer-local"] necessarily also compiled the four unconditional imports, which only ever built with the feature on — so no one depends on the off-state, and the on-state is now simply the crate's permanent state. The compile_error! route is worse than both alternatives: arc-signer earns its guard by having a genuine either/or between providers, while a guard here would formalize a flag with exactly one legal value. One additional data point for the record that settles it beyond the build argument: signing.rs re-exports the dep's types (pub use malachitebft_signing_ed25519::{Ed25519, PrivateKey, PublicKey, Signature}), so the "optional" dependency's types were unconditionally part of this crate's public API all along. A feature cannot meaningfully gate a dependency the crate's API surface hard-requires — removal is the only honest declaration.
2. Keep the PRs separate; land #231 first if there's a choice. The two changes fix opposite halves of the same defect class (#233: feature-on doesn't build standalone; #236: feature-off doesn't build at all), and separate PRs keep each one revertible against its own issue. The rebase collision is one adjacent-line merge either way. Mild preference for #231 landing first only because its diff adds to the [features] table this PR shrinks — rebasing an addition over a deletion is marginally less error-prone than the reverse, and both are trivial.
Worth noting the verification here quietly demonstrates the gap #233's proposed cargo-hack CI job would close: --no-default-features per crate is now load-bearing correctness (this PR is the proof) and nothing in CI exercises it. If that job gets filed, this crate is the test case for both directions.
Approving — minimal, correct, and the feature table now tells the truth.
|
Heads up in case it helps you get this unstuck — your change is still correct, it just conflicts now. The only conflict is in the same [features]
default = ["signer-local"]
arbitrary = ["dep:arbitrary"]
byzantine = ["dep:malachitebft-engine-byzantine"]
signer-local = ["dep:malachitebft-signing-ed25519"]Keeping Full disclosure: I opened #301 with the same fix before I noticed yours existed — I worked from #236 and missed the "Opened as #237" line. Yours is three weeks older and should be the one that lands; I have said so there and will close mine once this moves. One thing worth adding to your description if you rebase: |
`cargo check -p arc-consensus-types --no-default-features` fails with
four unresolved imports:
error[E0432]: unresolved import `malachitebft_signing_ed25519`
--> crates/types/src/proposal_part.rs:26:5
--> crates/types/src/codec/proto.rs:28:5
--> crates/types/src/signing.rs:21:9
--> crates/types/src/ssz/v1/vote.rs:21:5
The `signer-local` feature gated `dep:malachitebft-signing-ed25519`,
but those four modules import it unconditionally and `signer-local`
never appears in a `#[cfg]` anywhere in the workspace. The feature
therefore offered no real choice: with it the crate builds, without it
the build breaks outright.
Make the dependency required and drop the feature along with the now
empty `default`. No crate in the workspace requested `signer-local`
explicitly, so nothing needs updating alongside this.
Cargo.lock is unchanged, `cargo check --workspace --all-features` still
passes, and the crate's 192 tests pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4dca429 to
e68f4eb
Compare
|
Rebased onto Re-verified on the new base rather than assuming the old measurements carried over: # main (v0.8.0)
$ cargo check -p arc-consensus-types --no-default-features --locked
error[E0432]: unresolved import `malachitebft_signing_ed25519` (x4)
# this branch
$ cargo check -p arc-consensus-types --no-default-features --locked
Finished `dev` profile in 37.80sSo the bug survived the sync — v0.8.0 touched Added your Thanks for the heads-up and for deferring #301 — genuinely helpful, and it saved me finding the conflict on my own schedule. If this one stalls the way the rest of my open PRs have, do reopen yours rather than letting the fix sit; the fix landing matters more than which PR carries it. |
|
Re-verified the rebase ( Confirmed on
On the #231 overlap — upgrade "may need a trivial rebase" to "will": I merge-tested the pairing on current With #301 deferred (on record over there — and credit to @JspIIV for the clean handling), this is the landing vehicle for #236. Nothing further from me: rebased, re-measured, still approved. |
Fixes #236.
Summary
arc-consensus-typesdoes not build with--no-default-features:The
signer-localfeature gateddep:malachitebft-signing-ed25519, but those four modules import it unconditionally andfeature = "signer-local"never appears in a#[cfg]anywhere in the workspace. The feature offered no real choice — with it the crate builds, without it the build breaks on unresolved imports.The dependency was never really optional
signing.rsre-exports the dependency's types unconditionally:So
Ed25519,PrivateKey,PublicKeyandSignatureare part of this crate's public API regardless of the feature. A feature cannot meaningfully gate a dependency whose types the API surface hard-requires — the choice was never between an optional and a required dependency, only between declaring the truth and not. Raised by @osr21 on #236 and by @JspIIV on this PR, independently.Change
Make the dependency required, and drop
signer-localtogether with the now-emptydefault. No crate in the workspace requested the feature explicitly, so nothing needs updating alongside this.Testing
cargo check -p arc-consensus-types --no-default-features— now compiles (fails onmain).cargo check --workspace --all-features— passes, no regression.cargo test -p arc-consensus-types— 192 tests pass.cargo fmt --all --check— clean.Cargo.lockunchanged.Two things worth your call
Feature-name compatibility. Removing the name means an external consumer spelling
features = ["signer-local"]would hit an unknown-feature error — though no such consumer can exist today, since the crate does not build without it. If you would rather keep the spelling working,signer-local = []as a no-op alias gives the same fix; I am happy to switch. A third option is keeping the feature and adding acompile_error!guard the wayarc-signerdoes, which turns the failure into a readable message but leaves a flag that can only ever be on.Overlap with #231. That PR also edits the
[features]table incrates/types/Cargo.toml(it declares thearbitraryfeature's own dependencies, per #233). The two changes are independent and touch adjacent lines, so whichever lands second may need a trivial rebase — I will handle it, just let me know if you would prefer them combined into one PR instead.