Skip to content

coinbase-smt: silence unused-import warnings in both build configs - #239

Merged
defenwycke merged 4 commits into
mainfrom
fix/coinbase-smt-warnings
Sep 10, 2026
Merged

defenwycke merged 4 commits into
mainfrom
fix/coinbase-smt-warnings

Conversation

@defenwycke

Copy link
Copy Markdown
Contributor

Four unused-import warnings, in two groups. Both come from imports whose only users are conditionally compiled, so each is only unused in some configurations — which is why they survived.

sha2::{Digest, Sha256} — unused outside tests

The crate-root import's only users are the two #[cfg(test)] modules (mod tests, mod oracle). Everything non-test that hashes is in roots.rs and bip30.rs, and both already carry their own import. Moved it into the two test modules, matching the pattern bip30.rs uses.

alloc::vec::Vec and roots::bit — unused under no_std

Every non-test use of both is inside the #[cfg(feature = "std")] impl Smt block, so on a guest (--no-default-features) build they are genuinely unused. Gated on feature = "std".

extern crate alloc stays unconditional — roots.rs needs it.

Verification

config unused-import warnings
--no-default-features (guest/no_std) 0
default (std) 0
cargo test 0
full prover workspace build 0

cargo test -p hazync-coinbase-smt27 passed, 0 failed.

The no_std path is the one worth caring about: this crate is compiled into the guest, and warnings in a guest-facing crate are exactly where a real one goes unnoticed.

No functional change — imports only.

Four warnings, in two groups, both from imports whose only users are
conditionally compiled.

`sha2::{Digest, Sha256}` at the crate root is used ONLY by the two
`#[cfg(test)]` modules -- `roots.rs` and `bip30.rs` each carry their
own. Moved into those two modules, matching what bip30.rs already does.

`alloc::vec::Vec` and `roots::bit` are used only by the std-only
`impl Smt`, so they warn on every no_std (guest) build. Gated on
`feature = "std"`.

Verified all four configurations build with zero unused-import
warnings -- std, no_std, test, and the full prover workspace -- and the
27 crate tests still pass. The no_std path is the one that matters:
warnings in a guest-facing crate are where a real one hides.
@defenwycke
defenwycke merged commit 4b5cb2b into main Sep 10, 2026
6 checks passed
@defenwycke
defenwycke deleted the fix/coinbase-smt-warnings branch September 10, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant