Launch app
Cover: Staking that never goes rigid: clamp before revert

Staking that never goes rigid: clamp before revert

When the staking contract is paused, breached or in emergency, which actions still work, and where does it clamp a number instead of reverting?

A staking engine can fail in two ways: by letting a number run past its bound, or by jamming so that nobody can act. The V4 contract clamps its quantities to a bound and keeps a precise set of doors open in each state. This article lists both.

Known formally as Whitepaper 2.4, sections 25.2 and 25.11: entry-point gates and the circuit breaker in the BlazePhoenix whitepaper.

BlazePhoenix Engineering · article updated 2026-11-16 · site dataset through 2026-11-30 · 7 min · written from the deployed bytecode

By Mitra (@Sigmacrit) — anonymous developer of the BlazePhoenix protocol. The code is the résumé.

Abstract in 15 languages · resumo · resumen · 摘要 · 要旨 · ملخص

English — The V4 staking contract avoids rigidity in two ways: where a quantity could overshoot a bound it clamps to the bound with a minimum instead of reverting, and the doors that only make the book safer, such as repay and absorbBadDebt, stay open longer than the doors that add risk. The engine is pre-launch, so this describes the code as written, not a deployment.

Português — O contrato de staking V4 evita a rigidez de duas maneiras: onde uma grandeza poderia ultrapassar um limite, é limitada a esse limite com um mínimo em vez de reverter, e as portas que apenas tornam o livro mais seguro, como repay e absorbBadDebt, ficam abertas mais tempo do que as que acrescentam risco. O motor está em pré-lançamento, pelo que isto descreve o código tal como está escrito, não uma implementação.

Español — El contrato de staking V4 evita la rigidez de dos maneras: donde una magnitud podría rebasar un límite, se acota a ese límite con un mínimo en lugar de revertir, y las puertas que solo hacen el libro más seguro, como repay y absorbBadDebt, permanecen abiertas más tiempo que las que añaden riesgo. El motor está en prelanzamiento, así que esto describe el código tal como está escrito, no un despliegue.

Français — Le contrat de staking V4 évite la rigidité de deux façons : là où une grandeur pourrait dépasser une borne, il la plafonne à cette borne avec un minimum au lieu d'annuler, et les portes qui ne font que rendre le registre plus sûr, comme repay et absorbBadDebt, restent ouvertes plus longtemps que celles qui ajoutent du risque. Le moteur est en pré-lancement : ceci décrit le code tel qu'écrit, pas un déploiement.

Deutsch — Der V4-Staking-Vertrag vermeidet Starrheit auf zwei Wegen: Wo eine Größe eine Grenze überschreiten könnte, wird sie mit einem Minimum auf die Grenze begrenzt, statt zu revertieren, und die Türen, die das Buch nur sicherer machen, etwa repay und absorbBadDebt, bleiben länger offen als die, die Risiko hinzufügen. Die Engine ist vor dem Start; dies beschreibt den Code wie geschrieben, keine Bereitstellung.

Русский — Контракт стейкинга V4 избегает жёсткости двумя способами: там, где величина могла бы выйти за границу, она ограничивается этой границей через минимум вместо отката, а двери, которые лишь делают книгу безопаснее, например repay и absorbBadDebt, остаются открытыми дольше, чем двери, добавляющие риск. Движок ещё не запущен, так что это описание кода как он написан, а не развёртывания.

Türkçe — V4 staking kontratı katılaşmayı iki yolla önler: bir nicelik bir sınırı aşabilecekse geri almak yerine minimum ile o sınıra kıstırılır ve defteri yalnızca daha güvenli kılan kapılar, örneğin repay ve absorbBadDebt, risk ekleyen kapılardan daha uzun açık kalır. Motor lansman öncesindedir; bu yazı kodu yazıldığı haliyle anlatır, bir dağıtımı değil.

العربية — يتجنب عقد الستيكنغ V4 الجمود بطريقتين: حيث يمكن لكمية أن تتجاوز حدًّا فإنها تُقيَّد بالحد باستخدام الأدنى بدلاً من التراجع، وتبقى الأبواب التي تجعل الدفتر أكثر أمانًا فقط، مثل repay وabsorbBadDebt، مفتوحة مدة أطول من الأبواب التي تضيف مخاطرة. المحرك في مرحلة ما قبل الإطلاق، لذا يصف هذا الكود كما كُتب وليس نشرًا قائمًا.

हिन्दी — V4 स्टेकिंग कॉन्ट्रैक्ट दो तरह से कठोर होने से बचता है: जहाँ कोई राशि किसी सीमा को पार कर सकती है, वहाँ वह revert करने के बजाय minimum से उस सीमा तक सीमित कर दी जाती है, और जो दरवाज़े बही को केवल अधिक सुरक्षित बनाते हैं, जैसे repay और absorbBadDebt, वे जोखिम बढ़ाने वाले दरवाज़ों से अधिक देर खुले रहते हैं। इंजन लॉन्च-पूर्व है, इसलिए यह कोड का वर्णन है जैसा लिखा गया है, किसी डिप्लॉयमेंट का नहीं।

日本語 — V4 ステーキングコントラクトは二つの方法で硬直を避けます。量が上限を超えうる場所では revert せず minimum で上限に丸め、帳簿をより安全にするだけの扉、たとえば repay や absorbBadDebt は、リスクを加える扉より長く開いたままになります。エンジンはローンチ前なので、これは書かれたとおりのコードの説明であり、デプロイメントの説明ではありません。

中文 — V4 质押合约通过两种方式避免僵化:当某个量可能越过上限时,用 minimum 把它限制在上限,而不是回滚;而那些只会让账簿更安全的入口,例如 repay 和 absorbBadDebt,比增加风险的入口开放得更久。该引擎尚未上线,因此这里描述的是代码本身,而不是某个部署。

한국어 — V4 스테이킹 컨트랙트는 두 가지 방식으로 경직을 피합니다. 어떤 양이 한도를 넘을 수 있는 곳에서는 revert하는 대신 minimum으로 한도에 맞춰 제한하고, repay와 absorbBadDebt처럼 장부를 더 안전하게만 만드는 문은 위험을 더하는 문보다 오래 열려 있습니다. 엔진은 출시 전이므로 이는 배포가 아니라 작성된 코드를 설명합니다.

Bahasa Indonesia — Kontrak staking V4 menghindari kekakuan dengan dua cara: di mana suatu besaran bisa melampaui batas, besaran itu dijepit ke batas dengan minimum alih-alih revert, dan pintu yang hanya membuat buku lebih aman, seperti repay dan absorbBadDebt, tetap terbuka lebih lama daripada pintu yang menambah risiko. Mesin ini pra-peluncuran, jadi ini menjelaskan kode sebagaimana ditulis, bukan sebuah deployment.

বাংলা — V4 স্টেকিং কন্ট্র্যাক্ট দুইভাবে অনমনীয়তা এড়ায়: যেখানে কোনো রাশি সীমা ছাড়িয়ে যেতে পারে, সেখানে revert না করে minimum দিয়ে তাকে সীমায় আটকে দেয়, আর যে দরজাগুলো বইকে কেবল আরও নিরাপদ করে, যেমন repay ও absorbBadDebt, সেগুলো ঝুঁকি বাড়ানো দরজার চেয়ে বেশি সময় খোলা থাকে। ইঞ্জিনটি চালুর আগের পর্যায়ে, তাই এটি লেখা কোডের বর্ণনা, কোনো ডিপ্লয়মেন্টের নয়।

Filipino — Iniiwasan ng V4 staking contract ang pagiging matigas sa dalawang paraan: kung saan maaaring lumampas ang isang dami sa hangganan, nililimitahan ito sa hangganan gamit ang minimum sa halip na mag-revert, at ang mga pintuang nagpapaligtas lamang sa libro, tulad ng repay at absorbBadDebt, ay nananatiling bukas nang mas matagal kaysa sa mga nagdaragdag ng panganib. Pre-launch pa ang engine, kaya inilalarawan nito ang code gaya ng nakasulat, hindi isang deployment.

Short answer: the contract does two things, and neither is a promise that every function works in every state. First, where a quantity could overshoot a bound, it is clamped to the bound with a minimum, so an edge case does not turn into an overflow or an overpayment. Second, the doors that only make the book safer stay open longer than the doors that add risk. Which doors those are is written in a table, and the table is what this article reads.

The staking engine is pre-launch, so this describes the behaviour of the code as written in the repository, not a deployment.

The doors and the three states

The whitepaper (section 25.2) gives each entry point and its state in three conditions: a guardian pause, an emergency, and a hard breach, which is the state in which the BZPX the contract holds plus dust is below what it owes. The rows that matter for recovery are these.

Entry pointPausedEmergencyHard breach
withdraw (unstake)openclosedclosed
repayopenclosedopen
liquidateclosedclosedopen
absorbBadDebtopenopenopen
emergencyWithdrawn/athe only exitn/a
deposit, borrowclosedclosedclosed

Source: Whitepaper 2.4, section 25.2 entry-point table and section 25.11 (staking repository at commit c0366cf).

The principle behind the table

The paper states it in one sentence: closing debt only makes the book safer. That is why `repay` stays open under a pause and under a hard breach, and why `withdraw` stays open under a pause: a pause halts new risk without trapping anyone. In a hard breach the contract refuses doors that would pay out at par from a pot that may be short, which is why `withdraw` is closed there, while `repay`, `liquidate` and `absorbBadDebt` stay open because each of them reduces what is owed or brings value in.

The table also shows what is not open. In an emergency, `repay` and `liquidate` are closed, and `emergencyWithdraw` is the only exit: it pays net equity, scaled pro rata if the contract holds less than the positions are owed. A pause closes `liquidate`. The hard-breach column describes the book before anyone trips the breaker: a trip enters emergency mode, and from then on the emergency column applies. Reading that as 'recovery always works' would be wrong: recovery works through the doors the table lists, in the states it lists.

Where it clamps instead of reverting

The numbers below are the minimum-style bounds that the equations of section 25 apply.

QuantityBound appliedEquation
Emission timetime is clamped to the emission endE27, window
Window rewardminimum of the scheduled amount and the reward reservewindow reward
Lock lengthat most the days left until the emission endsection 25.2
Seized stake in a liquidationminimum of debt plus a 500 bps bonus and the stakeE39
Recapitalisationminimum of the reserve plus the caller's offer and what is still uncoveredE38
Emergency payoutnet equity, scaled pro rata if the pot is short, never above the potE40
Borrowat most 50 % of net stake, and 75 % utilisation of the bookE41

Source: Whitepaper 2.4, section 25. The liquidation threshold is 95 % of stake.

Reading the clamps together

A clamp turns a boundary case into a smaller number, not an exception. A liquidation whose debt exceeds the stake seizes the whole stake and sends the remainder to the loss waterfall, first the protocol reserve and then recorded bad debt, and does not revert. An emergency exit on a short pot pays a fraction of the claim instead of failing. A window in which the reward reserve is lower than the schedule pays what the reserve holds.

A revert remains the right answer for a door that should be closed in that state. The difference is that the closed doors are the ones that add risk or pay at par, and the clamped paths are the ones that settle losses and unwind positions.

What the breaker test pins

A permissionless trip is safe only if it cannot fire on a healthy book. The stateful test `invariant_INV20_breakerCannotTripWhileSound`, in InvariantsFullSurface.t.sol of the staking suite, checks that property. The reasoning behind it: nobody can lower the contract's balance except through flows that lower what it owes by the same amount, and donations only raise the balance, so the trip condition can fire only on a real shortfall. The worst a spurious trip could do is a temporary pause that the admin can undo.

  1. Open the entry-point table in section 25.2 and mark repay and liquidate in each of the three states.
  2. Find where each clamp sits in the staking source by name: the window reward, the liquidation seizure, the recapitalisation and the emergency payout.
  3. Run the breaker test named above and read what it asserts: across the run, while the book stays sound, no call to `tripBreaker` succeeds.

What this does not claim

It does not say that every function is callable in every state, and it does not say that a clamp removes a loss: the haircut is the contract's rule for dividing a loss, not a promise to avoid one. It describes the code as written for a launch that has not happened.

Do not trust this page — reproduce it

Every claim above is checkable against the chain. Start here:

In the staking repository at commit c0366cf, run the stateful test invariant_INV20_breakerCannotTripWhileSound (InvariantsFullSurface.t.sol), then read the entry points repay, liquidate, withdraw and absorbBadDebt and their pause, emergency and breach gates against the table above. Reading: sections 25.2 and 25.11 of the 2.4 whitepaper.
Cite this article

Licensed CC BY-NC-ND 4.0: quote and cite it with attribution and a link. Commercial use and derivative versions need written permission from BlazePhoenix; translations are made by BlazePhoenix. Copy a ready-made citation:

BlazePhoenix (2026). Staking that never goes rigid: clamp before revert. BlazePhoenix Engineering. https://blazephoenix.xyz/learn/staking-that-never-goes-rigid/
@misc{blazephoenix_staking_that_never_goes_rigid,
  title  = {Staking that never goes rigid: clamp before revert},
  author = {BlazePhoenix},
  year   = {2026},
  url    = {https://blazephoenix.xyz/learn/staking-that-never-goes-rigid/},
  note   = {Accessed: reproduce the claim with the command above}
}

Writing an answer, a wiki entry or a paper? The claim above is reproducible against the chain before you quote it — which is the only sound basis for citing a technical source at all.

Contracts are verified on every chain we deploy to — addresses in the protocol manifest. Deeper formal treatment: the whitepaper (PDF).

Related engineering

Next in Staking & yield · 1 / 5
$BZPX: the token, the contract, and how to verify every claim about it ›The BZPX token in verifiable facts: why no token address is published yet, the fixed 8-year staking emission, its role in staking and the aggregator, and the on-chain functions that let anyone check the numbers without trusting the team.5 min

Questions, a partnership or a bug to report? Contact us or email contact@blazephoenix.xyz

Go to APP