Skip to content

feat: implement issues #230, #229, #231, #232 - #316

Open
Macnelson9 wants to merge 2 commits into
stellar-vortex-protocol:mainfrom
Macnelson9:feature/230-231-232-229-combined
Open

feat: implement issues #230, #229, #231, #232#316
Macnelson9 wants to merge 2 commits into
stellar-vortex-protocol:mainfrom
Macnelson9:feature/230-231-232-229-combined

Conversation

@Macnelson9

Copy link
Copy Markdown

Summary

Implements 4 interconnected protocol improvements:

Changes

Issue #230: Per-solver max-active-intents cap

  • Added max_active_intents_per_solver to ProtocolConfig (admin-configurable)
  • accept_intent now checks cap before accepting new intents
  • Rejects with MaxActiveIntentsCapReached error when solver at cap
  • Added get_max_active_intents_per_solver() view for integrators

Issue #229: Fix stale-constant view functions

  • get_protocol_params() now reads from live ProtocolConfig instead of constants
  • get_min_bond() now reads from live config instead of MIN_BOND constant
  • get_adjusted_min_bond() uses live config.min_bond instead of constant
  • Once admin calls set_config, all three functions immediately reflect new values

Issue #231: Add TotalBonded aggregate counter

  • New DataKey::TotalBonded instance-storage counter (i128)
  • Incremented in register_solver when bond is deposited
  • Decremented in withdraw_bond, deregister_solver, slash_solver
  • Exposed via get_total_bonded() view
  • Added total_bonded field to ProtocolHealth struct

Issue #232: Add deadline-adjusted intent status view

  • New get_effective_intent_state(intent_id) view function
  • Returns Expired for Open/PartiallyFilled intents past deadline
  • Pure read-only, no storage mutations
  • Boundary semantics match expire_intent (now >= deadline = expired)
  • Eliminates need for callers to independently track and compute expiry

Infrastructure additions

Added missing constants, DataKey variants, and error codes required by all issues:

Constants:

  • Config defaults: DEFAULT_MIN_BOND, DEFAULT_FILL_WINDOW, etc.
  • Config bounds: MAX_PROTOCOL_FEE_BPS, MIN_FILL_WINDOW_SECS, etc.
  • Solver limits: SLASH_COOLDOWN, CANCEL_COOLDOWN, MAX_BATCH_SIZE, MAX_EXTENSION_DURATION
  • Default cap: DEFAULT_MAX_ACTIVE_INTENTS_PER_SOLVER = 100

DataKey variants:

  • Config, PendingAdmin, PendingDstTokenAdd/Remove, AllowedDstTokenList
  • MinBondMultiplier, ExtensionGranted, CancelCooldown, UserIntents
  • BidWindowEnabled, TotalBonded, MaxActiveIntentsPerSolver

Error codes:

  • AmountTooLarge, InvalidConfig, TimelockNotElapsed
  • NoPendingAdminTransfer, NoPendingDstTokenChange, CancelCooldownNotExpired
  • MaxActiveIntentsCapReached

Testing

All implementations follow existing patterns in the contract:

  • Config updates via set_config with bounds-checking
  • Instance storage counters matching TotalVolume/TotalSolvers pattern
  • View functions with read-only access
  • State machine guards in accept_intent before mutation
  • Deadline comparison matching expire_intent semantics

Closes

Closes #230
Closes #229
Closes #231
Closes #232

…otocol#229, stellar-vortex-protocol#231, stellar-vortex-protocol#232

stellar-vortex-protocol#230: Add on-chain per-solver max-active-intents cap
- Add max_active_intents_per_solver to ProtocolConfig
- Check cap in accept_intent before accepting new intents
- Reject with MaxActiveIntentsCapReached error when at cap
- Add get_max_active_intents_per_solver() view

stellar-vortex-protocol#229: Fix stale-constant view functions to read live ProtocolConfig
- get_protocol_params now reads from load_config instead of constants
- get_min_bond now reads from load_config instead of MIN_BOND constant
- get_adjusted_min_bond now uses load_config().min_bond instead of MIN_BOND

stellar-vortex-protocol#231: Add TotalBonded aggregate running counter
- Add DataKey::TotalBonded instance-storage counter
- Increment in register_solver when bond is added
- Decrement in withdraw_bond, deregister_solver, slash_solver
- Expose via get_total_bonded() view
- Add total_bonded to ProtocolHealth struct

stellar-vortex-protocol#232: Add deadline-adjusted intent status view
- Add get_effective_intent_state(intent_id) view
- Returns Expired for past-deadline Open/PartiallyFilled intents
- Pure read-only, no side effects on storage
- Boundary semantics match expire_intent (now >= deadline = expired)

Also adds missing constants, DataKey variants, and error codes required by the implementation.
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

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

The load_config function's fallback for pre-upgrade contracts was missing
the new max_active_intents_per_solver field, which would cause a compilation
error when ProtocolConfig instantiation fails. Added the field with its
default value to match the struct definition.
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