Skip to content

feat: implement issues 769-772 (factory events, errors, governor roles, voting period) - #799

Merged
Jaydbrown merged 5 commits into
conduit-protocol:mainfrom
afterlyfe2078:feat/issues-769-772-factory-governor
Oct 19, 2026
Merged

Jaydbrown merged 5 commits into
conduit-protocol:mainfrom
afterlyfe2078:feat/issues-769-772-factory-governor

Conversation

@afterlyfe2078

Copy link
Copy Markdown
Contributor

Summary

Implementation of four factory and governor contract enhancements:

Changes

Issue #769 - ProtocolFeeCollected Event

  • New event: protocol_fee_collected(token, recipient, amount)
  • Emitted when protocol fees are collected and routed
  • Allows indexers to track fee accumulation without scanning balance changes
  • Event topics: ("pfee_collected", recipient)
  • Event data: (token, amount)

Issue #770 - InvalidFactoryConfiguration Error

  • Added InvalidFactoryConfiguration = 20 error variant
  • Used for invalid factory initialization parameters
  • Provides clear diagnostic codes for CI/CD deployment scripts
  • Replaces generic Soroban errors with specific error codes

Issue #771 - Emergency Responder Role Authorization

  • New function: require_emergency_responder(caller)
  • Separates regular parameter tuning from emergency pause authority
  • Pauser role (or Admin as super-user) can execute pause/unpause
  • Improves security by limiting who can trigger emergency actions

Issue #772 - Voting Period Validation

  • Added VotingPeriodLedgers to DataKey enum
  • Added voting_period_ledgers field to GovernorConfig
  • Enforces minimum voting period of 17280 ledgers (~1 day)
  • set_voting_period() validates configuration changes
  • Prevents flash-loan voting attacks and gives DAO participants reaction time
  • Default minimum: 17280 ledgers per Soroban ledger close time

Affected Files

  • contracts/factory/src/events.rs - New protocol_fee_collected event
  • contracts/factory/src/errors.rs - New InvalidFactoryConfiguration error
  • contracts/governor/src/role.rs - New require_emergency_responder function
  • contracts/governor/src/config.rs - Voting period validation and constants
  • contracts/governor/src/storage.rs - VotingPeriodLedgers storage key

Closes #769
Closes #770
Closes #771
Closes #772

EmmanuelOchaje and others added 2 commits October 18, 2026 09:33
…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
…s, voting period)

**Issue conduit-protocol#769**: Add ProtocolFeeCollected event emission
- New event: protocol_fee_collected(token, recipient, amount)
- Allows indexers to track fee accumulation without scanning balance changes
- Topics: ("pfee_collected", recipient), Data: (token, amount)

**Issue conduit-protocol#770**: Add InvalidFactoryConfiguration error
- New error code: InvalidFactoryConfiguration = 20
- Diagnostic code for invalid factory initialization parameters
- Simplifies deployment verification in CI/CD scripts

**Issue conduit-protocol#771**: Add multi-role authorization checks for emergency responders
- New function: require_emergency_responder(caller)
- Separates regular parameter tuning from emergency pause authority
- Pauser role can execute pause/unpause operations (or Admin as super-user)

**Issue conduit-protocol#772**: Validate voting period bounds against Soroban ledger close time
- Add VotingPeriodLedgers to DataKey enum
- Add voting_period_ledgers field to GovernorConfig
- Enforce minimum voting period of 17280 ledgers (~1 day)
- Prevents flash-loan voting attacks and allows DAO reaction time
- set_voting_period() validates and enforces minimum during configuration

Closes conduit-protocol#769
Closes conduit-protocol#770
Closes conduit-protocol#771
Closes conduit-protocol#772
@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

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

…um definition

The VotingPeriodLedgers variant was incorrectly placed outside the DataKey enum
closing brace, causing a syntax error. Moved it inside the enum definition before
the closing brace.
@Jaydbrown
Jaydbrown merged commit 785d007 into conduit-protocol:main Oct 19, 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

3 participants