SPIKE: Protocol 28 (CAP-0085) - #2659
Draft
sisuresh wants to merge 1 commit into
Draft
Conversation
Move the CLI onto the CAP-85 stack and teach it the new executable type. Dependencies: stellar-xdr is pinned to stellar/rs-stellar-xdr a90de0c0 with cap_0085_executable_ref -- the same rev rs-soroban-env pins. Patching it alone is not enough: crates.io soroban-env-common 27.0.0 fails to build against CAP-85 XDR because its ScVal/ScValType matches do not cover ExecutableTag, and leaving it unpatched resolves a second CAP-85-blind stellar-xdr that mismatches types at every crate boundary. So [patch.crates-io] moves env and the SDK family together. The soroban-* patches track rs-soroban-sdk#1929, fork-hosted while that PR is open; the env and xdr revs are already upstream stellar revs. Resolution: utils::rpc::resolve_executable_ref reads the Wasm hash out of the owner's persistent entry keyed by the tag. Without it the CLI cannot invoke an external-ref contract at all, since arg parsing needs the spec, which needs the code. Wired into get_spec, wasm::fetch_from_contract and wasm::fetch_wasm_hash_from_contract. Spec caching stays keyed on the resolved hash, so re-pointing a reference misses the cache rather than serving a stale spec. Deploy: --executable-owner/--executable-tag build a CREATE_CONTRACT(_V2) whose executable is CONTRACT_EXECUTABLE_EXTERNAL_REF. Nothing is uploaded; the constructor signature still comes from the resolved code. Display: soroban-spec-tools renders ScVal::ExecutableTag as a tagged object so it stays distinguishable from ScVal::String, which shares its payload, and renders an external-ref instance as its reference rather than a resolved hash. The auth log deliberately shows the reference unresolved -- what is being signed is a contract whose code the owner can replace, and a resolved hash would misrepresent that as fixed. Used to validate CAP-0085 end to end against stellar/quickstart:nightly-next at protocol 28.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Protocol 28 (CAP-0085, externally managed contract executables) support to the CLI. There was none — upstream's most recent protocol bump is #2613 (p27).
Dependencies.
stellar-xdrmoves to the CAP-85 rev withcap_0085_executable_ref. Patching it alone doesn't work: crates.iosoroban-env-common 27.0.0fails to build against CAP-85 XDR (itsScVal/ScValTypematches don't coverExecutableTag), and leaving it unpatched resolves a second, CAP-85-blindstellar-xdrthat then mismatches types at every crate boundary. So[patch.crates-io]moves env and the SDK family together. The env and xdr revs are already upstreamstellarrevs; thesoroban-*patches track rs-soroban-sdk#1929 and are fork-hosted only while that PR is open.Reference resolution.
utils::rpc::resolve_executable_refreads the Wasm hash out of the owner's persistent entry keyed by the tag. This isn't cosmetic — without it the CLI cannot invoke an external-ref contract at all, because argument parsing needs the spec, which needs the code. Wired intoget_spec,wasm::fetch_from_contractandwasm::fetch_wasm_hash_from_contract. Spec caching stays keyed on the resolved hash, so re-pointing a reference misses the cache rather than serving a stale spec.Deploy.
--executable-owner/--executable-tagbuild aCREATE_CONTRACT(_V2)whose executable isCONTRACT_EXECUTABLE_EXTERNAL_REF.Display.
ScVal::ExecutableTagrenders as a tagged object so it stays distinguishable fromScVal::String, which shares its payload. An external-ref instance renders as its reference. The auth log deliberately shows the reference unresolved — what's being signed is a contract whose code the owner can replace at will, and a resolved hash would misrepresent that as fixed.Testing
Built and used as the driver for CAP-0085 validation against a locally built
stellar/quickstart:nightly-nextat protocol 28 (corec444c073, rpcprotocol-next, horizonprotocol-next). It drove the full matrix: atomic fleet upgrade, the protocol-enforced storage invariants, self-update and deferred application, TTL scoping,get_address_executable, and the classic-op deploy path above. 28 transactions, all successful.Not yet run: this repo's own test suite.
cargo check -p soroban-cli --all-targetsis clean, butbuild_create_contract_txchanged signature andsoroban-spec-toolsgained match arms, so CI is worth watching.Draft until rs-soroban-sdk#1929 lands and the
soroban-*patches can re-point at astellar/rev.