Skip to content

fix(config): bound cooldown_slots above to prevent permanent withdrawal lock (closes #121) - #132

Closed
1Jarvis42069 wants to merge 1 commit into
dcccrypto:mainfrom
1Jarvis42069:fix/cooldown-slots-upper-bound
Closed

fix(config): bound cooldown_slots above to prevent permanent withdrawal lock (closes #121)#132
1Jarvis42069 wants to merge 1 commit into
dcccrypto:mainfrom
1Jarvis42069:fix/cooldown-slots-upper-bound

Conversation

@1Jarvis42069

Copy link
Copy Markdown
Contributor

Closes #121.

validate_cooldown_slots (src/processor.rs) only rejected cooldown_slots == 0. An admin could set cooldown_slots = u64::MAX via InitPool or UpdateConfig; in process_withdraw, deposit.last_deposit_slot.saturating_add(pool.cooldown_slots) then yields u64::MAX, a deadline clock.slot can never reach — permanently freezing all withdrawals.

This adds an upper bound MAX_COOLDOWN_SLOTS = 78_840_000 (~1 year at ~2.5 slots/sec) — long enough for any realistic withdrawal cooldown, but finite so a permanent lock is impossible. It's enforced on both paths that set the value (process_init_pool and process_update_config both call validate_cooldown_slots).

cargo check passes. (The exact cap is easy to adjust if you prefer a different ceiling.)

…al lock (closes dcccrypto#121)

validate_cooldown_slots only rejected 0. An admin could set cooldown_slots = u64::MAX
via InitPool or UpdateConfig; process_withdraw's saturating_add then yields a deadline
clock.slot can never reach, permanently freezing all withdrawals.

Add an upper bound (~1 year of slots ≈ 78.84M) — long enough for any realistic
cooldown, finite enough to rule out a permanent lock. Enforced on both the InitPool
(L288) and UpdateConfig (L1192) paths, which both call validate_cooldown_slots.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Nullguy42069, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 49 minutes and 52 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c7a77e7d-efb3-49a4-a589-ae82ed904893

📥 Commits

Reviewing files that changed from the base of the PR and between 1bee206 and ef78f7c.

📒 Files selected for processing (1)
  • src/processor.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dcccrypto

Copy link
Copy Markdown
Owner

Integrated into main via #142 (MAX_COOLDOWN_SLOTS upper bound). Cherry-picked cleanly with attribution. Closes #121. Thanks!

@dcccrypto dcccrypto closed this Jun 17, 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

Development

Successfully merging this pull request may close these issues.

config: no upper bound on cooldown_slots allows admin to permanently lock withdrawals

2 participants