Skip to content

SPIKE: Protocol 28 (CAP-0084)#1700

Draft
sisuresh wants to merge 15 commits into
stellar:mainfrom
sisuresh:p28-cap-0084
Draft

SPIKE: Protocol 28 (CAP-0084)#1700
sisuresh wants to merge 15 commits into
stellar:mainfrom
sisuresh:p28-cap-0084

Conversation

@sisuresh

@sisuresh sisuresh commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Host support for CAP-0084 (Muxed Contract Addresses) — SAC transfer/mint to muxed contract destinations, storage-key rejection.

Changes

  • Re-pinned rs-stellar-xdr dep to Capture user panic-strings in native builds, avoid spurious NoContractRunning error #552 head 3d2ad659a3a285aae9543069ee18cb6245a427ce (refreshed head — carries both CAP-0084 and CAP-0085).
  • CAP-0084 host semantics gated on a per-cap leaf feature cap_0084_muxed_contract (pulls only stellar-xdr/cap_0084_muxed_contract); each crate's next aggregates it (common/guest/host). Verified: compiles + tests pass both standalone and via next.
  • Merged latest main (incl. CAP-85, Implement CAP-85 #1703) — kept both changesets; the stellar-xdr workspace dep now also enables cap_0085_executable_ref (from base).
  • anyhow RUSTSEC-2026-0190 resolved: base now carries anyhow 1.0.103 (the advisory fix), so the temporary deny.toml ignore added by this PR was removed (cargo deny check advisories → ok).

Deferred

Upstream

Downstream


Refresh 2026-07-21 — revert accidental upstream/main merge (head 0df250f3)

An earlier Merge remote-tracking branch 'upstream/main' (893afcc9) dragged in #1698 ("lazily decode e2e ledger entries"), #1702, and CAP-85 (#1703) — none of which belong in this CAP-0084 host. #1698 changed two public host APIs (invoke_host_function → one paired (Option<T>, Option<TtlLedgerEntryMeta>) iterator; wasm_module_memory_cost(budget, &ContractCodeEntryExt, code_len)) that break stellar-core's p28 mirror glue and diverge from master's promoted p28 host (883fd563, pre-#1698).

Head 0df250f37aaae74e210c9016583c943fecdaba42 is an append-only commit (no force-push) whose tree is the pre-#1698 CAP-0084 tip 78166c27 with rs-stellar-xdr repinned to #552 head 3d2ad659 (CAP-0084 xdr unchanged vs cf7fdedf; only gated cap_0085 code added, not enabled here). Net effect: CAP-0084 only, pre-#1698 e2e API, v27.0.0. CAP-85 lives in its own host PR (#1704). Verified cargo build -p soroban-env-host --features next.

@sisuresh

sisuresh commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Comment thread deny.toml
# TEMP CAP-0084 SPIKE: "sisuresh" allows the rs-stellar-xdr#552 fork-rev pin
# (git+https://github.com/sisuresh/rs-stellar-xdr?rev=cf7fdedf7ca95fccf45c82e6829d14637c9b5e4c). Revert when the
# stellar-xdr dependency re-points to an accepted stellar/rs-stellar-xdr rev.
github = ["stellar", "sisuresh"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This needs to be removed

Comment thread soroban-env-common/Cargo.toml Outdated
# variant from stellar-xdr; the umbrella `next` aggregates it (above). Must NOT
# pull in `next` (that would make `next` <-> cap a cycle). Fold into the base XDR
# / make unconditional at the protocol bump.
cap_0084_muxed_contract = ["stellar-xdr/cap_0084_muxed_contract"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We've had some discussions about not feature gating in the host, and just reverting if we need to pull a change out.

sisuresh added 10 commits July 21, 2026 15:19
Pin stellar-xdr to rs-stellar-xdr#549 (CAP-0084, fork rev 7b46a60d, crate
v28.0.0). Gate all CAP-0084 host code and tests on a dedicated
cap_0084_muxed_contract cargo feature (forwarding to next for the proto-28
meta and to stellar-xdr/cap_0084_muxed_contract for the XDR variant), NOT the
umbrella next, so the CAP can be pulled pre-release independently. Route
ScAddress::MuxedContract through the existing MuxedAddressObject vehicle; SAC
transfer de-muxes; mint is cfg-split via a single method with a cfg'd
MintDestination alias. Muxed addresses stay prohibited as storage keys. No new
host functions; no env version bump (protocol 28 already reported under next).

TEMP: deny.toml allows the sisuresh git source for the SPIKE pin.

Upstream: stellar/rs-stellar-xdr#549 -> stellar/stellar-xdr#306
Restore the per-cap leaf feature per the rs-soroban-env feature-wiring contract:
cap_0084_muxed_contract is a leaf pulling only stellar-xdr/cap_0084_muxed_contract,
and each crate's umbrella next aggregates it (common/guest/host). The CAP-0084 SAC
code (ScAddress::MuxedContract arm + CAP-67 machinery, 16 gates) is keyed on the
cap feature, not next. The cap must NOT pull next (that would make next<->cap a
cycle). Reverses the feature-gating portion of 87a9b56 in correct leaf form.
Reverts 448016a. The RUSTSEC-2026-0190 fix is a general security bump unrelated
to CAP-0084; keeping this PR CAP-scoped. Tracked as a separate PR onto main; deny
advisories stays red on RUSTSEC-2026-0190 until that lands and this branch rebases.
…pin

The sources.allow-org SPIKE comment still referenced the superseded
rs-stellar-xdr stellar#549 / rev 7b46a60d. Update it to stellar#552 / rev
cf7fdedf7ca95fccf45c82e6829d14637c9b5e4c so it matches the actual
Cargo.toml/Cargo.lock pin. Comment/tracking metadata only -- no change
to the allow-org list, the dependency pin, or feature wiring.
Bump anyhow 1.0.75 -> 1.0.103 in Cargo.lock to clear the advisory
(dtolnay/anyhow#451) that fails cargo-deny (advisories) on this
CAP-0084 SPIKE branch. This ports the identical one-line lockfile fix
from the sibling PR rs-soroban-env#1701 (anyhow-rustsec-2026-0190).
Supersedes the earlier out-of-scope revert now that upstream CAP PR
CI failures are in scope for this pass.
…o.lock bump

b51329b claimed to clear the anyhow advisory via cargo-deny but only
re-applied the out-of-scope anyhow 1.0.75 -> 1.0.103 Cargo.lock bump
(the exact change 26b035c had reverted) and added no deny.toml ignore.

This restores anyhow to 1.0.75 in Cargo.lock (the bump belongs to the
dedicated advisory PR stellar#1701, not the CAP-0084 PR) and instead ignores
RUSTSEC-2026-0190 in deny.toml so `cargo deny check advisories` stays
green without carrying the dependency bump. Remove the ignore once stellar#1701
lands anyhow >= 1.0.103 into main and this PR rebases.
ed25519-dalek 3.0.0 (2026-07-06) bumped its rand_core past the rand 0.8.5 /
rand_chacha 0.3.1 pinned in soroban-env-host, breaking the ChaCha20Rng:
CryptoRng bound used by SigningKey::generate in builtin_contracts testutils.
Cap the requirement at <3.0.0 so fresh downstream resolves (e.g. the SDK's
cargo-semver-checks rustdoc build) pick 2.x.
Extract the shared body of the muxed-account storage-key test into a
helper `check_muxed_address_is_not_allowed_as_storage_key`, and add the
CAP-0084 muxed-contract twin as a thin, feature-gated wrapper. Also
record the missing observation for the `muxed_contract_storage_key_conversion`
unit test.
@socket-security

socket-security Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedanyhow@​1.0.103 ⏵ 1.0.1048110093100100

View full report

Comment thread deny.toml Outdated
sisuresh added 3 commits July 21, 2026 16:00
Host versions offer no backwards compatibility, so protocol-gating
purely-additive changes behind a cargo feature just adds mess (per
review). Follow the merged CAP-85 pattern: enable the XDR feature
unconditionally on the workspace stellar-xdr dep and drop every
cfg gate.

- Cargo.toml: stellar-xdr features now [cap_0084_muxed_contract,
  cap_0085_executable_ref]
- common/guest/host: delete the cap_0084_muxed_contract leaf feature
  and its next aggregation entries
- Drop all #[cfg(feature = "cap_0084_muxed_contract")] gates; SAC
  mint takes MuxedAddress directly and the MintDestination cfg alias
  is gone (param name stays 'to', spec unchanged)
- Record default-config observations for the previously next-only
  CAP-84 tests; refresh the stale muxed-contract storage-key one

cargo test -p soroban-env-host: 835/835 (default), 834/834 (next);
fmt clean.
Comment thread soroban-env-host/src/builtin_contracts/stellar_asset_contract/contract.rs Outdated
Aligns the host with stellar-protocol#1985, which narrows CAP-0084 to the
SAC `transfer` function. CAP-67 only ever added muxed-destination support to
`transfer`, not `mint`, so extending `mint` broke that parity.

- SAC `mint` reverts to a plain `Address` destination (no de-mux); it no
  longer accepts a `MuxedAddress`.
- The `mint` *event* is unchanged: an issuer-source `transfer` to a muxed
  contract destination still emits a `mint` event carrying `to_muxed_id`
  (via `transfer_maybe_with_issuer` -> `event::mint`), matching CAP-67's
  issuer semantics.
- Drop the now-unused `mint_muxed` test helper.
- Replace `test_cap_84_mint_with_muxed_contract` with
  `test_cap_84_issuer_transfer_to_muxed_contract_emits_mint`, which covers
  the preserved issuer-source mint-event behavior.
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