-
Notifications
You must be signed in to change notification settings - Fork 85
refactor: libs to nostd #1997
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
refactor: libs to nostd #1997
Changes from 8 commits
2fc4398
71bdc69
95f7906
13801f5
cd07341
f57ee0a
1fed1a9
1e4cd1e
06f00c1
18b5af2
00f3ced
af5e300
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,7 +7,8 @@ license = "Apache-2.0" | |||||||||
| edition = "2021" | ||||||||||
|
|
||||||||||
| [features] | ||||||||||
| default = [] | ||||||||||
| default = ["std"] | ||||||||||
| std = [] | ||||||||||
|
Comment on lines
+10
to
+11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Violates coding guideline: default build should enable none. The coding guideline explicitly states for Apply this diff to align with the guideline: -default = ["std"]
+default = []
std = []Based on coding guidelines. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| solana = [ | ||||||||||
| "solana-program-error", | ||||||||||
| "solana-sysvar", | ||||||||||
|
|
@@ -34,6 +35,7 @@ rand = { workspace = true, optional = true } | |||||||||
| pinocchio = { workspace = true } | ||||||||||
| borsh = { workspace = true } | ||||||||||
| solana-pubkey = { workspace = true, features = ["curve25519", "sha2"] } | ||||||||||
| light-account-checks = { workspace = true, features = ["solana", "pinocchio", "test-only", "std"] } | ||||||||||
|
|
||||||||||
| [lints.rust.unexpected_cfgs] | ||||||||||
| level = "allow" | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Major refactoring: default-features = false for 4 core crates.
Disabling default features for light-hasher, light-sdk-types, light-compressed-account, and light-account-checks is a significant architectural change enabling no_std support. This requires ALL downstream crate dependencies to explicitly enable needed features or risk compilation failure.
Verify that every workspace member depending on these 4 crates has explicit feature enablement where required. The 7 provided files show this pattern, but a comprehensive audit of all workspace members is needed to prevent regressions.
🏁 Script executed:
Length of output: 914
I've identified a critical issue. The script found 5 workspace members that depend on the 4 affected crates using
{ workspace = true }without explicit feature enablement. These will inheritdefault-features = falsefrom the root workspace.Let me verify if the 4 core crates are actually designed to compile with no features enabled:
Now I need to verify if the 4 core crates are designed to compile with no features. Let me check their feature definitions:Let me check the actual Cargo.toml files of the 4 core crates to see their feature definitions:
Length of output: 1493
Now I need to check if the 5 downstream crates can actually compile with the 4 core crates having
default-features = false. Let me inspect whether they have feature gates or conditional code that requires those features:Length of output: 4630
Based on the investigation, I've identified critical compilation issues. The workspace change sets
default-features = falsefor 4 core crates, but those crates still havedefault = ["std"]ordefault = ["alloc"]defined. Additionally, 5 workspace members depend on these crates via{ workspace = true }without explicit feature enablement, meaning they inherit thedefault-features = falsesetting.The critical problems:
program-tests/merkle-tree uses
light_hasherAPIs in main code (lib.rs line 5, indexed.rs line 3) but won't have access to the std feature required to compile those APIs.program-libs/compressible uses
light_account_checksin main code (config.rs line 2) without feature gates—no guarantee it works with no features enabled.sdk-libs/sdk-types imports from
light_compressed_accountin main code with conditionally-gated std/alloc code, but won't have those features enabled.The 4 affected crates (light-hasher, light-account-checks, light-compressed-account, sdk-types) still have
default = ["std"]ordefault = ["alloc"]. Whendefault-features = falseis applied at workspace level, these defaults are ignored entirely. The crates will compile with NO features unless their code is refactored to not require std/alloc internally.Critical fixes required:
default = [...]lines from the 4 core crates' Cargo.toml files (change todefault = []), OR{ workspace = true }to{ workspace = true, features = ["std"] }etc.)The refactoring is incomplete—the PR must ensure all affected crates either compile without defaults or explicitly re-enable needed features.
🤖 Prompt for AI Agents