Summary
The campaign contract stores participant registrations in instance storage using (PARTICIPANT, participant.clone()) as the key. Instance storage in Soroban has a hard size limit of 64KB. A high-traffic campaign with thousands of participants will hit this ceiling and permanently brick the contract, silently failing new registrations.
Problem
In contracts/campaign/src/lib.rs:
let key = (PARTICIPANT, participant.clone());
env.storage().instance().set(&key, &true);
Per Soroban storage docs:
- Instance storage: shared with contract code, max ~64KB, cheaper TTL management but shared fate
- Persistent storage: per-key, appropriate for user-keyed data like participant records
Using instance storage for per-user data breaks at scale and makes the entire contract instance fragile.
Acceptance Criteria
Storage size risk
Each Address in XDR is ~35 bytes. At 64KB instance limit, a campaign caps out at ~1,800 participants — far below what a viral campaign might receive.
References
contracts/campaign/src/lib.rs:292-300 (register function storage writes)
contracts/campaign/src/lib.rs:332-336 (is_participant storage read)
- Soroban storage types
Summary
The campaign contract stores participant registrations in instance storage using
(PARTICIPANT, participant.clone())as the key. Instance storage in Soroban has a hard size limit of 64KB. A high-traffic campaign with thousands of participants will hit this ceiling and permanently brick the contract, silently failing new registrations.Problem
In
contracts/campaign/src/lib.rs:Per Soroban storage docs:
Using instance storage for per-user data breaks at scale and makes the entire contract instance fragile.
Acceptance Criteria
env.storage().persistent()inregister()andis_participant()extend_ttlfor persistent storage keys on each participant registration (with appropriate mainnet values)PARTICIPANT_COUNTin instance storage (it's a single aggregate value, not per-user)docs/upgradeability.mdStorage size risk
Each Address in XDR is ~35 bytes. At 64KB instance limit, a campaign caps out at ~1,800 participants — far below what a viral campaign might receive.
References
contracts/campaign/src/lib.rs:292-300(register function storage writes)contracts/campaign/src/lib.rs:332-336(is_participant storage read)