Problem Statement Existing tests run in Env::default() with deterministic success paths. They do not test what happens when a host-side storage read returns a stale value, when extend_ttl is exhausted, or when a panic during mid-mutation leaves the contract in an unexpected state. Soroban's host guarantees are strong but not actually tested in this repo.
Expected Outcome A new test file chaos_tests.rs that exercises:
Env::budget() exhaustion mid-donate (does the storage revert?).
- Forced eviction via
env.storage().persistent().set of a non-existent key after a write attempt (triggers extend_ttl panic under the old code; should now no-op).
- Two parallel
donate calls from the same donor in the same test (using env.ledger().with_mut_transaction or two Env instances).
- Panic during
release_milestone (assert campaign state unchanged).
Acceptance Criteria
- New test file with at least 5 chaos scenarios.
- Each scenario asserts post-state correctness.
- A documented expectation table distinguishes "Soroban guarantee" vs "host implementation detail."
Implementation Notes
- This is high-value but harder to maintain — keep scope small.
Affected Files / Modules
- New:
campaign/src/test/chaos_tests.rs
campaign/src/test/mod.rs
Dependencies — None.
Problem Statement Existing tests run in
Env::default()with deterministic success paths. They do not test what happens when a host-side storage read returns a stale value, whenextend_ttlis exhausted, or when a panic during mid-mutation leaves the contract in an unexpected state. Soroban's host guarantees are strong but not actually tested in this repo.Expected Outcome A new test file
chaos_tests.rsthat exercises:Env::budget()exhaustion mid-donate(does the storage revert?).env.storage().persistent().setof a non-existent key after a write attempt (triggersextend_ttlpanic under the old code; should now no-op).donatecalls from the same donor in the same test (usingenv.ledger().with_mut_transactionor twoEnvinstances).release_milestone(assert campaign state unchanged).Acceptance Criteria
Implementation Notes
Affected Files / Modules
campaign/src/test/chaos_tests.rscampaign/src/test/mod.rsDependencies — None.