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
Greptile SummaryThis PR migrates inline-pinned
Confidence Score: 4/5Safe to merge for all root-workspace members; the CPI sub-workspace programs need the solana-program 4.0 upgrade verified before merging. The hand and lever programs in the CPI sub-workspace received an unannounced solana-program 3.0 to 4.0 major-version bump. Because that sub-workspace has no [workspace.dependencies], the crates compile independently, and a breaking API change in 4.0 would silently fail at SBF build time or produce incorrect on-chain behaviour. All other changes (28 root-workspace Cargo.toml migrations, realloc TS rewrite, favorites test fix) appear correct and low-risk. basics/cross-program-invocation/native/programs/hand/Cargo.toml and basics/cross-program-invocation/native/programs/lever/Cargo.toml — the solana-program major version bump warrants explicit confirmation that the program source is compatible with 4.0. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
RootWS["Root Cargo.toml\n[workspace.dependencies]\n+ solana-rent 4.1.0\n+ solana-transaction-error 3.2.0"]
subgraph basics["basics/ member crates (root workspace)"]
Native["native/program Cargo.toml\n*.workspace = true"]
Pinocchio["pinocchio/program Cargo.toml\n*.workspace = true"]
ASM["asm/Cargo.toml\n*.workspace = true"]
end
subgraph cpi["CPI sub-workspace (isolated)"]
SubWS["basics/cross-program-invocation/native/Cargo.toml\n(no workspace.dependencies)"]
Hand["hand/Cargo.toml\nborsh 1.6.1 inline\nsolana-program 4.0"]
Lever["lever/Cargo.toml\nborsh 1.6.1 inline\nsolana-program 4.0"]
SubWS --> Hand
SubWS --> Lever
end
RootWS --> Native
RootWS --> Pinocchio
RootWS --> ASM
RootWS -. "NOT linked\n(isolated sub-workspace)" .-> cpi
%%{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
RootWS["Root Cargo.toml\n[workspace.dependencies]\n+ solana-rent 4.1.0\n+ solana-transaction-error 3.2.0"]
subgraph basics["basics/ member crates (root workspace)"]
Native["native/program Cargo.toml\n*.workspace = true"]
Pinocchio["pinocchio/program Cargo.toml\n*.workspace = true"]
ASM["asm/Cargo.toml\n*.workspace = true"]
end
subgraph cpi["CPI sub-workspace (isolated)"]
SubWS["basics/cross-program-invocation/native/Cargo.toml\n(no workspace.dependencies)"]
Hand["hand/Cargo.toml\nborsh 1.6.1 inline\nsolana-program 4.0"]
Lever["lever/Cargo.toml\nborsh 1.6.1 inline\nsolana-program 4.0"]
SubWS --> Hand
SubWS --> Lever
end
RootWS --> Native
RootWS --> Pinocchio
RootWS --> ASM
RootWS -. "NOT linked\n(isolated sub-workspace)" .-> cpi
Reviews (3): 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.
|
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 |
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>
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>
d801098 to
ae48c71
Compare
|
@dev-jodee All commits have been re-signed with an SSH signing key and now show as Verified on GitHub. Thanks for the heads up! |
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