Skip to content

fix: bound pagination, extend oracle registration TTL, revalidate adm… - #294

Merged
nonsobethel0-dev merged 2 commits into
Parashield-Protocol:mainfrom
manoahLinks:fix/bounded-pagination-oracle-ttl-admin-withdrawal-224-227
Jul 30, 2026
Merged

fix: bound pagination, extend oracle registration TTL, revalidate adm…#294
nonsobethel0-dev merged 2 commits into
Parashield-Protocol:mainfrom
manoahLinks:fix/bounded-pagination-oracle-ttl-admin-withdrawal-224-227

Conversation

@manoahLinks

Copy link
Copy Markdown
Contributor

…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 #225 is already covered — no change needed there.

Closes #224
Closes #225
Closes #226
Closes #227

…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>
@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@nonsobethel0-dev
nonsobethel0-dev merged commit 57bd97f into Parashield-Protocol:main Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment