
Invariant-driven design: what a conservation law proves, and the dimension it cannot see
Known formally as Invariant-Driven Design in the BlazePhoenix whitepaper.
BlazePhoenix Engineering · updated 2026-07-29 · 9 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 — An invariant makes a forbidden state unreachable, not merely observable — but it only guards the dimension it measures. A correct invariant over the wrong axis passes forever while the real defect compounds, which is worse than no guard at all.
Português — Uma invariante torna um estado proibido inalcançável, não apenas observável — mas só protege a dimensão que mede. Uma invariante correta no eixo errado passa para sempre enquanto o defeito real se acumula, o que é pior que não ter guarda.
Español — Una invariante vuelve inalcanzable un estado prohibido, no solo observable — pero solo protege la dimensión que mide. Una invariante correcta en el eje equivocado pasa para siempre mientras el defecto real se acumula.
Français — Un invariant rend un état interdit inatteignable, pas seulement observable — mais il ne garde que la dimension qu'il mesure. Un invariant correct sur le mauvais axe passe toujours pendant que le vrai défaut s'accumule.
Deutsch — Ein Invariant macht einen verbotenen Zustand unerreichbar, nicht nur beobachtbar — aber er schützt nur die Dimension, die er misst. Ein korrekter Invariant auf der falschen Achse besteht ewig, während der echte Defekt wächst.
Русский — Инвариант делает запрещённое состояние недостижимым, а не просто наблюдаемым — но охраняет лишь то измерение, которое измеряет. Верный инвариант по неверной оси проходит вечно, пока настоящий дефект копится.
Türkçe — Bir değişmez, yasak bir durumu yalnızca gözlemlenebilir değil ulaşılamaz kılar — ama yalnızca ölçtüğü boyutu korur. Yanlış eksende doğru bir değişmez sonsuza dek geçerken gerçek kusur birikir.
العربية — الثابت يجعل الحالة المحظورة غير قابلة للوصول لا مجرد قابلة للرصد — لكنه يحرس فقط البُعد الذي يقيسه. ثابت صحيح على المحور الخطأ ينجح إلى الأبد بينما يتراكم العيب الحقيقي.
हिन्दी — एक इनवेरिएंट निषिद्ध स्थिति को केवल दृश्य नहीं, अगम्य बनाता है — पर वह केवल उसी आयाम की रक्षा करता है जिसे मापता है। गलत अक्ष पर सही इनवेरिएंट हमेशा पास होता है जबकि असली दोष बढ़ता रहता है।
日本語 — 不変条件は禁止状態を観測可能ではなく到達不能にします — が守るのは測る次元だけ。誤った軸の正しい不変条件は永遠に通り、真の欠陥は静かに蓄積します。
中文 — 不变量让禁止状态不可达,而非仅可观测——但它只守护它所度量的维度。错误轴上的正确不变量会永远通过,而真正的缺陷在下面不断累积。
한국어 — 불변식은 금지 상태를 관측 가능이 아니라 도달 불가능하게 만듭니다 — 그러나 측정하는 차원만 지킵니다. 잘못된 축의 올바른 불변식은 영원히 통과하고 진짜 결함은 쌓입니다.
Bahasa Indonesia — Invarian membuat keadaan terlarang tak terjangkau, bukan sekadar teramati — tetapi hanya menjaga dimensi yang diukurnya. Invarian benar pada sumbu yang salah lolos selamanya sementara cacat nyata menumpuk.
বাংলা — একটি ইনভেরিয়েন্ট নিষিদ্ধ অবস্থাকে কেবল পর্যবেক্ষণযোগ্য নয়, অগম্য করে — কিন্তু কেবল সেই মাত্রাকেই রক্ষা করে যা মাপে। ভুল অক্ষে সঠিক ইনভেরিয়েন্ট চিরকাল পাস করে অথচ আসল ত্রুটি জমতে থাকে।
Filipino — Ginagawang di-maabot, hindi lang nakikita, ng invariant ang bawal na estado — ngunit binabantayan lang nito ang sinusukat nitong dimensyon. Tamang invariant sa maling axis ay laging pumapasa habang lumalaki ang tunay na depekto.
An invariant is a property a system promises will hold no matter what any actor does: a statement of truth the code itself refuses to violate. In a smart contract it is enforced structurally — the transaction that would break it reverts, so the forbidden state is not merely observable, it is unreachable. This is a stronger guarantee than a test, which only shows the property held for the inputs someone thought to try. An invariant is the discipline of compute, do not trust, made mechanical: the system does not ask you to believe it is solvent, it makes insolvency a state it cannot enter.
The engineering question is not whether invariants are powerful — they are the strongest tool available on-chain — but what a given invariant actually promises, and, more importantly, what it is silent about. That silence is where the next defect lives.
Two families of tool, one hard requirement
The verification landscape splits cleanly. Property-based fuzzers — the invariant runners in Foundry, Echidna, Medusa — drive a contract through long random sequences of calls and check the property after each one. They are extraordinary at finding counterexamples, and most deployment-stage bugs are caught this way. But a fuzzer that never finds a violation has proven nothing: absence of a found counterexample is not a proof of absence. Its strength is falsification, not correctness.
The second family — symbolic checkers and formal provers such as Halmos and Certora — reasons over the entire range of valid inputs at once. When a property passes there, it holds for all inputs, not just the sampled ones; when it fails, the tool hands back the exact witness. This is proof rather than evidence, but it is bounded by state-space and specification limits, and it is expensive.
Both families share one requirement that no tool removes: a human must write the invariant. The machine checks the property you gave it, flawlessly, and says nothing about the property you did not. Every published catalogue of these tools ends on the same sentence — they still require someone to state the right invariant first. That sentence is the whole subject of this article.
The ephemeral case, where invariants are nearly complete
Consider a system that opens and closes inside a single transaction: an exact-input swap. It pulls an input, executes, pays an output, and returns to rest holding nothing. The state carries no history between calls; a defect has a window measured in one block and a blast radius that is local to that trade. For a system shaped like this, a small set of invariants is very close to complete.
The core one is per-transaction value conservation: snapshot the real balance and what the protocol owes before the body runs, and after it require that the change in the balance equals the change in what is owed, within a dust tolerance. Any transaction that itself leaks value fails; accumulated historical drift cancels out, so a legitimate action is never reverted for a books-are-a-few-wei-off reason. Pair it with a minimum-output floor that is re-derived on-chain from the real trade rather than read from caller-supplied data, and the manipulable surface shrinks to almost nothing.
What an invariant actually guarantees
Here is the load-bearing observation. An invariant guarantees exactly the dimension it measures, and nothing adjacent to it. A conservation invariant is a statement about QUANTITY: it answers how much value exists, and it answers it perfectly. It is completely silent about every other property the system might need to be true — who is owed that value, when it was earned, whether an authority can redirect it, whether an honest user can still exit.
This is not a weakness in a specific invariant; it is the nature of the tool. A correct invariant over the wrong axis passes on every block, forever, while the real defect compounds underneath it — and because the guard is green, nobody looks. A correct invariant that covers the wrong dimension gives false confidence, and false confidence is worse than none, because it stops you searching.
Why "the tests pass" is evidence, not proof
Coverage is not correctness. A suite that passes tells you the properties you wrote hold under the sequences you explored. It is genuine evidence and it should be demanded. But it is bounded twice over: by the inputs the fuzzer reached, and — the deeper bound — by the imagination of whoever chose the invariants. The bug that survives is almost never in the property you stated and tested; it is in the dimension you did not think to name, so no property was ever written to guard it.
For a system that lives in the instant, the set of dimensions is small enough that a disciplined team can enumerate it. The moment a system starts to carry state across time, that enumeration stops being complete — and a whole family of defects appears that a conservation law, however perfectly enforced, is structurally unable to detect. That is the subject of the companion piece.
Do not trust this page — reproduce it
Every claim above is checkable against the chain. Start here:
Take any conservation property and run it under a property-based fuzzer (Foundry/Echidna) — a pass means no counterexample was found in the explored sequences, never that none exists; then ask what dimension the property does NOT measure, because that is where the surviving defect livesContracts are verified on every chain we deploy to — addresses in the protocol manifest. Deeper formal treatment: the whitepaper (PDF). Standards cited: EIP-20
Share this article · join the discussion