Skip to content

Regenerate with ids on contract spec entries - #568

Closed
leighmcculloch wants to merge 4 commits into
const-xdr-serializationfrom
regenerate-with-udt-type-ids
Closed

Regenerate with ids on contract spec entries#568
leighmcculloch wants to merge 4 commits into
const-xdr-serializationfrom
regenerate-with-udt-type-ids

Conversation

@leighmcculloch

@leighmcculloch leighmcculloch commented Aug 10, 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 #560
  2. Add const XDR serialization on View types #562
  3. Encode contract spec XDR at const evaluation time rs-soroban-sdk#1965

A second group of PRs deliver ids on contract spec entries and in spec references. Every entry carries an 8-byte id hashed from the fully qualified name of the item it describes, and a reference to a user-defined type carries the id of the entry it refers to, so references stay unambiguous even when items share a name. This resolves the type identity problem (stellar/rs-soroban-sdk#1570) and type alias limitations (stellar/rs-soroban-sdk#1857):

  1. Add ids to contract spec entries stellar-xdr#313
  2. Regenerate with ids on contract spec entries #568 ← this PR
  3. Add ids to contract spec entries rs-soroban-sdk#1998
  4. Adopt spec entry ids and id-based reference resolution stellar-cli#2677

What

Regenerate the Rust types from stellar/stellar-xdr#313: a new ScSpecEntryV2 struct pairing an 8-byte id with a ScSpecEntryV2Body union that reuses the existing V0 entry bodies, exposed as a new ScSpecEntry::V2 arm; a ScSpecTypeUdtv2 reference carrying the referenced type's name and the id of the entry it refers to; and the SC_SPEC_ID_LEN const. All new types come with the const-writable View counterparts, so the SDK's proc macros can encode them at compile time.

Why

Ids on spec entries identify each entry exactly — the id is the truncated SHA-256 of the fully qualified name of the item the entry describes — so every entry has a unique identifier, and a reference carrying an id refers to one entry precisely, even when entries share a name.

@leighmcculloch leighmcculloch changed the title Regenerate with UDT type ids Regenerate with ids on contract spec entries Aug 10, 2026
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