refactor: migrate inline dev-deps to workspace references in basics/#632
refactor: migrate inline dev-deps to workspace references in basics/#632NikkiAung wants to merge 4 commits into
Conversation
Replace inline-pinned `[dev-dependencies]` versions with `.workspace = true` across all 28 native, pinocchio, and asm Cargo.toml files under `basics/`. Also adds `solana-rent` and `solana-transaction-error` to the root `[workspace.dependencies]`, and migrates the CPI hand/lever programs' inline `[dependencies]` (borsh, solana-program) to workspace references. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR migrates inline-pinned
Confidence Score: 5/5Safe to merge; the workspace migration is mechanically correct and all migrated crates are defined in the root manifest. Every basics/realloc/native/pnpm-lock.yaml — the incidental removal of Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Root["Root Cargo.toml\n[workspace.dependencies]\nlitesvm, solana-keypair,\nsolana-pubkey, solana-transaction,\nsolana-native-token, solana-instruction,\nsolana-rent, solana-transaction-error\n+ borsh, solana-program …"]
Root -->|".workspace = true"| A["basics/*/native/program/Cargo.toml\n(~14 crates)"]
Root -->|".workspace = true"| B["basics/*/pinocchio/program/Cargo.toml\n(~12 crates)"]
Root -->|".workspace = true"| C["basics/*/asm/Cargo.toml\n(2 crates)"]
SubWS["basics/cross-program-invocation/native/Cargo.toml\n(sub-workspace, no [workspace.dependencies])"]
SubWS -->|"inline versions kept\nborsh=1.6.1, solana-program=4.0"| D["hand/Cargo.toml"]
SubWS -->|"inline versions kept\nborsh=1.6.1, solana-program=4.0"| E["lever/Cargo.toml"]
style Root fill:#d4edda,stroke:#28a745
style SubWS fill:#fff3cd,stroke:#ffc107
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
Root["Root Cargo.toml\n[workspace.dependencies]\nlitesvm, solana-keypair,\nsolana-pubkey, solana-transaction,\nsolana-native-token, solana-instruction,\nsolana-rent, solana-transaction-error\n+ borsh, solana-program …"]
Root -->|".workspace = true"| A["basics/*/native/program/Cargo.toml\n(~14 crates)"]
Root -->|".workspace = true"| B["basics/*/pinocchio/program/Cargo.toml\n(~12 crates)"]
Root -->|".workspace = true"| C["basics/*/asm/Cargo.toml\n(2 crates)"]
SubWS["basics/cross-program-invocation/native/Cargo.toml\n(sub-workspace, no [workspace.dependencies])"]
SubWS -->|"inline versions kept\nborsh=1.6.1, solana-program=4.0"| D["hand/Cargo.toml"]
SubWS -->|"inline versions kept\nborsh=1.6.1, solana-program=4.0"| E["lever/Cargo.toml"]
style Root fill:#d4edda,stroke:#28a745
style SubWS fill:#fff3cd,stroke:#ffc107
Reviews (2): Last reviewed commit: "fix: revert CPI hand/lever to inline dep..." | Re-trigger Greptile |
| [dependencies] | ||
| borsh = "1.5.7" | ||
| borsh-derive = "1.5.7" | ||
| solana-program = "3.0" | ||
| borsh.workspace = true | ||
| borsh-derive.workspace = true | ||
| solana-program.workspace = true | ||
| cross-program-invocatio-native-lever = { path = "../lever", features = ["cpi"] } | ||
|
|
||
| [lib] | ||
| crate-type = ["cdylib", "lib"] | ||
|
|
There was a problem hiding this comment.
Workspace references in a non-root workspace member
The hand and lever programs live inside their own isolated sub-workspace declared at basics/cross-program-invocation/native/Cargo.toml, which has no [workspace.dependencies] section. Every borsh.workspace = true, borsh-derive.workspace = true, solana-program.workspace = true, litesvm.workspace = true, etc. added here will resolve against that local workspace, not the root workspace. Because the local workspace defines no [workspace.dependencies], Cargo will error: `workspace.borsh` was not found in the root manifest's `workspace.dependencies`. Building the CPI native example directly (or any CI job that targets it) will fail. Either add the needed entries to basics/cross-program-invocation/native/Cargo.toml's [workspace.dependencies], or keep the versions inline for these two crates.
| borsh.workspace = true | ||
| borsh-derive.workspace = true | ||
| solana-program.workspace = true | ||
| solana-system-interface.workspace = true |
There was a problem hiding this comment.
Same sub-workspace issue as
hand
lever is also a member of basics/cross-program-invocation/native/Cargo.toml (not the root workspace). All four *.workspace = true references here (borsh, borsh-derive, solana-program, solana-system-interface) will fail to resolve for the same reason described on hand/Cargo.toml.
| street, | ||
| city, | ||
| }), |
There was a problem hiding this comment.
isSigner flipped for target account
The target account changed from isSigner: false to isSigner: true. If target is a program-derived address, the runtime will reject the transaction because PDAs cannot provide a traditional signature. If target is a regular keypair, the transaction must include that keypair as a signer — but this change is unrelated to the stated scope of this PR (workspace dep migration), and the realloc test files were not updated to supply the extra signature. Please confirm the intended semantics and update the test accordingly.
basics/cross-program-invocation/native/ is its own sub-workspace with no [workspace.dependencies], so .workspace = true fails to resolve for hand and lever. Keep their deps inline. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for the review @greptile-apps! CPI hand/lever — fixed in the latest push (commit d801098). Those programs live in
|
|
Thanks for the clarification on both points! CPI hand/lever — confirmed, the revert in d801098 looks correct.
The PR looks good from a correctness standpoint. Once CI confirms Tip: You can customize Greptile's behavior for this repo with |
Summary
[dev-dependencies]versions with.workspace = trueacross 28 native, pinocchio, and asmCargo.tomlfiles underbasics/[workspace.dependencies]:solana-rent = "4.1.0"andsolana-transaction-error = "3.2.0"cross-program-invocationhand/lever programs' inline[dependencies](borsh, borsh-derive, solana-program, solana-system-interface) to workspace referencesThis removes the version duplication that makes future upgrades error-prone — when a crate version bumps in root
Cargo.toml, it now propagates automatically to all member crates.Test plan
cargo metadata --no-depsresolves cleanly with no errors