Skip to content

SPIKE: Protocol 28 (CAP-0084)#2

Closed
sisuresh wants to merge 1 commit into
masterfrom
p28-cap-0084
Closed

SPIKE: Protocol 28 (CAP-0084)#2
sisuresh wants to merge 1 commit into
masterfrom
p28-cap-0084

Conversation

@sisuresh

Copy link
Copy Markdown
Owner

SPIKE bumping js-stellar-base for Protocol 28 / CAP-0084 (muxed contract addresses).

Changes

  • XDR pinned to stellar-xdr@2769fed (PR WIP: feat(typescript): add XDR typings stellar/js-stellar-base#305 head); CAP_0084 added to the regen feature gate. New SC_ADDRESS_TYPE_MUXED_CONTRACT arm + MuxedContract struct; curr/next byte-identical.
  • Address decodes/encodes the muxed-contract arm: Address.muxedContract(contractId, id), fromScAddress/toScAddress round-trip (uint64 kept as xdr.Uint64, no precision loss), contractId()/muxedId() accessors, <C-strkey>:<id> display. toBuffer() throws for this arm (no canonical single-buffer encoding).
  • Generated-JS const inlining made reproducible + terser-safe via scripts/post-process-generated.py, wired as a post-xdrgen Makefile step.
  • types/{curr,next}.d.ts + public Address typings (types/index.d.ts, types/test.ts) updated; dts Makefile recipes patched (node:lts-alpine, drop -it). Hand-aligned the .d.ts delta because dts-xdr master has drifted from the committed format.
  • New Address muxed-contract unit tests (incl. a 2^64-1 mux id) + CHANGELOG.

Deferred

  • Canonical muxed-contract strkey — so the display string is not parsable back via the Address constructor; round-trip is via ScAddress/ScVal. Pending upstream standardization. One residual decision for human review — mirrors go-stellar-sdk, which made the same call.
  • toBuffer() for the muxed arm — intentionally throws.

Links

Upstream (pinned .x): stellar/stellar-xdr#305
Mirrors (same residual strkey gap): sisuresh/go#1
Downstream (re-pin once stellar#305 merges): feeds js-stellar-sdkstellar-laboratory
Part of the CAP-0084 / Protocol 28 rollout:

- Bump XDR rev pin (curr+next) to stellar/stellar-xdr@2769fed (PR stellar#305 head)
  carrying the CAP_0084 #ifdef gate; add CAP_0084 to XDR_FEATURES and the
  `stellar-xdr xfile preprocess --features` step on the .x fetch rules.
- New XDR: SCAddressType.SC_ADDRESS_TYPE_MUXED_CONTRACT=5, struct
  MuxedContract { uint64 id; ContractID contractId; }, SCAddress muxedContract
  arm. curr/next regenerated byte-identical.
- Make generated-JS const inlining reproducible and terser-safe:
  scripts/post-process-generated.py inlines bare const use sites
  (xdr.string(SCSYMBOL_LIMIT) -> xdr.string(32)) so terser cannot DCE an
  unbound identifier; wired as a post-xdrgen Makefile step for curr and next.
- Regenerate types/{curr,next}.d.ts with MuxedContract; patch the dts Makefile
  recipes (node:lts-alpine + apk add yarn, drop -it).
- Address now decodes/encodes the muxed-contract arm: Address.muxedContract(),
  fromScAddress/toScAddress round-trip (uint64 preserved as xdr.Uint64),
  contractId()/muxedId() accessors, <C-strkey>:<id> display, toBuffer() throws.
  Public typings (types/index.d.ts, types/test.ts) and unit tests added.

Deferred: a canonical muxed-contract *strkey* (so the display string isn't
constructor-parsable) — pending upstream standardization; mirrors
go-stellar-sdk#1, which has the same residual gap.
@sisuresh

Copy link
Copy Markdown
Owner Author

Downstream: consumed by the Lab CAP-0084 SPIKE — sisuresh/laboratory#2

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