Skip to content

build(xdr): regenerate schema from stellar-xdr with CAP-83 and CAP-85 ungated - #1576

Merged
Ryang-21 merged 4 commits into
xdr-json-makefilefrom
xdr-regen-cap83-cap85
Jul 31, 2026
Merged

build(xdr): regenerate schema from stellar-xdr with CAP-83 and CAP-85 ungated#1576
Ryang-21 merged 4 commits into
xdr-json-makefilefrom
xdr-regen-cap83-cap85

Conversation

@Ryang-21

Copy link
Copy Markdown
Contributor

What

Takes a new protocol snapshot by bumping the pinned stellar-xdr commit and regenerating both the schema and the XDR classes from it.

XDR_COMMIT moves from 68fa1ac5 to 9c9c1459 ("Ungate CAP_0083 and CAP_0085_EXECUTABLE_REF ifdefs"), then make xdr regenerates xdr/xdr.json (490 definitions) and src/xdr/generated/ (452 files). No feature flags are needed — the CAPs this picks up are ungated upstream. XDR_FEATURES stays empty, so CAP-84's muxed-contract types, still behind #ifdef CAP_0084_MUXED_CONTRACT, are excluded as before.

The generated surface changes as follows:

  • ContractExecutableType gains CONTRACT_EXECUTABLE_EXTERNAL_REF = 2, ContractExecutable gains the matching arm, and a new ContractExecutableExternalRef struct (executableOwner: ScAddress, tag: SCString) is emitted.
  • ScValType gains SCV_EXECUTABLE_TAG = 22 and ScVal gains the matching SCString arm.
  • StellarValueType gains STELLAR_VALUE_EMPTY_TX_SET = 2, StellarValueExt gains the matching arm, and its anonymous inner struct is emitted as StellarValueProposedValue.
  • Doc-comment-only churn in sc-address.ts, sc-address-type.ts (the gated CAP-84 lines now appear in the quoted .x source) and soroban-transaction-meta-ext-v1.ts (upstream fixed a comment that said rentFeeCharged is part of the non-refundable fee).

The second commit is the smallest change that keeps tsc green against the widened unions, so this PR stands on its own:

  • scValToNative's default branch drops a @ts-expect-error that is no longer triggered now that an unhandled variant exists.
  • Client.from narrows explicitly to the Wasm arm before reading the code hash, since excluding the SAC arm no longer leaves exactly one case.

Actually handling the new variants — decoding scvExecutableTag, reporting external-ref executables usefully, and round-trip test coverage — is a separate follow-up PR stacked on this one.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Regenerates the SDK’s XDR schema and classes with ungated CAP-83 and CAP-85 definitions.

Changes:

  • Pins the newer stellar-xdr snapshot.
  • Adds external executable references, executable tags, and empty transaction-set values.
  • Updates runtime narrowing and generated references.

Reviewed changes

Copilot reviewed 6 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Makefile Updates the pinned XDR commit.
xdr/xdr.json Regenerates the canonical schema.
src/xdr/generated/contract-executable-external-ref.ts Adds the external-reference structure.
src/xdr/generated/contract-executable-type.ts Adds the external-reference enum member.
src/xdr/generated/contract-executable.ts Adds the external-reference union arm.
src/xdr/generated/index.ts Exports new generated types.
src/xdr/generated/sc-address-type.ts Refreshes gated CAP-84 source documentation.
src/xdr/generated/sc-address.ts Refreshes gated CAP-84 source documentation.
src/xdr/generated/sc-val-type.ts Adds the executable-tag enum member.
src/xdr/generated/sc-val.ts Adds the executable-tag union arm.
src/xdr/generated/soroban-transaction-meta-ext-v1.ts Corrects generated fee documentation.
src/xdr/generated/stellar-value-ext.ts Adds the empty-transaction-set union arm.
src/xdr/generated/stellar-value-proposed-value.ts Adds the proposed-value structure.
src/xdr/generated/stellar-value-type.ts Adds the empty-transaction-set enum member.
src/xdr/generated/stellar-value.ts Refreshes the ungated XDR documentation.
src/contract/client.ts Explicitly narrows executable handling to Wasm.
src/base/scval.ts Allows newly generated variants through the fallback conversion.
docs/reference/core-soroban-primitives.md Refreshes generated source links.
docs/reference/contracts-client.md Refreshes generated source links.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 22 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

.github/workflows/tests.yml:54

  • This browser-test job split (together with the package script and Vite cache changes) is unrelated to the XDR snapshot and is absent from the PR description, which says the second commit only contains the minimal widened-union fixes. It materially changes CI cost and execution topology, so please move these changes to a dedicated PR rather than coupling them to the protocol update.
  # Browser tests get their own job per transport rather than two steps in
  # `build_and_test`. Each pass loads the SDK source graph — ~470 unbundled
  # `src/xdr` modules — once per test file, across 220 files and two browsers.
  # Run back to back on one runner, the second pass reliably lost its browser
  # page mid-run ("Browser connection was closed while running tests"), always
  # after ~65 files with every test that ran passing. A fresh runner per
  # transport keeps each pass within the runner's memory budget.
  browser_test:

src/contract/client.ts:267

  • This new third-executable branch is not covered by client_from.test.ts, which currently exercises only Wasm and SAC instances. Add an external-reference instance case that asserts this error and verifies no Wasm lookup occurs; otherwise a regression could pass an external ref into the hash path unnoticed.
    if (executable.type !== "contractExecutableWasm") {
      throw new TypeError(
        `unsupported contract executable type: ${executable.type}`,
      );

src/base/scval.ts:467

  • The catch-all removes compile-time exhaustiveness for all future ScVal additions and currently decodes this SCString through the lenient .value getter, unlike the explicit string branches above that preserve invalid wire bytes. Handle scvExecutableTag explicitly with scv.executableTag.asStringOrBytes(), then restore a never assertion in default so later schema bumps cannot silently acquire incorrect conversion behavior.
    default:
      // Variants without an explicit case above (currently the newly
      // generated `scvExecutableTag`) fall through to their underlying value.
      return scv.value;

@Ryang-21 Ryang-21 linked an issue Jul 30, 2026 that may be closed by this pull request
@Ryang-21
Ryang-21 requested a review from quietbits July 30, 2026 21:45
@Ryang-21
Ryang-21 merged commit 49a8cf0 into v17-feature-branch Jul 31, 2026
13 checks passed
@Ryang-21
Ryang-21 deleted the xdr-regen-cap83-cap85 branch July 31, 2026 18:01
@github-project-automation github-project-automation Bot moved this from Backlog (Not Ready) to Done in DevX Jul 31, 2026
Ryang-21 added a commit that referenced this pull request Aug 10, 2026
* Class XDR Implementation (#1422)

* feat(xdr): codegen tool + schema source

* feat(xdr): add class-based XDR runtime and sep51 JSON walker

* refactor(numbers): drop LargeInt classes, delegate to new XDR layer

* refactor(base): migrate src/base to new XDR layer; drop legacy xdr.ts + generated

* refactor: migrate downstream consumers (bindings/contract/horizon/rpc/webauth)

* feat(base/scval): add bool to ScValType

* allow opaque xdr types to be initalized via string

* refactor xdr strings to be represented soley via bytes with a dx friendly XdrString wrapper class

* generate a value getter function for void union cases

* add a is() function to the generated XDR union classes for instanceOf checks

* feat(xdr): regenerate schemas against @stellar/js-xdr and add CAP-71 credentials

* feat(xdr): wire the toJSON hook so JSON.stringify emits SEP-0051

* fix(bindings): emit Uint8Array for bytes/bytesN to match scValToNative

* refactor(contract): rename fromJSON to fromJson with deprecated aliases

* feat(xdr): accept ASCII asset codes with zero padding in constructors

* Migrate public API from Buffer to Uint8Array (#1564)

* feat(base): migrate crypto and strkey APIs to Uint8Array

* feat(base)!: migrate value types to Uint8Array

* feat(base)!: migrate transactions, operations, and auth to Uint8Array

* feat!: migrate contract, rpc, and webauth layers to Uint8Array

* build!: drop buffer polyfill and dependency

* fix(horizon): type manage_data value as string to match runtime API

* fix(xdr): emit SEP-51 key `type` instead of Rust-escaped `type_` (#1571)

* build(xdr): regenerate xdr.json via docker from pinned stellar-xdr commit (#1575)

* build(xdr): regenerate schema from stellar-xdr with CAP-83 and CAP-85 ungated (#1576)

* build(xdr): regenerate schema from stellar-xdr with CAP-83 and CAP-85 ungated

* fix(xdr): keep consumers compiling against the regenerated union arms

* fix(vitest): isolate browser dep cache per transport

* feat(xdr): support CAP-83 empty tx set values and CAP-85 external executables (#1577)

* build(xdr): fail the schema download instead of masking it in a pipe

* feat(xdr): support CAP-83 and CAP-85 protocol values

* fix(xdr): bound decimal string length before BigInt parse in JSON decode (#1581)

* fix(xdr): bound decimal string length before BigInt parse in json decode

* refactor(xdr): name the digit-budget constants in bigint-parts

* fix(xdr): restrict fromJson to SEP-0051 keys and reject unknown fields (#1582)

* fix(xdr): restrict fromJson to SEP-51 keys and reject unknown fields

* fix(test): correct horizon corpus fixture path so corpus tests run

* fix(strkey): bound decodeCheck input length before base32 decode (#1583)

* fix(xdr): reject AssetCode12 JSON codes shorter than 5 bytes (#1585)

* fix(horizon)!: make TransactionFailedExtras result_codes.operations optional (#1586)

* Fix: signed payload strkey framing (#1588)

* fix(strkey): validate signed payload framing in decodeCheck

* Fix: xdr json decode validation (#1592)

* fix(xdr): throw on unknown union discriminant in fromXdrObject

* fix(strkey): validate the claimable balance discriminant byte

* fix(xdr): reject non-decimal integer strings in JSON decoding

* V17.0.0 rc.1 (#1593)

* chore(release): cut v17.0.0-rc.1

* fix(spec): restore instanceof Map check lost in the v17 merge

* feat(xdr): add validateXdr static to every generated type (#1597)

* feat(xdr): add validateXdr static to every generated type

* fix(contract): declare error classes, make types self-contained (#1627)

* perf(strkey): reject by length and prefix before decodeCheck throws (#1629)

* fix: restore wide-int bounds statics, document Memo.text break (#1628)

* fix(xdr): restore wide-int MIN_VALUE/MAX_VALUE statics

---------

Co-authored-by: Iveta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Support externally managed contract executables (CAP-85)

3 participants