This is the first release candidate of soroban-sdk v30, supporting Protocol 30.
Important
Contracts using soroban-sdk v30 must be built with stellar contract build from stellar-cli v30.0.0 or newer.
See the migration guide for everything that needs to change when upgrading.
Highlights
Protocol 30
- CAP-0084 • Muxed Contracts: a
MuxedAddresswith an id may now be a muxed contract address (W...), not only a muxed account address (M...).MuxedAddress::address()returns the contract address (C...) andMuxedAddress::id()returns the id. (#2130) - CAP-0087 • ML-DSA signature verification: new
Crypto::ml_dsa_44_verify,ml_dsa_65_verify, andml_dsa_87_verifyfor post-quantum (FIPS 204) signature verification. They work likeed25519_verifyand panic on an invalid signature. (#2138)
Contract specs
- Types, events, and errors are named in the spec by their full Rust path, which
stellar contract buildreduces to short names. Duplicate names, such as twoStatetypes in different modules or crates, are now given unique names (State,State2) and every reference in the spec points at the right entry. (#1970) - Specs are shaken by following references from the contract's functions, so spec markers in the Wasm are only needed for events and for errors raised by panics. Contracts carry fewer markers. (#2043, #2114)
- Contract spec XDR is encoded at compile time. (#1965, #2080)
Breaking Changes
- stellar-cli v30+ required to build contracts, as above. (#2082)
- Contract specs of contracts with duplicate type, event, or error names will change when upgrading, as all but one of the entries sharing a name are renamed. Clients generated from those specs will see the new names. Give each type a unique name to keep names unchanged. (#1970)
- Integer enums defined with
#[contracttype]can no longer be passed topanic_with_error!orEnv::panic_with_error. That support was accidental. Use#[contracterror]types. (#2043) - Contracts that read
MuxedAddress::id()must not assume an address with an id is an account, as it may now be a muxed contract. UseMuxedAddress::address()for the address that holds a balance or authorizes. (#2130) #[contract]now rejects contract types with fields, tuple structs, and generics. Onlystruct Contract;andstruct Contract {}are accepted. Fields were previously silently ignored. (#2120)
For tool builders
- The
rssdk_spec_shakingcontract meta entry is no longer written. Tools should pick how to shake a spec from therssdkvermeta entry, and for contracts built with v30+ follow references between spec entries instead of expecting a marker for every entry kept. (#2043) - The generated
spec_xdrfns return entries as the SDK emits them, with full-path names and unshaken. Tools assembling specs from them need to reduce names withsoroban_spec::reduce::reduce. (#1970, #2139) soroban-token-specandstellar-asset-spec:xdr()now returns the spec with names reduced and is no longerconst. The unprocessed spec is available from theconstfnxdr_unprocessed(). Both crates are now std. (#2139)soroban_spec::shaking::generate_marker_for_xdris nowconstand usable in no_std crates. (#2080)
Fixes
- Fix
contractimport!dropping an event'sdata_format, which made importedsingle-valueandvecevents encode asmap. (#2074) - Fix a duplicate ctor compile error (E0428) for an empty
#[contractimpl(contracttrait)]impl. (#2098) - Fix
#[contracttrait]default fns ignoring thecrate_pathof the#[contractimpl], which broke renamed SDK dependencies. (#2089) - Fix
MuxedAddress::try_from_valpanicking on a non-addressScValinstead of returningConversionError. (#2099) - Fix test clients not restoring
set_auths,mock_auths, andmock_all_authsstate when a call panics. (#2094)
Docs
- Generated contract client fns now document when they panic and when their
try_variants return errors. (#2134) TokenInterfacedocs link each function's events to the matchingsoroban-token-sdkevent types. (#2132)
Dependencies
- Update soroban-env and stellar-xdr to the Protocol 30 versions. (#2061, #2130, #2138)
- Update stellar-strkey to 1.0.0. (#1913)
- Remove unused dependencies, including
curve25519-dalek. (#2092, #2093)
Known Issues
- Spec entries for some
#[contracttype]types (int enums, union enums, tuple structs) defined in a dependency crate can be missing from the contract spec when building without LTO. A fix was attempted in #2126 and reverted in #2137. Tracked in #2125.
What's Changed
- Add tests for conversions from vals of other types by @leighmcculloch in #2065
- Fix event data_format in contractimport! output by @leighmcculloch in #2074
- Update env and xdr deps to env main for next major (v30) by @leighmcculloch in #2061
- Snapshot contract spec sections as XDR-JSON by @leighmcculloch in #2078
- Sort spec snapshot entries and as arrays by @leighmcculloch in #2086
- Require stellar-cli same or greater major version by @leighmcculloch in #2082
- Update stellar-strkey to 0.0.18 by @leighmcculloch in #1913
- Hash spec markers with a const SHA-256 by @leighmcculloch in #2080
- Fix duplicate ctor for empty contracttrait impls by @leighmcculloch in #2098
- Remove unused dependencies and test contract by @leighmcculloch in #2092
- Remove unused curve25519-dalek dependency by @leighmcculloch in #2093
- Fix MuxedAddress panic on non-address ScVal by @leighmcculloch in #2099
- Bump the all-actions group with 12 updates by @dependabot[bot] in #2072
- Encode contract spec XDR at compile time by @leighmcculloch in #1965
- Fix test client state reset when a call panics by @leighmcculloch in #2094
- Fix contractimpl crate_path for contracttrait default fns by @leighmcculloch in #2089
- Remove support for no message in the sdk_panic() macro by @leighmcculloch in #2104
- Remove redundant extern crate proc_macro by @leighmcculloch in #2105
- Qualify type and event names and references by @leighmcculloch in #1970
- Add Socket Basics security scanning workflow by @kanwalpreetd in #2066
- Fix event spec shaking by @leighmcculloch in #2114
- Shake specs by reachability and markers by @leighmcculloch in #2043
- Fix openzeppelin github workflow by @leighmcculloch in #2119
- Reject contract structs with fields or generics by @leighmcculloch in #2120
- Fix contracttype specs in builds without LTO by @leighmcculloch in #2126
- Protocol 30 • CAP-0084 • Muxed Contracts by @leighmcculloch in #2130
- Link token interface events to event types by @leighmcculloch in #2132
- Add tests for contracttype tuple fields by @leighmcculloch in #2131
- Document panics and errors on client functions by @leighmcculloch in #2134
- Remove v30 SDK type names migration entry by @leighmcculloch in #2136
- Revert contracttype spec anchors for non-LTO builds by @leighmcculloch in #2137
- Build test wasms inside a docker container by @leighmcculloch in #2107
- Reduce names in xdr of token and asset specs by @leighmcculloch in #2139
- Protocol 30 • CAP-0087 • ML-DSA signature verification by @jayz22 in #2138
- Bump version to 30.0.0-rc.1 by @leighmcculloch in #2144
Full Changelog: v29.0.1...v30.0.0-rc.1