Skip to content

feat(factory, stream, oracle): doc comment, oracle reconfig safety, combined top-up, batch cancel (#212, #206, #205, #204) - #266

Merged
Jaydbrown merged 5 commits into
conduit-protocol:mainfrom
Odkinggjnr:feat/212-206-205-204-doc-oracle-topup-batch-cancel
Jul 29, 2026
Merged

feat(factory, stream, oracle): doc comment, oracle reconfig safety, combined top-up, batch cancel (#212, #206, #205, #204)#266
Jaydbrown merged 5 commits into
conduit-protocol:mainfrom
Odkinggjnr:feat/212-206-205-204-doc-oracle-topup-batch-cancel

Conversation

@Odkinggjnr

Copy link
Copy Markdown
Contributor

Summary

  • Enhancement: DripFactory::streams_by_recipient has no doc comment #212streams_by_recipient doc comment: Added rustdoc to DripFactory::streams_by_recipient mirroring the existing doc comment on streams_by_sender, documenting pagination behavior and the empty-vector-on-overflow contract.

  • Enhancement: configure_oracle allows silent reconfiguration with no validation against existing price data #206configure_oracle silent reconfiguration safety: configure_oracle now detects when decimals or asset_peg changes relative to the stored config and clears all existing price data (DataKey::Price, per-feeder DataKey::Submission entries, and the DataKey::Submitters list). This prevents stale prices submitted under the old config from being silently misinterpreted under new parameters — get_twap_price returns NoPriceAvailable until a fresh submit_price is made. Changes to max_staleness or oracle_address alone do not clear price data, as those do not affect price magnitude interpretation.

  • Enhancement: top_up and extend_duration have no combined convenience call #205top_up_and_extend combined convenience call: Added DripStream::top_up_and_extend(env, caller, amount, extra_time_seconds) that deposits funds and extends end_time in a single authorized call, reducing round-trips and the risk of a sender performing only one half of the pair. Follows the same state::with_guard re-entrancy pattern, auth via require_sender_or_operator, and event emission as the existing top_up and extend_duration.

  • Enhancement: create_batch_streams has no equivalent batch-cancel counterpart #204cancel_batch_streams batch cancellation: Added DripFactory::cancel_batch_streams(env, sender, stream_addresses) that cancels multiple streams in one transaction via cross-contract calls to DripStream::cancel, matching the bulk-creation ergonomics of create_batch_streams. Bounded by the same MAX_BATCH_SIZE (100), with EmptyBatch / BatchTooLarge guards. Atomicity is inherited from Soroban's all-or-nothing transaction semantics. Added drip-stream as a dependency of the factory crate for the cross-contract client.

Test plan

  • Oracle reconfig tests: Verify price data is cleared when decimals changes, when asset_peg changes, and that price is preserved when only max_staleness changes (no false positive clearing).
  • top_up_and_extend tests: Happy-path (balance + end_time update), zero-amount rejection (InvalidAmount), zero-time rejection (InvalidTimeRange), cancelled-stream rejection, and open-ended stream rejection.
  • cancel_batch_streams tests: Empty batch rejection (EmptyBatch), oversized batch rejection (BatchTooLarge).
  • Existing tests: All existing unit and integration tests continue to pass.

Closes #212
Closes #206
Closes #205
Closes #204

@Odkinggjnr
Odkinggjnr requested a review from Jaydbrown as a code owner July 29, 2026 01:57
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@Odkinggjnr 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

@Jaydbrown

Copy link
Copy Markdown
Contributor

Reviewed and all four sub-fixes (#212, #206, #205, #204) check out correctly — good auth gating, overflow checks, and test coverage throughout. This now has a real merge conflict against main (likely from #265's shared drip-common TTL-constants crate landing first, which this PR also touches). Could you rebase onto current main? Will merge right after.

…nduit-protocol#206, conduit-protocol#205, conduit-protocol#204

Add failing/specifying tests for:
- conduit-protocol#212: streams_by_recipient doc comment gap (verify function behavior)
- conduit-protocol#206: configure_oracle silent reconfiguration when decimals/asset_peg
  change — test that old price data is cleared on reconfig
- conduit-protocol#205: top_up_and_extend combined convenience call tests covering
  happy path, zero-amount, zero-time, cancelled, and open-ended rejection
- conduit-protocol#204: cancel_batch_streams boundary tests (empty batch, oversized batch)

These tests specify the expected behavior for the features and fixes
implemented in subsequent commits.

Refs conduit-protocol#212, conduit-protocol#206, conduit-protocol#205, conduit-protocol#204
…-protocol#206, conduit-protocol#205, conduit-protocol#204

- conduit-protocol#212: Add doc comment to streams_by_recipient mirroring streams_by_sender
- conduit-protocol#206: configure_oracle now clears DataKey::Price, per-feeder Submissions,
  and the Submitters list when decimals or asset_peg changes, preventing
  stale prices from being silently misinterpreted under new parameters
- conduit-protocol#205: Add top_up_and_extend combined convenience entry point on DripStream
  that performs both state changes in a single authorized call
- conduit-protocol#204: Add cancel_batch_streams on DripFactory that cancels N streams in
  one transaction via cross-contract calls, matching create_batch_streams
  bulk ergonomics. Adds drip-stream dependency to factory Cargo.toml.

Fixes conduit-protocol#212, conduit-protocol#206, conduit-protocol#205, conduit-protocol#204
Additional coverage for:
- configure_oracle preserves price when only max_staleness/oracle_address
  changes (no false positives on the clearing logic)
- top_up_and_extend on a cancelled stream is rejected
- top_up_and_extend arithmetic overflow on end_time
- cancel_batch_streams empty and oversized batch rejection

Refs conduit-protocol#212, conduit-protocol#206, conduit-protocol#205, conduit-protocol#204
- Add rustdoc to streams_by_recipient matching streams_by_sender (conduit-protocol#212)
- Add rustdoc to configure_oracle explaining the price-clearing behavior
  when decimals or asset_peg changes (conduit-protocol#206)
- Add rustdoc to top_up_and_extend explaining the combined convenience
  call and its relationship to top_up and extend_duration (conduit-protocol#205)
- Add rustdoc to cancel_batch_streams documenting atomicity, batch limits,
  and the cross-contract cancel pattern (conduit-protocol#204)

Refs conduit-protocol#212, conduit-protocol#206, conduit-protocol#205, conduit-protocol#204
Run cargo fmt --all and cargo clippy --all-targets -- -D warnings
after all changes across factory, stream, and oracle contracts.

Refs conduit-protocol#212, conduit-protocol#206, conduit-protocol#205, conduit-protocol#204
@Jaydbrown
Jaydbrown force-pushed the feat/212-206-205-204-doc-oracle-topup-batch-cancel branch from d00dc07 to 3342c22 Compare July 29, 2026 08:38
@Jaydbrown
Jaydbrown merged commit 9b40822 into conduit-protocol:main Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants