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 2 commits into
Conversation
Greptile SummaryThis PR is a purely mechanical refactor that migrates inline-pinned
Confidence Score: 5/5Safe to merge — pure version-reference migration with no logic or version changes introduced. Every *.workspace = true reference introduced by this PR resolves against a confirmed entry in the root [workspace.dependencies]. The two newly promoted entries (solana-rent, solana-transaction-error) carry the exact version strings that all consuming crates were already pinning inline, so no dependency version drift occurs. The cross-program-invocation/native sub-workspace crates (hand & lever) that caused resolution failures previously are not touched in this diff — those files retain inline versions. Files Needing Attention: No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
RootCargo["Root Cargo.toml\n[workspace.dependencies]\n+ solana-rent = 4.1.0\n+ solana-transaction-error = 3.2.0"]
RootCargo -->|".workspace = true"| Native["Native programs\naccount-data, checking-accounts,\nclose-account, counter, create-account,\nfavorites, hello-solana, processing-instructions,\nprogram-derived-addresses, realloc,\nrent, repository-layout, transfer-sol"]
RootCargo -->|".workspace = true"| Pinocchio["Pinocchio programs\naccount-data, checking-accounts,\nclose-account, counter, create-account,\nfavorites, processing-instructions,\nprogram-derived-addresses, realloc,\nrent, repository-layout, transfer-sol"]
RootCargo -->|".workspace = true"| ASM["ASM programs\nchecking-accounts/asm\ncreate-account/asm"]
SubWS["Sub-workspace\nbasics/cross-program-invocation/native/\n(hand & lever — NOT in root workspace)"]
SubWS -. "inline versions kept\n(reverted per ae48c71)" .-> SubWS
Reviews (4): 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.
There was a problem hiding this comment.
Reverted in commit ae48c71 — hand and lever are back to inline dep versions (borsh = "1.6.1", solana-program = "4.0") since their isolated sub-workspace at basics/cross-program-invocation/native/Cargo.toml has no [workspace.dependencies] section.
| 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.
There was a problem hiding this comment.
Same as hand — reverted to inline deps in ae48c71.
| 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.
There was a problem hiding this comment.
target here is a regular keypair (not a PDA), so isSigner: true is correct — SystemProgram.createAccount requires the new account to co-sign the transaction. The test already supplies the signature on line 35: tx.add(ix).sign(payer, testAccount).
|
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 |
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! |
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>
ae48c71 to
7b5a98d
Compare
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