Skip to content

fix: fetch DripGovernor::config once per batch in create_batch_streams - #477

Open
mysteriousskater wants to merge 1 commit into
conduit-protocol:mainfrom
mysteriousskater:fix/issue-422-enhancement-create-batch-streams-makes-one
Open

fix: fetch DripGovernor::config once per batch in create_batch_streams#477
mysteriousskater wants to merge 1 commit into
conduit-protocol:mainfrom
mysteriousskater:fix/issue-422-enhancement-create-batch-streams-makes-one

Conversation

@mysteriousskater

Copy link
Copy Markdown

Overview

This PR removes the redundant per-stream DripGovernor::config cross-contract calls in create_batch_streams. Instead of letting each stream in a batch independently fetch the same governor config, the batch path now fetches the config once and threads it through an internal helper.

The public create_stream path is preserved and still fetches its own config, so single-stream callers retain existing behavior.

Related Issue

Changes

⚙️ Batch Config Fetch

  • [MODIFY] contracts/factory/src/lib.rs
    • Split create_stream into a public wrapper that fetches GovernorConfig via governance::config and delegates stream creation to a new internal helper.
    • Add create_stream_with_config(&config, ...) so both the single-stream and batch paths share the same bounds enforcement and stream creation logic.
    • Update create_batch_streams to fetch the DripGovernor::config once before the stream loop and pass &config into create_stream_with_config for each stream in the batch.
    • Keep the public create_stream behavior unchanged for single-stream callers.

Verification Results

cargo test --package factory
✅ all tests passed

Live acceptance check:
✅ 1 DripGovernor::config cross-contract call per 10-stream batch
✅ create_stream single-stream path still fetches config independently
✅ create_batch_streams preserves all existing stream / batch boundary checks
Acceptance Criteria Status
create_batch_streams fetches DripGovernor::config once per batch ✅ One config call for the entire batch instead of one per stream
Public create_stream still fetches config for the single-stream path ✅ Public wrapper fetches config internally and delegates to helper
Bounds enforcement still runs for every stream create_stream_with_config calls enforce_bounds for each stream
Batch host-call overhead is reduced ✅ N cross-contract config calls reduced to 1 for MAX_BATCH_SIZE = 10

Closes #422

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

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

Development

Successfully merging this pull request may close these issues.

Enhancement: create_batch_streams makes one DripGovernor::config cross-contract call per stream — fetch the config once per batch

1 participant