Skip to content

Shake by the recorded version - #2720

Draft
leighmcculloch wants to merge 68 commits into
patch-xdr-and-spec-cratesfrom
reduce-spec-markers-on-build
Draft

leighmcculloch wants to merge 68 commits into
patch-xdr-and-spec-cratesfrom
reduce-spec-markers-on-build

Conversation

@leighmcculloch

@leighmcculloch leighmcculloch commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

What

Patch in the soroban-sdk change that shakes specs by reachability (stellar/rs-soroban-sdk#2043), announce SOROBAN_SDK_BUILD_SYSTEM_SUPPORTS_SPEC_SHAKING_V3 to the SDK alongside the existing v2 var, and pick the shaking rules from the rssdk_spec_shaking version the built wasm records rather than from a single fixed set of rules.

Why

Each var names a set of shaking rules, and this CLI announces every set it can apply, because the SDK refuses to build a contract whose rules the build system has not claimed. The v3 var is required by that SDK: from that version most types carry no marker, and a build system has to shake them out by following the references to them instead, so one announcing only v2 would shake by markers alone and strip every type. The v2 var stays set because it is still true of this CLI, and a contract built against an older published SDK looks for that var alone and refuses to build without it.

Which rules apply to a given wasm is a property of that contract, not of the CLI — it may have been built long before this version — so the CLI reads the version the contract recorded and passes it to soroban_spec::shaking::filter: version 2 keeps an entry only if it carries a marker, version 3 also follows the references from functions, events, and types, and a wasm recording no version at all is left unshaken.

Known limitations

Contract fixtures built by the tests resolve soroban-sdk from crates.io rather than through the workspace patch, so they cover the version 2 path and the SDK's own end-to-end test contract covers version 3. The [patch.crates-io] git revisions are replaced with published versions once stellar/rs-stellar-xdr#566 and the soroban-sdk stack land and release.

@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Sep 5, 2026
@leighmcculloch leighmcculloch changed the title Announce spec shaking v3 to the SDK Support spec shaking v3 Sep 5, 2026
@leighmcculloch leighmcculloch changed the title Support spec shaking v3 Shake specs by the version the wasm records Sep 5, 2026
@leighmcculloch leighmcculloch changed the title Shake specs by the version the wasm records Shake specs by reachability and markers Sep 5, 2026
@leighmcculloch leighmcculloch changed the title Shake specs by reachability and markers Announce spec shaking v3 and shake by the recorded version Sep 5, 2026
@leighmcculloch leighmcculloch changed the title Announce spec shaking v3 and shake by the recorded version Shake by the recorded version Sep 8, 2026
@leighmcculloch
leighmcculloch added this pull request to stack #2726 September 16, 2026 11:30
@leighmcculloch
leighmcculloch force-pushed the reduce-spec-markers-on-build branch from 33ae6c6 to e9f8699 Compare September 23, 2026 07:01
@leighmcculloch
leighmcculloch removed this pull request from stack #2726 September 23, 2026 08:20
@leighmcculloch
leighmcculloch added this pull request to stack #2750 September 23, 2026 08:21
@leighmcculloch
leighmcculloch force-pushed the reduce-spec-markers-on-build branch 2 times, most recently from 17bb1ec to f1baa27 Compare September 23, 2026 10:16
@leighmcculloch
leighmcculloch force-pushed the reduce-spec-markers-on-build branch from f1baa27 to d97a38d Compare September 23, 2026 10:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

It omits the advertised v3 capability variable and regresses type-name reduction for older shaking models.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Updates Stellar CLI for SDK v30’s reachability-based spec shaking.

Changes:

  • Upgrades workspace, fixtures, and templates to version 30.
  • Selects shaking rules from contract metadata.
  • Updates marker-model tests and dependency pins.
File Description
Cargo.toml Bumps workspace and SDK dependencies.
Cargo.lock Updates locked package versions and revisions.
cmd/​soroban-cli/​src/​commands/​contract/​build.rs Adds model-aware spec filtering and reduction routing.
cmd/​soroban-cli/​src/​utils/​contract-workspace-template/​Cargo.toml.removeextension Uses SDK v30 in generated projects.
cmd/​crates/​soroban-test/​tests/​it/​build.rs Updates spec-shaking assertions.
cmd/​crates/​soroban-test/​tests/​fixtures/​test-wasms/​token/​Cargo.toml Bumps fixture version.
cmd/​crates/​soroban-test/​tests/​fixtures/​test-wasms/​token_renamed/​Cargo.toml Bumps fixture version.
cmd/​crates/​soroban-test/​tests/​fixtures/​test-wasms/​swap/​Cargo.toml Bumps fixture version.
cmd/​crates/​soroban-test/​tests/​fixtures/​test-wasms/​hello_world/​Cargo.toml Bumps fixture version.
cmd/​crates/​soroban-test/​tests/​fixtures/​test-wasms/​empty_constructor/​Cargo.toml Bumps fixture version.
cmd/​crates/​soroban-test/​tests/​fixtures/​test-wasms/​custom_type/​Cargo.toml Bumps fixture version.
cmd/​crates/​soroban-test/​tests/​fixtures/​test-wasms/​custom_account/​Cargo.toml Bumps fixture version.
cmd/​crates/​soroban-test/​tests/​fixtures/​test-wasms/​constructor/​Cargo.toml Bumps fixture version.
cmd/​crates/​soroban-test/​tests/​fixtures/​test-wasms/​auth/​Cargo.toml Bumps fixture version.
cmd/​crates/​soroban-test/​tests/​fixtures/​hello/​Cargo.toml Bumps fixture version.
cmd/​crates/​soroban-test/​tests/​fixtures/​bye/​Cargo.toml Bumps fixture version.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 375 to +378
// Set env var to inform the SDK that this CLI supports spec
// optimization using markers. Current and new SDK versions no
// optimization. The var says only that this CLI shakes; which
// rules it shakes a given contract by comes from the model that
// contract's meta selects. Current and new SDK versions no
Comment on lines +407 to +410
let model = Self::filter_spec(&target_file_path)?;
if model == soroban_spec::shaking::Model::References {
Self::reduce_spec(&print, &p.name, &target_file_path)?;
}
Comment thread Cargo.toml
version = "30.0.0"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "bdb9dad832e66effa900e0a32685c36d332f6a40"
rev = "a7081319bfa59a7da7352510dfa9e05734510be4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

3 participants