Skip to content

fix: validation guards for #621, #622, #623, #624 - #660

Merged
nonsobethel0-dev merged 2 commits into
Parashield-Protocol:mainfrom
jajafwangshak86-ops:fix/issues-621-622-623-624
Sep 27, 2026
Merged

nonsobethel0-dev merged 2 commits into
Parashield-Protocol:mainfrom
jajafwangshak86-ops:fix/issues-621-622-623-624

Conversation

@jajafwangshak86-ops

Copy link
Copy Markdown
Contributor

Summary

Closes #621
Closes #622
Closes #623
Closes #624


#621 — RiskPool share calculation underflow

transfer_position: Added a ZeroAmount guard immediately after the shares * deposited / shares calculation. When a pool has absorbed claim losses, from_pos.deposited can be eroded while from_pos.shares stays constant, causing integer-truncation division to yield 0. Without this guard, an LP's shares would be burned without any capital being transferred.

withdraw_inner: Annotated the existing ZeroAmount guard with the issue reference.

deposit: Annotated the second-branch share calculation with a truncation comment so the existing MIN_SHARES guard's purpose is clear.


#622 — ClaimsProcessor payout delay not validated

set_payout_delay: Although delay_seconds is u64 and cannot be negative at the type level, no upper bound existed — an admin could set an arbitrarily large delay effectively locking payouts forever. Added MAX_PAYOUT_DELAY = 90 days. The zero sentinel (immediate payout) remains valid.


#623 — PolicyEngine duration not checked against max_duration_days

buy_policy_inner: The existing duration_days > max_duration_days check is correct, but the issue asked for an explicit guard on the computed (end_time - start_time) span. Added a post-calculation defense-in-depth check: end_time.saturating_sub(start_time) > max_duration_days * 86_400 → DurationTooLong. This is particularly important for buy_policy_scheduled where start_time != now.


#624 — OracleVerifier min_submit_interval allows zero

set_min_submit_interval: Added a seconds == 0 rejection. A zero interval disables the per-oracle rate-limit entirely, allowing any registered oracle to flood the contract with unlimited submissions per block, exhausting storage and instruction budget.


Testing

The three modified contracts (risk-pool, claims-processor, policy-engine) compile cleanly. The oracle-verifier has pre-existing build failures on main (missing StaleThreshold/StaleCount StorageKey variants — unrelated to this PR).

…-Protocol#622, Parashield-Protocol#623, Parashield-Protocol#624

Parashield-Protocol#621 RiskPool share calculation underflow
- transfer_position: add ZeroAmount guard after shares*deposited/shares
  calculation -- prevents burning shares without returning capital when
  deposited has been eroded by claim losses
- withdraw_inner: annotate existing ZeroAmount guard with issue reference
- deposit: annotate integer-truncation comment on second-branch share calc

Parashield-Protocol#622 ClaimsProcessor payout delay not validated
- set_payout_delay: add MAX_PAYOUT_DELAY (90 days) upper bound so an
  admin cannot lock payouts indefinitely; 0 (immediate) remains valid

Parashield-Protocol#623 PolicyEngine duration exceeds max_duration_days not checked
- buy_policy_inner: add explicit comment tying the duration_days >
  max_duration_days guard to this issue
- buy_policy_inner: add post-calculation defense-in-depth check that
  (end_time - start_time) <= max_duration_days * 86400, catching any
  future code path that bypasses the parameter check

Parashield-Protocol#624 OracleVerifier min_submit_interval allows zero
- set_min_submit_interval: reject seconds == 0; a zero interval removes
  the per-oracle rate-limit entirely and allows oracle spam
@drips-wave

drips-wave Bot commented Sep 27, 2026

Copy link
Copy Markdown

@jajafwangshak86-ops 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 30f9c53 into Parashield-Protocol:main Sep 27, 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

2 participants