Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[merlin, zk-sdk] Turn default-features for merlin crate to false #4469

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

samkim-crypto
Copy link

@samkim-crypto samkim-crypto commented Jan 15, 2025

Problem

When building zk-sdk with cargo-build-sbf, I get the following error

error: target is not supported, for more information see: https://docs.rs/getrandom/#unsupported-targets
   --> src/lib.rs:290:9
    |
290 | /         compile_error!("target is not supported, for more information see: \
291 | |                         https://docs.rs/getrandom/#unsupported-targets");
    | |________________________________________________________________________^

   Compiling solana-sha256-hasher v2.2.0 (/Users/samkim/Projects/solana-program/agave/sdk/sha256-hasher)
error[E0433]: failed to resolve: use of undeclared crate or module `imp`
   --> src/lib.rs:341:9
    |
341 |         imp::getrandom_inner(dest)?;
    |         ^^^ use of undeclared crate or module `imp`

The default features in the merlin crate, which zk-sdk depends on uses rand_core.

[features]
default = ["std"]
nightly = []
debug-transcript = ["hex"]
std = ["rand_core/std", "byteorder/std"]

Summary of Changes

I set default-features = false for the merlin crate, which resolves the above error with cargo-build-sbf (thanks @joncinque!).

After I remove the default features, it complains that the transcript module inside zk-sdk is not used in target_os = "solana" builds. Not sure why it did not complain before, but I added excluded the transcript module from the target_os = "solana" target build.

Fixes #

@samkim-crypto samkim-crypto marked this pull request as ready for review January 16, 2025 09:33
Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks good!

@samkim-crypto samkim-crypto merged commit 583beac into anza-xyz:master Jan 16, 2025
41 checks passed
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.

2 participants