Skip to content

Correct Soroban transaction resource, TTL, and SAC XDR references - #2655

Merged
ElliotFriend merged 8 commits into
mainfrom
raven/soroban-tx-xdr-reference
Jul 30, 2026
Merged

Correct Soroban transaction resource, TTL, and SAC XDR references#2655
ElliotFriend merged 8 commits into
mainfrom
raven/soroban-tx-xdr-reference

Conversation

@ElliotFriend

Copy link
Copy Markdown
Contributor

Batch fix for three Raven-reported drifts in the Soroban transaction/XDR reference docs. All claims verified against current stellar-xdr (curr) and stellar-core behavior before editing.

Changes

Transaction resource field names (#2596)

Protocol 23+ renamed the resource fields, but the reference docs still used the old names — and one example was runtime-broken as a result.

  • stellar-transaction.mdxSorobanResources now uses diskReadBytes (was readBytes); SorobanTransactionData now shows the current layout: the ext union first, then resources, then resourceFee (was refundableFee + a trailing ExtensionPoint). Added the referenced SorobanResourcesExtV0 so the block is self-contained. Prose updated to match.
  • create-restoration-footprint-js.mdx — the JS example constructed xdr.SorobanResources({... readBytes ...}) and ext: new xdr.ExtensionPoint(0), which throws at serialization against current js-stellar-base. Now uses diskReadBytes and xdr.SorobanTransactionDataExt(0). Walkthrough bullet updated.
  • state-archival.mdx, fees-resource-limits-metering.mdx — swept the same stale readBytes / refundableFee prose references.

(The issue's "enforcement phases" half cites no concrete wrong sentence, so that speculative rewrite is intentionally out of scope.)

Multi-entry ExtendFootprintTTLOp guidance (#2597)

extend-persistent-entry-js.mdx claimed you "cannot combine extensions for different ledger entries in a single transaction." Current ExtendFootprintTTLOpFrame iterates every entry in the read-only footprint. The real constraint is the single shared extendTo offset — entries needing different targets are what require separate operations/transactions. Reworded to match; the existing two-transaction example is now framed as the different-target case.

SAC executable identity XDR terminology (#2613)

Design-era XDR names in stellar-transaction.mdx and stellar-asset-contract.mdx no longer match stellar-xdr:

  • CONTRACT_EXECUTABLE_TOKENCONTRACT_EXECUTABLE_STELLAR_ASSET
  • CONTRACT_ID_FROM_ASSETCONTRACT_ID_PREIMAGE_FROM_ASSET
  • HashIDPreimage::ENVELOPE_TYPE_CONTRACT_ID_FROM_ASSETHashIDPreimage::ENVELOPE_TYPE_CONTRACT_ID (the FROM_ASSET preimage now nests under it)

Also qualified the issuer/admin relationship: the asset issuer is only the initial administrator, and authority is mutable via set_admin.

Closes #2596
Closes #2597
Closes #2613

🤖 Generated with Claude Code

Fixes three Raven-reported drifts in Soroban transaction/XDR reference docs,
verified against current stellar-xdr (curr) and stellar-core behavior.

#2596 — transaction resource field names:
- SorobanResources uses diskReadBytes (not readBytes); SorobanTransactionData
  uses resourceFee with the ext union first (not refundableFee + ExtensionPoint)
- fixes the runtime-broken JS restoration example (readBytes / ExtensionPoint)
- sweeps prose in state-archival and fees-resource-limits-metering

#2597 — ExtendFootprintTTLOp extends every read-only footprint entry; the real
constraint is one shared extendTo, not one key per transaction.

#2613 — current XDR enums: CONTRACT_EXECUTABLE_STELLAR_ASSET,
CONTRACT_ID_PREIMAGE_FROM_ASSET, ENVELOPE_TYPE_CONTRACT_ID; issuer is only the
initial (mutable) SAC administrator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 21, 2026 15:00
@ElliotFriend ElliotFriend added the raven issues discovered by Stellar Raven QA passes label Jul 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates Soroban resource, TTL, and SAC documentation to current XDR terminology and behavior.

Changes:

  • Renames obsolete resource and SAC XDR fields.
  • Corrects multi-entry TTL-extension guidance.
  • Clarifies mutable SAC administration.

Blocking findings include a still-unusable restoration example, contradictory TTL example, stale XDR link, and incomplete resolution of issues #2596 and #2613.

Recommendation: NEEDS-CHANGES — Address the stored review comments.

Reviewed changes

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

Show a summary per file
File Description
docs/tokens/stellar-asset-contract.mdx Updates SAC XDR and administrator terminology.
docs/learn/fundamentals/fees-resource-limits-metering.mdx Renames the declared resource-fee field.
docs/learn/fundamentals/contract-development/storage/state-archival.mdx Renames the disk-read resource field.
docs/learn/fundamentals/contract-development/contract-interactions/stellar-transaction.mdx Updates current transaction and SAC XDR layouts.
docs/build/guides/archival/extend-persistent-entry-js.mdx Revises multi-entry TTL guidance.
docs/build/guides/archival/create-restoration-footprint-js.mdx Updates JavaScript XDR construction.

Comment thread docs/tokens/stellar-asset-contract.mdx Outdated
Comment thread docs/learn/fundamentals/fees-resource-limits-metering.mdx Outdated
Comment thread docs/learn/fundamentals/contract-development/storage/state-archival.mdx Outdated
Comment thread docs/build/guides/archival/extend-persistent-entry-js.mdx Outdated
Comment thread docs/build/guides/archival/create-restoration-footprint-js.mdx
Comment thread docs/tokens/stellar-asset-contract.mdx
@stellar-jenkins-ci

Copy link
Copy Markdown

- extend-persistent-entry: replace the two-transaction split with a real
  single-operation combined-footprint example (setReadOnly([entry, footprint]))
  so it matches the corrected multi-key/same-target guidance (#2597)
- create-restoration-footprint: add a caution that the zeroed diskReadBytes/
  writeBytes/resourceFee are placeholders and a real restore must populate them
  via simulation or it fails with RESTORE_FOOTPRINT_RESOURCE_LIMIT_EXCEEDED
- stellar-asset-contract: repoint the stale pinned [contract_id] link to the
  current XDR (curr); add SAC on-chain identification guidance
  (SCContractInstance.executable == CONTRACT_EXECUTABLE_STELLAR_ASSET,
  name()/symbol() after verification, provenance limits)
- fees-resource-limits-metering: distinguish the pre-apply declared-resourceFee
  check from apply-time refundable metering
- state-archival: soften diskReadBytes wording to "serialized size"

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stellar-jenkins-ci

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 6 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (5)

docs/build/guides/archival/extend-persistent-entry-js.mdx:159

  • The suggested different-target example cannot be followed: both helpers above hard-code extendTo: 100_000 and neither accepts an extendTo argument. Readers cannot call them “with different extendTo values” without first changing their signatures, so either parameterize the helpers or state that requirement here.
If the entries instead need _different_ target TTLs, extend each in its own transaction — for example by calling the single-entry `extendPersistentEntryTTL` and `extendContractCodeTTL` helpers above with different `extendTo` values.

docs/build/guides/archival/extend-persistent-entry-js.mdx:129

  • LedgerKey.contractData expects an xdr.LedgerKeyContractData value, not a plain object. The SDK’s own Contract.getFootprint() constructs this arm with new xdr.LedgerKeyContractData(...); as written, serialization/preparation of this new example will fail when the union tries to encode the object. Wrap these fields in the generated struct constructor.
  const persistentEntry = new StellarSdk.xdr.LedgerKey.contractData({
    contract: StellarSdk.Address.fromString(contractId).toScAddress(),
    key: StellarSdk.xdr.ScVal.scvSymbol(storageKey),
    durability: StellarSdk.xdr.ContractDataDurability.persistent(),
  });

docs/learn/fundamentals/contract-development/contract-interactions/stellar-transaction.mdx:615

  • The updated Protocol 23+ structure is still sourced by the [extension] link above, but that pinned c2e702c snapshot defines the old readBytes/refundableFee layout this PR is correcting. Repoint that reference to the current XDR (preferably a current pinned commit), otherwise readers following the citation see a structure that directly contradicts this block.
    // The maximum number of bytes this transaction can read from disk backed entries
    uint32 diskReadBytes;
    // The maximum number of bytes this transaction can write to ledger
    uint32 writeBytes;
};

docs/learn/fundamentals/contract-development/contract-interactions/stellar-transaction.mdx:640

  • This description now omits the ext field immediately shown above. In the current layout it is no longer just an empty extension point: version 1 carries SorobanResourcesExtV0.archivedSorobanEntries, which controls automatic restoration metadata. Include that third component so the prose matches the updated XDR.
This data comprises the Soroban `resources` and the `resourceFee`. The `resourceFee` is the portion of the transaction fee allocated to Soroban resource fees. It has a non-refundable part (fees for instructions, ledger I/O, and transaction size) and a refundable part that is charged based on actual consumption of refundable resources: the contract events emitted by the transaction, the return value of the host function invocation, and the [ledger space rent](../storage/state-archival.mdx).

docs/build/guides/archival/create-restoration-footprint-js.mdx:75

  • The walkthrough still describes this as an “extension point for future use,” but SorobanTransactionDataExt already has a live version-1 arm containing SorobanResourcesExtV0.archivedSorobanEntries for automatic restoration. Setting version 0 is valid for this manual restore, but the explanation should say that rather than claiming the extension is unused.
      ext: new xdr.SorobanTransactionDataExt(0),

@kaankacar
kaankacar self-requested a review July 30, 2026 15:52

@kaankacar kaankacar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One question on the new multi-key example: when I tried running it against @stellar/stellar-sdk 16.2.0 (current latest), transaction.setSorobanData(...) threw a TypeError for me, since the built Transaction doesn't seem to have that method (it looks like it lives on TransactionBuilder instead). Same with new xdr.LedgerKey.contractData({...}) taking a plain object, it fails at serialization unless wrapped in new xdr.LedgerKeyContractData({...}).

Am I holding it wrong, or would this trip up someone copy-pasting the example? I notice the page's existing helpers use the same patterns, so maybe it predates this PR and is better handled as a follow-up.

Otherwise LGTM, happy to merge once we settle this.

@stellar-jenkins-ci

Copy link
Copy Markdown

@ElliotFriend

Copy link
Copy Markdown
Contributor Author

@kaankacar you weren't wrong. there was some buggy stuff in there, even some pre-existing weirdness. should be all fixed now.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 6 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

docs/learn/fundamentals/contract-development/contract-interactions/stellar-transaction.mdx:612

  • The source link immediately above this block still targets the old c2e702… XDR snapshot that backed the removed readBytes/refundableFee layout. As a result, the updated diskReadBytes definition no longer matches its cited reference. Point the link at current XDR (ideally a current pinned commit).
    // The maximum number of bytes this transaction can read from disk backed entries
    uint32 diskReadBytes;

docs/build/guides/archival/extend-persistent-entry-js.mdx:12

  • This conflates TTL with liveUntilLedger. TTL is the number of ledgers remaining until an entry stops being live; the absolute last ledger is the entry's liveUntilLedger (as defined in docs/learn/fundamentals/contract-development/storage/state-archival.mdx:108). This distinction matters because extendTo is a relative TTL offset, not an absolute ledger sequence.
- a Time To Live (TTL), which is the last ledger through which the entry stays live.

docs/build/guides/archival/extend-persistent-entry-js.mdx:272

  • The suggested calls cannot supply different targets: all three helpers hard-code extendTo: 100_000 and have no extendTo parameter. Readers following this example therefore cannot implement the different-target case described here without first changing the helpers.
That shared `extendTo` is the one real constraint. Entries that need _different_ target TTLs can't share an operation, so extend each one in its own transaction (for example, by calling the `extendPersistentEntryTTL`, `extendContractInstanceTTL`, and `extendContractCodeTTL` helpers above with different `extendTo` values).

@stellar-jenkins-ci

Copy link
Copy Markdown

1 similar comment
@stellar-jenkins-ci

Copy link
Copy Markdown

- fix stale XDR link
- clarify ttl and liveUntilLedger conflated descriptions
- note what the helper functions actually do for variable values
@stellar-jenkins-ci

Copy link
Copy Markdown

1 similar comment
@stellar-jenkins-ci

Copy link
Copy Markdown

@ElliotFriend
ElliotFriend merged commit c933da4 into main Jul 30, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

raven issues discovered by Stellar Raven QA passes

Projects

None yet

3 participants