feat: implement issues #230, #229, #231, #232 - #316
Open
Macnelson9 wants to merge 2 commits into
Open
Conversation
…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.
|
@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! 🚀 |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements 4 interconnected protocol improvements:
ProtocolConfig#229: Fix stale-constant view functions to read live ProtocolConfigTotalBondedaggregate running counter #231: Add TotalBonded aggregate counter for bond utilization metricsChanges
Issue #230: Per-solver max-active-intents cap
max_active_intents_per_solverto ProtocolConfig (admin-configurable)accept_intentnow checks cap before accepting new intentsMaxActiveIntentsCapReachederror when solver at capget_max_active_intents_per_solver()view for integratorsIssue #229: Fix stale-constant view functions
get_protocol_params()now reads from live ProtocolConfig instead of constantsget_min_bond()now reads from live config instead of MIN_BOND constantget_adjusted_min_bond()uses live config.min_bond instead of constantIssue #231: Add TotalBonded aggregate counter
DataKey::TotalBondedinstance-storage counter (i128)register_solverwhen bond is depositedwithdraw_bond,deregister_solver,slash_solverget_total_bonded()viewtotal_bondedfield toProtocolHealthstructIssue #232: Add deadline-adjusted intent status view
get_effective_intent_state(intent_id)view functionExpiredfor Open/PartiallyFilled intents past deadlineexpire_intent(now >= deadline = expired)Infrastructure additions
Added missing constants, DataKey variants, and error codes required by all issues:
Constants:
DataKey variants:
Error codes:
Testing
All implementations follow existing patterns in the contract:
Closes
Closes #230
Closes #229
Closes #231
Closes #232