Skip to content

feat: add zero-rate error, keeper maintenance, stream metadata, and concurrency tests - #798

Merged
Jaydbrown merged 1 commit into
conduit-protocol:mainfrom
EmmanuelOchaje:feat/stream-enhancements-792-791-790-789
Oct 18, 2026
Merged

Jaydbrown merged 1 commit into
conduit-protocol:mainfrom
EmmanuelOchaje:feat/stream-enhancements-792-791-790-789

Conversation

@EmmanuelOchaje

@EmmanuelOchaje EmmanuelOchaje commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Four enhancements to DripStream and DripFactory contracts:

Changes

1. ZeroRateStreamNotAllowed Error (#792)

File: contracts/stream/src/errors.rs

Added new error variant ZeroRateStreamNotAllowed = 22 to explicitly reject stream creation with rate_per_second <= 0. Improves error specificity over generic InvalidAmount.

2. bump_stream_instance Keeper Function (#791)

File: contracts/stream/src/ttl.rs

Added low-cost public function bump_stream_instance(env: &Env, stream_id: &str) -> Result<(), Error> that:

  • Extends instance TTL when remaining < threshold
  • Allows keepers to maintain archived streams with minimal gas cost
  • Prevents long-pause scenarios where streams become unresumable
  • Validates stream existence before bumping

3. Stream Title & Reference Tag (#790)

Files: contracts/stream/src/storage.rs, contracts/stream/src/lib.rs

Added sender-modifiable post-creation metadata:

  • set_stream_title(env, caller, title) — update descriptive name
  • set_reference_tag(env, caller, tag) — link to external systems (invoice, order ID)
  • stream_title(env) -> Option<String> — read title
  • reference_tag(env) -> Option<String> — read tag

Storage keys: DataKey::StreamTitle and DataKey::ReferenceTag

4. High-Concurrency Factory Tests (#789)

File: contracts/factory/src/tests.rs

Added two new tests:

high_stream_creation_concurrency()

  • Creates 50 streams rapidly with unique senders/recipients
  • Verifies no stream_id collisions
  • Spot-checks index queryability
  • Stresses factory storage and deployment pipeline

concurrent_stream_creation_maintains_factory_invariants()

  • Creates 50 streams (5 per sender, 10 senders)
  • Tests sender-indexed lookups under concurrent load
  • Verifies event counts reflect all creations
  • Ensures no cross-contamination between senders

Both tests ensure factory behavior remains correct under stream creation load.

Technical Notes

  • All sender-protected operations (set_stream_title, set_reference_tag) require caller auth and prevent calls on cancelled streams
  • TTL bumping uses existing env.storage().instance().extend_ttl() mechanics
  • Metadata keys follow existing DataKey enum pattern
  • Factory tests extend existing Setup harness for consistency

Closes #792
Closes #791
Closes #790
Closes #789

@EmmanuelOchaje
EmmanuelOchaje force-pushed the feat/stream-enhancements-792-791-790-789 branch 2 times, most recently from 63100e0 to 45a3079 Compare October 18, 2026 08:27
…oncurrency tests

- Add ZeroRateStreamNotAllowed error variant for stream creation validation (conduit-protocol#792)
- Add bump_stream_instance function for low-cost keeper-driven TTL maintenance (conduit-protocol#791)
- Add set_stream_title/set_reference_tag and getters for post-creation metadata updates (conduit-protocol#790)
- Add high-concurrency stress tests for factory stream creation under load (conduit-protocol#789)

Closes conduit-protocol#792
Closes conduit-protocol#791
Closes conduit-protocol#790
Closes conduit-protocol#789
@EmmanuelOchaje
EmmanuelOchaje force-pushed the feat/stream-enhancements-792-791-790-789 branch from 45a3079 to 5a77647 Compare October 18, 2026 08:34
@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@EmmanuelOchaje 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
Jaydbrown merged commit bd1fd70 into conduit-protocol:main Oct 18, 2026
4 of 10 checks passed
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