Skip to content

Widen user-defined type name limit - #312

Draft
leighmcculloch wants to merge 2 commits into
mainfrom
widen-udt-name-limit
Draft

Widen user-defined type name limit#312
leighmcculloch wants to merge 2 commits into
mainfrom
widen-udt-name-limit

Conversation

@leighmcculloch

@leighmcculloch leighmcculloch commented Jul 30, 2026

Copy link
Copy Markdown
Member

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:

  1. Add borrowed Ref variants of generated types rs-stellar-xdr#560
  2. Add const XDR serialization on Ref types rs-stellar-xdr#562
  3. Encode contract spec XDR at const evaluation time rs-soroban-sdk#1965

A second group of PRs deliver fully qualified type names in contract specs. Instead of a type having the name Context it will have the name soroban_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), and optimise spec shaking data section size (stellar/rs-soroban-sdk#1978):

  1. Widen user-defined type name limit #312 ← this PR
  2. Regenerate with widened UDT name limit rs-stellar-xdr#566
  3. Qualify user-defined type names rs-soroban-sdk#1970

What

Add SC_SPEC_TYPE_NAME_LIMIT of 256 and use it for the name of SCSpecTypeUDT and of the four user-defined type definition entries, in place of the 60 they had. The limits on names within a type, its fields and its cases, are unchanged.

Why

A user-defined type's name is becoming a qualified name: the module or namespace it is defined in, then its own name. 60 characters does not hold one. Three types in the Rust SDK's own auth module already exceed it, the longest at 61 characters, so the limit binds immediately rather than in some unusual case.

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.

1 participant