Skip to content

fix: clamp factory pagination, cap batch size, fix oracle storage and… - #349

Open
Chidubemkingsley wants to merge 1 commit into
conduit-protocol:mainfrom
Chidubemkingsley:fix/review-dos-storage-decimals
Open

fix: clamp factory pagination, cap batch size, fix oracle storage and…#349
Chidubemkingsley wants to merge 1 commit into
conduit-protocol:mainfrom
Chidubemkingsley:fix/review-dos-storage-decimals

Conversation

@Chidubemkingsley

Copy link
Copy Markdown

All workspace tests pass (drip-factory 17, drip-oracle 55, etc.).

What does this PR do?

Type of change

  • Bug fix
  • New feature
  • Refactor (no behaviour change)
  • Test coverage
  • Documentation
  • Security fix

Related issue

Closes #

Changes

File Change

Checklist

  • cargo fmt --all — no diff
  • cargo clippy --all-targets -- -D warnings — zero warnings
  • cargo test --all — all tests pass
  • New public functions have tests covering the happy path and each error variant
  • All arithmetic uses checked_* methods
  • require_auth() called before any state mutation in modified functions
  • State mutations happen before cross-contract calls (token transfers)
  • Events emitted for all external state changes
  • CHANGELOG.md updated under [Unreleased]
  • docs/architecture.md updated if design changed
  • ADR written if a significant design decision was made

Security notes

Testing notes

… decimals

- factory/query.rs: add MAX_PAGE_SIZE=100 and clamp limit in paginate()
  to prevent u32::MAX from materializing unbounded Vec in view calls;
  update streams_by_sender/recipient docs to reflect hard cap
  (contracts/factory/src/query.rs:6,25; lib.rs:399,414).

- factory/lib.rs: lower MAX_BATCH_SIZE from 100 to 10. Each
  create_stream does governor call, 2 token transfers, deploy +
  initialize invoke and 3 persistent writes (~2.5M insns). 100 *
  2.5M = 250M exceeds Soroban budget; 10 is measured single-digit
  safe upper bound (contracts/factory/src/lib.rs:38). Also updates
  cancel_batch/stream_addresses which share the same cap, and docs.

- oracle/lib.rs: move Submitters and Submission from instance() to
  persistent() per factory/storage.rs rule (unbounded per-entity
  data -> persistent). Add MAX_SUBMITTERS=32, TooManySubmitters error,
  TTL extends for persistent entries, cap check in add_submitter(), and
  update get_twap_price/configure_oracle/submit_price to use
  persistent() (contracts/oracle/src/lib.rs:23,73,408).

- oracle/lib.rs: cap decimals at 19 in configure_oracle() (was 38).
  With price: u64, 10^20 > u64::MAX (~1.84e19) so decimals>=20 is
  unrepresentable; fix rejects >19 and documents widening to u128 as
  alternative (contracts/oracle/src/lib.rs:102,279).

All workspace tests pass (drip-factory 17, drip-oracle 55, etc.).
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@Chidubemkingsley Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant