Announce spec shaking v3 and shake by the recorded version - #2720
Draft
leighmcculloch wants to merge 4 commits into
Draft
Announce spec shaking v3 and shake by the recorded version#2720leighmcculloch wants to merge 4 commits into
leighmcculloch wants to merge 4 commits into
Conversation
3 tasks
This was referenced Sep 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Part of a stack of PRs that must merge in this order.
A first group of PRs deliver const-encoded contract specs, so that contract specs are produced at compile time instead of at proc-macro execution time. This provides the foundation for the capability to construct the specs from information that is not known at proc-macro execution and only known at compile time, like the fully qualified name of a type:
A second group of PRs deliver fully qualified type names in contract specs. Instead of a type having the name
Contextit will have the namesoroban_sdk::auth::Context. Qualified type names make it possible to uniquely identify types in the spec, even when they have the same name. This resolves several problems with contract specs the type identify problem (stellar/rs-soroban-sdk#1570), type aliases limitations (stellar/rs-soroban-sdk#1857 stellar/rs-soroban-sdk#1063), and optimise spec shaking data section size (stellar/rs-soroban-sdk#1978):A third group of PRs use those qualified names to shake specs by reachability, so that the markers a contract carries shrink to the few entries a spec never names:
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_V3to the SDK alongside the existing v2 var, and pick the shaking rules from therssdk_spec_shakingversion 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.