📌 Description
list_anchors(start, limit) and the list_settlements* family page through potentially large sets. Without an explicit cost check, a future change to their underlying storage access pattern could silently make pagination cost scale with total dataset size instead of limit, which would be expensive to discover only after deployment.
🧩 Requirements and context
- Use the Soroban test environment's
env.budget() (or equivalent) to assert the CPU/instruction cost of a list_* call with a fixed limit stays roughly constant regardless of how many total anchors/settlements exist in storage.
- Cover
list_anchors, list_settlements, list_settlements_by_anchor, list_settlements_by_asset, list_settlements_by_status, and list_assets.
- Set a generous but meaningful budget ceiling per call so the test catches real regressions without being flaky.
🛠️ Suggested execution
- Add a helper in
src/test.rs that seeds N anchors/settlements and asserts budget usage for a fixed-limit page stays within a documented ceiling for both small and large N.
- If any
list_* entrypoint is found to scale with total size rather than limit, note it as a known gap (or fix if the fix is contained) alongside the test.
✅ Acceptance criteria
🔒 Security notes
Guards against a pagination entrypoint becoming a denial-of-service vector as on-chain state grows.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
list_anchors(start, limit)and thelist_settlements*family page through potentially large sets. Without an explicit cost check, a future change to their underlying storage access pattern could silently make pagination cost scale with total dataset size instead oflimit, which would be expensive to discover only after deployment.🧩 Requirements and context
env.budget()(or equivalent) to assert the CPU/instruction cost of alist_*call with a fixedlimitstays roughly constant regardless of how many total anchors/settlements exist in storage.list_anchors,list_settlements,list_settlements_by_anchor,list_settlements_by_asset,list_settlements_by_status, andlist_assets.🛠️ Suggested execution
src/test.rsthat seeds N anchors/settlements and asserts budget usage for a fixed-limitpage stays within a documented ceiling for both small and large N.list_*entrypoint is found to scale with total size rather thanlimit, note it as a known gap (or fix if the fix is contained) alongside the test.✅ Acceptance criteria
list_*entrypoint.🔒 Security notes
Guards against a pagination entrypoint becoming a denial-of-service vector as on-chain state grows.
📋 Guidelines