Reduce qualified type and event names - #2674
Draft
leighmcculloch wants to merge 7 commits into
Draft
Conversation
This was referenced Aug 7, 2026
leighmcculloch
force-pushed
the
patch-xdr-and-spec-crates
branch
from
September 3, 2026 15:19
65c31be to
69c41b9
Compare
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 change contract specs so that they are produced at compile time instead of at proc-macro execution time. This provides the foundation to construct the specs from information that is only known at compile time, like the fully qualified name of a type:
A second group of PRs changes the type names that the sdk stores in specs are fully qualified type names, and then the cli reduces them down to unique simple identifiers. During the contract build the types are given names like
::mycrate::mymod::MyTypeinstead ofMyType. Then the cli reduces them back down to simple names after spec shaking. 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):Note that downstream clients and SDKs should see no, or little, change because the cli will during the build process reduce the fully qualified names back to simple unique names. Contracts that had colliding type names, which meant they could not be used with clients, will now work.
A third group of PRs are an optimisation to spec shaking v2, and will use the new unique type names to shake type specs by reachability, producing a dependency graph (thanks @mootz12), so that only spec entries that can't be reached from fns, like errors and events, get spec markers from dead-code-elimination:
What
Patch
stellar-xdrto stellar/rs-stellar-xdr#566 so the CLI can read the widened user-defined type name limit (exposed asSC_SPEC_TYPE_NAME_LIMIT, which the hardcodedStringM<60>sizes now reference), and reduce the fully qualified UDT type names that stellar/rs-soroban-sdk#1970 emits (e.g.my_contract::inner::State) down to short names incontract info interfaceoutput, disambiguating name collisions with numeric suffixes and reporting every rename and collision.Why
Contract specs are moving to fully qualified user-defined type names, whose
::separators are not valid identifiers, so the Rust and JSON renderers cannot use them verbatim; the CLI has to shorten them for display and code generation, and warn when distinct qualified types reduce to the same short name.Known limitations
Depends on stellar/rs-stellar-xdr#566 landing and releasing, after which the
[patch.crates-io]git revision is replaced with a published version. The soroban-sdk qualified-name change (stellar/rs-soroban-sdk#1970) is not patched into the workspace: it is still on the 27.0.5 line and lacks the protocol-28 SDK APIs the repo's test contracts now use, and the CLI only needs xdr #566 to read the widened names, so the reduction runs CLI-side on any spec.