docs: update smart-contracts skill and adjust it for protocol 27#47
Merged
kaankacar merged 8 commits intoJul 8, 2026
Merged
Conversation
Every technical claim was verified against rs-soroban-sdk v27.0.0-rc.1, rs-soroban-env v27.0.0, stellar-cli 27.0.0, and live network settings; the example contract and test compile and pass against the rc SDK. Corrections to stale facts: - wasm32v1-none is the only supported target (was wasm32-unknown-unknown) - contract size limit is 128KB on mainnet (was 64KB); limits table refreshed from live `stellar network settings` with a pointer to requery - #[contractevent] example gained the required #[topic] markers; the deprecated env.events().publish() is no longer shown - token::TokenClient replaces the deprecated token::Client alias; SEP-41 transfer destination is MuxedAddress since v23 - crate-type includes "lib" (matches stellar contract init scaffold) New protocol coverage: - CAP-71 (p27): custom-account auth delegation via env.custom_account() - CAP-78 (p26): extend_ttl_with_limits; CAP-73: SAC trust(); CAP-82: checked 256-bit arithmetic - p23+ auto-restore of archived persistent entries in the rw footprint - SDK 25+ mainnet resource limits enforced in unit tests (cost_estimate) Deepened from a correctness pass on auth/storage/fees semantics: auth trees and cross-contract propagation (authorize_as_current_contract), __check_auth with correct Hash<32> signature, TTL-is-not-a-security- boundary, footprint/parallelism guidance, contract-side SEP-41/SAC semantics, and token-consumer + fee-griefing review checklists.
The quoted limits are the current on-chain mainnet config settings and drift by validator vote; the Lab page is the canonical human-friendly view of the live values.
Skill selection matches on the frontmatter description text; name the terms users actually type (Soroban, soroban-sdk, SEP-41, SAC, auth/ storage/TTL errors) so Soroban-phrased requests reliably route here.
An adversarial fact-check pass against CLI v27 caught that
`stellar keys generate --global` no longer exists (keys are stored
globally by default) — fixed in all four occurrences.
A coverage diff against the pre-merge sources flagged genuinely lost
content, restored here verified against v27 source:
- SEP-41 token event shapes table (re-derived from soroban-token-sdk
and the env SAC event code, which also corrects the older shapes:
mint has no admin topic, SAC appends the SEP-0011 asset topic,
muxed transfers use a {to_muxed_id, amount} map)
- "never require_auth your own address inside __check_auth" rule
- routing table now lists constructors/factories/governance explicitly
27.0.0 final ships imminently and later majors will follow, so a pinned rc string would rot fast. Teach the durable rule instead: SDK major = protocol version, resolve the current release from crates.io / GitHub releases, and check the network's live protocol via getVersionInfo or Stellar Lab. The Cargo.toml example now pins the major only.
soroban-sdk = "27" won't resolve on crates.io until 27.0.0 final ships, so the copy-paste snippet pins the rc explicitly; the Versions section still teaches how to resolve the current release.
The rebase resolution takes this branch's rewrite over stellar#45's edits to the old files; the target and --global fixes from stellar#45 are already covered, but its --source → --source-account spelling was the one change worth keeping.
10141d6 to
648776b
Compare
smart-contracts skill and adjust it for protocol 27
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the smart-contracts skill documentation to protocol 27, refreshing toolchain/version facts and expanding Soroban/Stellar smart-contract semantics (auth, storage/TTL, tokens, fees, testing, security) with protocol-27-era APIs and behaviors.
Changes:
- Refreshes SKILL entry-point guidance and examples for protocol 27 (toolchain/target, versioning guidance, contract anatomy with events).
- Expands development patterns docs with updated execution model, auth-tree semantics, storage/TTL behavior, token/SAC semantics, and fee/resource limit guidance.
- Updates testing and security guidance with newer SDK behaviors (resource limits in unit tests, event assertions) and additional vulnerability classes/pitfalls.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| skills/smart-contracts/SKILL.md | Updates skill entry-point description, versions/toolchain notes, and the example contract to protocol 27. |
| skills/smart-contracts/development.md | Reworks/expands core semantics (execution model, TTL, auth trees, tokens, fees/limits, troubleshooting) for protocol 27. |
| skills/smart-contracts/testing.md | Updates unit/integration testing guidance, adds resource-limit notes and newer event assertion patterns. |
| skills/smart-contracts/security.md | Expands security review guidance with additional protocol-relevant pitfalls and checklists. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The inner #![cfg(test)] attribute is correct for the src/test.rs module that stellar contract init scaffolds, but pasted into lib.rs it would gate the whole crate behind cfg(test). Say so next to the snippets.
oceans404
approved these changes
Jul 8, 2026
oceans404
left a comment
Contributor
There was a problem hiding this comment.
Thanks for contributing smart contract skills and updating for P27!
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.
Rewrites the
smart-contractsskill as a merge of two sources — the existing skill in this repo and a second, more semantics-focused reference Soroban skill — with every fact updated to protocol 27 (rs-soroban-sdkv27,rs-soroban-envv27,stellar-cliv27). The existing skill carried stale toolchain facts; the reference skill contributed deeper Soroban semantics but taught some deprecated APIs.Every claim was verified against the v27 source trees, CLI behavior, and live
stellar network settings/ RPC values — not model memory. The example contract and test in SKILL.md compile and pass against the rc SDK onwasm32v1-none.What came from which source
__check_auth, storage/archival depth, fees/footprints, SEP-41/SAC semantics, allowance race#[contractevent]APIenv.events().publish()#[topic]markers fixedsoroban-token-sdk/ env SAC sourceextend_ttl_with_limits, CAP-73trust(), CAP-82 checked 256-bit math, test resource limitsCorrections (stale → verified)
wasm32-unknown-unknownwasm32v1-none— the only target the runtime supports (Rust ≥ 1.84)soroban-sdk = "25.0.1"contract_max_size_bytes = 131072); full limits table re-measured live with a pointer to lab.stellar.org/network-limits#[contractevent]example without#[topic]markers#[topic]silently land in the data map — example fixed, macro semantics documentedtoken::Clienttoken::TokenClient/StellarAssetClient; SEP-41transferdestination isMuxedAddressstellar keys generate --globalcrate-type = ["cdylib"]["lib", "cdylib"], matching thestellar contract initscaffold (lib needed for tests/fuzzing)RestoreFootprintrequired"soroban-token-sdk/ env SAC source:minthas no admin topic, SAC appends the SEP-0011 asset topic, muxed transfers use a{to_muxed_id, amount}mapNew protocol coverage (was missing entirely)
env.custom_account().delegate_auth/get_delegated_signers)extend_ttl_with_limits; CAP-73 SACtrust(); CAP-82 checked 256-bit arithmeticEnv::default()),env.cost_estimate()profilingBenchmark (same 3 tasks, old skill vs this PR)
The old skill's failures were exactly the corrections above:
wasm32-unknown-unknownbuilds, "64KB" answers, stale SDK pins, and a missed TTL-extension attack in the security review.Notes
SKILL.md,development.md,testing.md,security.md) — sibling skills deep-link into these files