Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

sdk: add "everything" feature#12985

Merged
mvines merged 1 commit intosolana-labs:masterfrom
mvines:everything
Oct 20, 2020
Merged

sdk: add "everything" feature#12985
mvines merged 1 commit intosolana-labs:masterfrom
mvines:everything

Conversation

@mvines
Copy link
Copy Markdown
Contributor

@mvines mvines commented Oct 19, 2020

Cargo features are intended to be additive. Once the "program" feature is added there's no way to get back to the feature set of solana-sdk that includes everything. To avoid this add an explicit "everything" feature (enabled by default).

@mvines mvines added the v1.4 label Oct 19, 2020
@mvines mvines force-pushed the everything branch 3 times, most recently from 247659e to fa32a1a Compare October 19, 2020 18:12
@mvines mvines force-pushed the everything branch 2 times, most recently from a685366 to caf6a5e Compare October 19, 2020 19:43
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 19, 2020

Codecov Report

Merging #12985 into master will decrease coverage by 0.0%.
The diff coverage is 100.0%.

@@            Coverage Diff            @@
##           master   #12985     +/-   ##
=========================================
- Coverage    81.9%    81.9%   -0.1%     
=========================================
  Files         361      361             
  Lines       85272    85272             
=========================================
- Hits        69890    69877     -13     
- Misses      15382    15395     +13     

Comment thread sdk/Cargo.toml
digest = { version = "0.9.0", optional = true }

[target.'cfg(not(target_arch = "bpf"))'.dependencies]
curve25519-dalek = { version = "2.1.0" }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

freebie: this fixes a compile error when using Pubkey::create_program_address() from a program when not targeting BPF

@mvines mvines requested a review from jackcmay October 19, 2020 21:10
@mvines
Copy link
Copy Markdown
Contributor Author

mvines commented Oct 19, 2020

@jackcmay - care to give this a quick 👀?

Comment thread sdk/src/program_error.rs
#[cfg(feature = "program")]
use crate::info;
#[cfg(not(feature = "program"))]
#[cfg(all(feature = "everything", not(feature = "program")))]
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.

Was this the underlying motivation for this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not directly. When trying to test stuff over in SPL land, the semantics of enabling "program" causing code to be removed was generating confusing errors.

Comment thread sdk/src/pubkey.rs
#[cfg(not(all(feature = "program", target_arch = "bpf")))]
{
let mut hasher = Hasher::default();
let mut hasher = crate::hash::Hasher::default();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Na, my goal here was to remove all those feature-specific use statements at the top of pubkey.rs, to clear the way for easier future refactoring at #12987 and #12989

@mvines mvines merged commit c5e1638 into solana-labs:master Oct 20, 2020
@mvines mvines deleted the everything branch October 20, 2020 00:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants