Summary
The compiled KoraContract Wasm is ~1.7× larger than Soroban's on-chain
contract-size limit and cannot be uploaded to any live Stellar network
(testnet, mainnet, or a stock local/standalone network). This blocks every
form of live deployment and integration testing against a real contract
instance until the contract is split into smaller pieces.
This is not an SDK or build-tooling problem — it persists after the
soroban-sdk 21.7.7 → 28.0.0-rc.1 bump, the switch to wasm32v1-none, and a
wasm-opt -Oz --mvp-features pass (see PR that references this issue).
Numbers
Measured on soroban-sdk = "=28.0.0-rc.1", built with
stellar contract build --optimize=false (spec-shaking applied) then
wasm-opt -Oz --mvp-features:
| Artifact |
Size |
stellar contract build raw (wasm32v1-none, opt-level="z" + LTO + strip) |
253,600 B |
after wasm-opt -Oz --mvp-features |
219,161 B |
Soroban contract_max_size_bytes (live, from stellar network settings --network testnet) |
131,072 B (128 KiB) |
| Over the cap by |
88,089 B — 67% |
Section breakdown of the optimized Wasm:
Code (section 10) 140,822 B
contractspecv0 57,023 B <- mandatory, cannot be stripped
Data (section 11) 14,744 B
exports + type/func/etc ~6,500 B
contractenvmetav0 / contractmetav0 ~260 B
--------------------------------------
total 219,161 B vs cap 131,072 B
Related live network limits (protocol 28 testnet):
contract_max_size_bytes : 131072 # hard cap on an uploadable Wasm
tx_max_size_bytes : 132096 # hard cap on one transaction envelope
The upload transaction (Wasm + envelope overhead ≈ 292 KB) also exceeds
tx_max_size_bytes, so the RPC rejects it before execution:
sendTransaction -> errorResultXdr -> {"fee_charged":"0","result":"tx_malformed"}
(stellar contract deploy surfaces this as error: transaction submission failed: TxSorobanInvalid.)
Why the usual levers don't help
wasm-opt -Oz / stellar contract build --optimize both land at ~219 KB —
within ~70 B of each other. They cannot close an 88 KB gap.
contractspecv0 (57 KB) is required for the contract to be usable and is
already spec-shaken down from 84 KB.
- The bulk is the code section (141 KB):
KoraContract is a single
~12,000-line impl block exporting hundreds of functions (pet registry,
medical records, vaccinations, insurance, disputes, governance, breeding,
grooming, nutrition, emergency contacts, custody chain, statistics, …).
What needs to happen
Split KoraContract into multiple independently-deployable Soroban contracts,
each under 128 KiB, coordinated via cross-contract calls or a registry/router
contract. This is an architecture change for the kora-app roadmap — out of
scope for the SDK-28 bump PR.
Impact on downstream work
Until this is resolved there is no way to run a real KoraContract instance on
a live network. Downstream integration (e.g. kora-backend's contract-gateway)
must be scoped around this — mocked/unit-tested against the contract client,
with no live end-to-end deployment.
Acceptance
Summary
The compiled
KoraContractWasm is ~1.7× larger than Soroban's on-chaincontract-size limit and cannot be uploaded to any live Stellar network
(testnet, mainnet, or a stock local/standalone network). This blocks every
form of live deployment and integration testing against a real contract
instance until the contract is split into smaller pieces.
This is not an SDK or build-tooling problem — it persists after the
soroban-sdk21.7.7 → 28.0.0-rc.1 bump, the switch towasm32v1-none, and awasm-opt -Oz --mvp-featurespass (see PR that references this issue).Numbers
Measured on
soroban-sdk = "=28.0.0-rc.1", built withstellar contract build --optimize=false(spec-shaking applied) thenwasm-opt -Oz --mvp-features:stellar contract buildraw (wasm32v1-none,opt-level="z"+ LTO + strip)wasm-opt -Oz --mvp-featurescontract_max_size_bytes(live, fromstellar network settings --network testnet)Section breakdown of the optimized Wasm:
Related live network limits (protocol 28 testnet):
The upload transaction (Wasm + envelope overhead ≈ 292 KB) also exceeds
tx_max_size_bytes, so the RPC rejects it before execution:(
stellar contract deploysurfaces this aserror: transaction submission failed: TxSorobanInvalid.)Why the usual levers don't help
wasm-opt -Oz/stellar contract build --optimizeboth land at ~219 KB —within ~70 B of each other. They cannot close an 88 KB gap.
contractspecv0(57 KB) is required for the contract to be usable and isalready spec-shaken down from 84 KB.
KoraContractis a single~12,000-line
implblock exporting hundreds of functions (pet registry,medical records, vaccinations, insurance, disputes, governance, breeding,
grooming, nutrition, emergency contacts, custody chain, statistics, …).
What needs to happen
Split
KoraContractinto multiple independently-deployable Soroban contracts,each under 128 KiB, coordinated via cross-contract calls or a registry/router
contract. This is an architecture change for the kora-app roadmap — out of
scope for the SDK-28 bump PR.
Impact on downstream work
Until this is resolved there is no way to run a real
KoraContractinstance ona live network. Downstream integration (e.g. kora-backend's contract-gateway)
must be scoped around this — mocked/unit-tested against the contract client,
with no live end-to-end deployment.
Acceptance
KoraContractdecomposed into deployable units, each< 131072 Boptimized
deploy-testnetjob re-enabled in.github/workflows/stellar-contracts.ymlReport contract Wasm sizestep passes without the over-cap warning