Skip to content

[Bug Fix] Resolve Cargo Workspace Dependency Version Mismatch Across Contracts - #716

Open
abbys-code-hub wants to merge 4 commits into
SoroLabs:mainfrom
abbys-code-hub:feat/version-mismatch
Open

[Bug Fix] Resolve Cargo Workspace Dependency Version Mismatch Across Contracts#716
abbys-code-hub wants to merge 4 commits into
SoroLabs:mainfrom
abbys-code-hub:feat/version-mismatch

Conversation

@abbys-code-hub

Copy link
Copy Markdown

Overview

Fixes workspace compilation failures caused by conflicting soroban-sdk versions across contract crates. All 32+ contract Cargo.toml files now inherit soroban-sdk from the root [workspace.dependencies], guaranteeing a single pinned version (22.0.0) across the entire workspace.

Closes #678

Root Cause

The root Cargo.toml workspace only included 3 contracts (error_codes, math, staking_rewards) explicitly, while the remaining 29+ contracts were standalone crates each pinning their own soroban-sdk version. This caused compilation failures when different contracts in the dependency graph resolved to different SDK versions.

A critical bug was found in contracts/cross_chain_payload/Cargo.toml which had two soroban-sdk entries — one pinned at 20.5.0 and another at 22.0.0 — which would cause an immediate Cargo resolution failure.

Changes

Root Cargo.toml

  • Changed workspace members from a manual list to a glob pattern: "contracts/*" — automatically includes all current and future contract directories
  • Added [workspace.dependencies] section with soroban-sdk = "22.0.0" as the single source of truth

contracts/cross_chain_payload/Cargo.toml

  • Fixed critical bug: Removed duplicate soroban-sdk entries (20.5.0 and 22.0.0) and replaced with { workspace = true, features = ["testutils"] }

All 32 Contract Cargo.toml Files

  • [dependencies]: Changed soroban-sdk = "22.0.0"soroban-sdk.workspace = true
  • [dev-dependencies]: Changed soroban-sdk = { version = "22.0.0", features = ["testutils"] }soroban-sdk = { workspace = true, features = ["testutils"] }

Files Changed

33 files — 65 insertions, 65 deletions

File Change
Cargo.toml Glob workspace members + [workspace.dependencies]
contracts/cross_chain_payload/Cargo.toml Fixed duplicate version bug
contracts/*/Cargo.toml (31 files) soroban-sdkworkspace = true

Design Decisions

  • Glob pattern over explicit list: "contracts/*" ensures new contracts automatically participate in workspace versioning without needing to update the root manifest
  • Features preserved per-crate: Each crate retains control over which soroban-sdk features it needs (e.g., testutils for dev) via { workspace = true, features = [...] }
  • core/ not included: The core crate uses soroban-sdk via a different dependency pattern and is intentionally kept outside the workspace to avoid dependency conflicts with its unique requirements (soroban-env-host, etc.)

Acceptance Criteria

  • All contract crates now inherit soroban-sdk version from root workspace
  • cross_chain_payload duplicate version conflict resolved
  • No hardcoded soroban-sdk versions remain in any contract Cargo.toml
  • Feature forwarding (testutils, etc.) preserved via per-crate feature declarations
  • cargo check and cargo test — CI will validate compilation (cargo not installed in dev environment)

Closes #678

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@abbys-code-hub Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

…encies

- Replace explicit member list with 'contracts/*' glob pattern
- Add [workspace.dependencies] section pinning soroban-sdk = '22.0.0'
- Ensures all current and future contracts inherit a single SDK version
- Had both '20.5.0' and '22.0.0' soroban-sdk entries
- Replaced with workspace = true to inherit from root workspace
…rkspace = true

- Updates 31 contract crates to inherit soroban-sdk version from workspace
- Preserves per-crate feature flags (testutils, etc.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Fix] Resolve Cargo Workspace Dependency Version Mismatch Across Contracts

1 participant