Skip to content

feat(staking-vault): add early-exit penalty and unbonding cooldown - #1784

Merged
Olowodarey merged 2 commits into
Arena1X:mainfrom
Devsol-01:main
Aug 30, 2026
Merged

feat(staking-vault): add early-exit penalty and unbonding cooldown#1784
Olowodarey merged 2 commits into
Arena1X:mainfrom
Devsol-01:main

Conversation

@Devsol-01

Copy link
Copy Markdown
Contributor

Summary

This PR adds an unbonding cooldown and configurable early-exit penalty to the staking vault.

Previously, stakers could unlock and withdraw their funds immediately, allowing them to enter and exit around reward snapshots without any cooldown or penalty. This could dilute rewards for stakers who remain in the vault.

Changes

  • Added a configurable unbonding cooldown for unlocked positions.
  • Added pending-unlock timestamp tracking per staking position.
  • Prevented withdrawals before the configured cooldown period unless the configured early-exit behavior allows them.
  • Added configurable early-exit penalties in basis points.
  • Routed collected penalties through the vault fee handling.
  • Added checked arithmetic for penalty and withdrawal calculations.
  • Added WithdrawalLocked error for withdrawals attempted before the cooldown expires.
  • Added InvalidPenaltyConfig error for invalid penalty configurations.
  • Rejected penalty configurations greater than 10,000 bps.
  • Updated staking storage types to track pending unlock state.
  • Added tests covering cooldown, penalties, fee routing, and invalid configurations.

Testing

  • Tested unlocking a staking position and verifying the pending-unlock timestamp.
  • Tested withdrawal before the cooldown expires.
  • Tested early withdrawal penalty calculation.
  • Tested penalty-free withdrawal after the cooldown expires.
  • Tested penalty routing through the fee mechanism.
  • Tested invalid penalty configurations above 10,000 bps.
  • Tested checked arithmetic for penalty and withdrawal calculations.
  • Verified existing staking and reward behavior remains intact.

Acceptance Criteria

  • Unbonding cooldown is enforced before penalty-free withdrawal.
  • Pending-unlock timestamps are stored per position.
  • Early exits are penalized according to the configured penalty.
  • Penalties are routed through the fee mechanism.
  • Withdrawals after the cooldown are penalty-free.
  • Penalty configurations above 10,000 bps are rejected.
  • Withdrawal and penalty edge cases are covered by tests.

Related Issue

Closes #1759

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
insight-arena-4rll Ready Ready Preview Aug 29, 2026 10:54pm

@Olowodarey
Olowodarey merged commit f9abf74 into Arena1X:main Aug 30, 2026
4 checks passed
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.

[Contracts] staking-vault: Early-exit penalty + unbonding cooldown

2 participants