Skip to content

fix: Add edition and rust-version to workspace.package template#4048

Open
AvhiMaz wants to merge 3 commits intosolana-foundation:masterfrom
AvhiMaz:fix/workspace-package-edition-rust-version
Open

fix: Add edition and rust-version to workspace.package template#4048
AvhiMaz wants to merge 3 commits intosolana-foundation:masterfrom
AvhiMaz:fix/workspace-package-edition-rust-version

Conversation

@AvhiMaz
Copy link
Copy Markdown

@AvhiMaz AvhiMaz commented Nov 8, 2025

Summary

Ensures proper dependency resolution by specifying edition and rust-version
in [workspace.package] instead of at program level, allowing dependency
resolution to respect these constraints and prevent incompatible crate
versions from being selected.

Changes

File: cli/src/rust_template.rs

Fixes #4047

@vercel
Copy link
Copy Markdown

vercel bot commented Nov 8, 2025

@AvhiMaz is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@AvhiMaz
Copy link
Copy Markdown
Author

AvhiMaz commented Nov 8, 2025

hi @jamie-osec can you please review this? thank you

Copy link
Copy Markdown
Collaborator

@swaroop-osec swaroop-osec left a comment

Choose a reason for hiding this comment

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

lgtm

@jamie-osec
Copy link
Copy Markdown
Collaborator

LGTM, though we'll need to ensure users have an up-to-date platform-tools somehow

@AvhiMaz
Copy link
Copy Markdown
Author

AvhiMaz commented Nov 10, 2025

LGTM, though we'll need to ensure users have an up-to-date platform-tools somehow

pub fn get_solana_version() -> Option<String> {
    let output = std::process::Command::new("solana")
        .arg("--version")
        .output()
        .ok()?;

    if output.status.success() {
        let version_str = String::from_utf8(output.stdout).ok()?;
        version_str
            .split_whitespace()
            .last()
            .map(|v| v.trim().to_string())
    } else {
        None
    }
}

can we create a func like this and call it which automatically injects the detected version into Anchor.toml?

@jamie-osec
Copy link
Copy Markdown
Collaborator

We can evaluate this in another PR, this change LGTM for now 🙂

@AvhiMaz
Copy link
Copy Markdown
Author

AvhiMaz commented Nov 10, 2025

We can evaluate this in another PR, this change LGTM for now 🙂

got it ser, If you create this issue, please assign it to me, I’d like to work on it.

Copy link
Copy Markdown
Collaborator

@0x4ka5h 0x4ka5h left a comment

Choose a reason for hiding this comment

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

lgtm

@jamie-osec
Copy link
Copy Markdown
Collaborator

Needs #4098

@jamie-osec
Copy link
Copy Markdown
Collaborator

@AvhiMaz Please git rebase master now that #4098 is merged and CI should pass

  Ensures proper dependency resolution by specifying edition and rust-version
  in [workspace.package] instead of at program level, allowing dependency
  resolution to respect these constraints and prevent incompatible crate
  versions from being selected.

  Fixes solana-foundation#4047

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@AvhiMaz AvhiMaz force-pushed the fix/workspace-package-edition-rust-version branch from 39f28c1 to 2b438fa Compare November 28, 2025 11:29
@AvhiMaz
Copy link
Copy Markdown
Author

AvhiMaz commented Nov 28, 2025

@AvhiMaz Please git rebase master now that #4098 is merged and CI should pass

done!

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
@AvhiMaz
Copy link
Copy Markdown
Author

AvhiMaz commented Nov 29, 2025

@jamie-osec a test was failing. fixed it, lmk what you think about the fix made

Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add edition/rust-version to Rust template workspace root

5 participants