Skip to content

Passthrough --locked on contract build#2383

Merged
leighmcculloch merged 4 commits into
stellar:mainfrom
theahaco:fix/build_locked
Mar 3, 2026
Merged

Passthrough --locked on contract build#2383
leighmcculloch merged 4 commits into
stellar:mainfrom
theahaco:fix/build_locked

Conversation

@willemneal
Copy link
Copy Markdown
Contributor

@willemneal willemneal commented Feb 11, 2026

What

Add the option to pass "--locked" to cargo rustc. This ensures that the deps found in the lockfile won't be updated.

Why

Compiling contracts should be as deterministic as possible. While this won't ensure that the final wasm binary is the same it will ensure that the deps used remain the same.

Known limitations

[TODO or N/A]

@willemneal willemneal requested a review from a team as a code owner February 11, 2026 18:12
Copilot AI review requested due to automatic review settings February 11, 2026 18:12
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Feb 11, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Ensures contract compilation uses dependency resolution strictly from Cargo.lock by adding Cargo’s --frozen flag to the cargo rustc invocation.

Changes:

  • Add --frozen to cargo rustc for deterministic dependency usage during contract builds.

Comment thread cmd/soroban-cli/src/commands/contract/build.rs Outdated
@willemneal willemneal changed the title fix(contract build): Add --frozen to ensure deterministic builds fix(contract build): Add --locked to ensure deterministic builds Feb 11, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@willemneal
Copy link
Copy Markdown
Contributor Author

Hmm I didn't know that --locked prevented the creation of a Cargo.lock. I will change it so that it is an option.

@willemneal willemneal changed the title fix(contract build): Add --locked to ensure deterministic builds fix(contract build): Add --locked argument to ensure deterministic builds Feb 11, 2026
@leighmcculloch
Copy link
Copy Markdown
Member

@willemneal Could you open an issue with the problem you're experiencing, with an example? It sounds like there's a problem you're coming up against that isn't clearly captured here, and this may be one solution to it.

@leighmcculloch
Copy link
Copy Markdown
Member

Generally this seems like it would discourage use of stellar contract build during development, which is a problem because stellar contract build is intended as a drop in for cargo build, and so their behaviours are intended to be as similar as possible. Look forward to seeing the issue and hearing more about the problem so we can hopefully find more solutions.

graydon
graydon previously approved these changes Mar 3, 2026
@graydon graydon self-requested a review March 3, 2026 02:20
@graydon graydon dismissed their stale review March 3, 2026 02:20

Sorry, just reviewed casually but it looks like Leigh has concerns.

@leighmcculloch leighmcculloch changed the title fix(contract build): Add --locked argument to ensure deterministic builds Passthrough --locked on contract build Mar 3, 2026
Copy link
Copy Markdown
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

Looks good to me. I think when I last left comments there was a race condition from when I started looking at the PR to submitting my comment, and the changes, because originally this PR I thought made all builds locked.

It looks like the PR exposes and passes through the --locked option, which is standard on cargo build and so good to surface here 👍🏻.

Thanks!

Tip: Opening issues first helps everyone better understand the problem being solved.

@leighmcculloch leighmcculloch enabled auto-merge (squash) March 3, 2026 03:27
@leighmcculloch leighmcculloch merged commit 6115b81 into stellar:main Mar 3, 2026
32 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants