fix: bound pagination, extend oracle registration TTL, revalidate adm… - #294
Merged
nonsobethel0-dev merged 2 commits intoJul 30, 2026
Conversation
…in withdrawal policy-engine: `get_user_policies` clamped `limit` only against the list length, so `limit = u32::MAX` forced the contract to build a Vec of every policy for a user in a single call and blow the instruction budget. Add `MAX_PAGE_SIZE = 100` and clamp `limit` to it; also use `saturating_add` for the end index. There is no `get_all_products` in this contract — `get_active_products` takes no pagination arguments and so is unaffected. oracle-verifier: oracle registrations were written to persistent storage with no TTL extension, so a registration would silently expire after ~20 quiet days and the next submission would fail with `OracleNotRegistered`. Extend the registration entry's TTL in `add_oracle`, `submit_data`, `submit_data_batch`, and `batch_submit_data`, using the same TTL_THRESHOLD / TTL_EXTEND_TO values as the other contracts. risk-pool: `execute_admin_withdrawal` only checked the timelock, so capital locks created during the 7-day wait could shrink available liquidity below the requested amount and the execution would drain funds earmarked as policy collateral. Re-check `get_available_liquidity()` against the request amount at execution time, reading fresh TotalDeposited/TotalLocked. `withdraw` already emits a `liquidity_withdrawn` / `LiquidityWithdrawn` event with provider, shares burned, and amount returned, so the monitoring gap in Parashield-Protocol#225 is already covered — no change needed there. Closes Parashield-Protocol#224 Closes Parashield-Protocol#225 Closes Parashield-Protocol#226 Closes Parashield-Protocol#227 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
@manoahLinks 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! 🚀 |
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.
…in withdrawal
policy-engine:
get_user_policiesclampedlimitonly against the list length, solimit = u32::MAXforced the contract to build a Vec of every policy for a user in a single call and blow the instruction budget. AddMAX_PAGE_SIZE = 100and clamplimitto it; also usesaturating_addfor the end index. There is noget_all_productsin this contract —get_active_productstakes no pagination arguments and so is unaffected.oracle-verifier: oracle registrations were written to persistent storage with no TTL extension, so a registration would silently expire after ~20 quiet days and the next submission would fail with
OracleNotRegistered. Extend the registration entry's TTL inadd_oracle,submit_data,submit_data_batch, andbatch_submit_data, using the same TTL_THRESHOLD / TTL_EXTEND_TO values as the other contracts.risk-pool:
execute_admin_withdrawalonly checked the timelock, so capital locks created during the 7-day wait could shrink available liquidity below the requested amount and the execution would drain funds earmarked as policy collateral. Re-checkget_available_liquidity()against the request amount at execution time, reading fresh TotalDeposited/TotalLocked.withdrawalready emits aliquidity_withdrawn/LiquidityWithdrawnevent with provider, shares burned, and amount returned, so the monitoring gap in #225 is already covered — no change needed there.Closes #224
Closes #225
Closes #226
Closes #227