连接
Cover: Master Conservation Identity:让隐藏的缺口无法触及,而不只是可被观察

Master Conservation Identity:让隐藏的缺口无法触及,而不只是可被观察

译文 · 如有冲突,以英文版本为准。 阅读英文原文 ›

质押合约如何让隐藏的缺口无法触及?

整个质押账簿所遵守的一个等式——余额 + badDebt = 净本金 + 准备金 + 已累计未支付的部分——由 conserves 守卫在每笔交易中强制执行。会泄漏价值的交易会自行 revert。

BlazePhoenix Engineering · article updated 2026-07-17 · site dataset through 2026-11-19 · 7 min · written from the deployed bytecode

概览
阅读时间7 min
章节4
更新于2026-07-17

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

大多数 DeFi 协议能够告诉你它们何时变得资不抵债。BlazePhoenix 的质押引擎则被构建成:隐藏的缺口根本无法被触及——每一个转移价值的入口都在 conserves 守卫内运行,该守卫在调用前对合约的真实代币余额及其账本义务做快照,如果两者的变化相差超过 dust(1e-8 BZPX),就 revert 整笔交易。一个会让账本声称多于合约所持有的 bug,不会产生日后才被检测到的坏状态——它当场产生一次 revert。

义务一侧是一个等式,即 Master Conservation Identity:balanceOf(this) + totalBadDebt = (totalStaked − totalDebt) + rewardReserve + protocolReserve + (rewardsDistributed − rewardsPaid)。右侧是合约所欠之数;偿付能力就是简单的 balance ≥ owed。每一项公开证明——isSolvent()、solvency()、collateralRatio()、auditInvariants()——都是对这个等式从存储中的重新读取。

每笔交易的增量,而不是绝对状态

守卫比较的是变化量,而不是总量:Δbalance 必须在 dust 范围内等于 Δowed。这个区别消除了一整类失败模式——因不变量导致的 DoS。如果守卫要求绝对的恒等式必须成立,那么几 wei 的历史舍入漂移就可能让所有用户永远无法操作。增量守恒让诚实用户可以在任何累积的 dust 之上进行交易,同时仍能抓住唯一重要的事:一笔自身泄漏价值的交易。

而且,由于守卫在每一次存入、借款、还款、提取和领取时都会运行,守恒既不需要 keeper,也不需要监控,更不需要多签的反应时间。能发现盗窃的机制,就是正在执行盗窃的那笔交易本身——而它投下的是 revert 一票。

无需许可的断路器

如果无论如何仍出现了真正的缺口(合约之外的代币层面故障),tripBreaker() 允许任何人暂停协议——但只有当链本身证明发生了违约(真实余额 + dust < owed)时才行。该条件是客观且无法伪造的:除了通过同等降低 owed 的流转之外,没有人能降低余额,而捐赠只会抬高余额。在健康状态下,虚假触发是不可能的,而一次短暂的触发可由管理员撤销。把它与团队可以凭传闻按下、或在发生盗窃时拒绝按下的暂停按钮相比较。

作为等式的恒等式

整个账簿就是一条守恒定律:合约的真实代币余额 B 加上任何已记录的坏账,等于净本金(质押 S 减去借出 D)加上奖励与协议准备金,再加上已累计但尚未支付的奖励。偿付能力不过是左侧足以清偿义务——而守卫在每个转移价值的调用上强制执行其增量形式,因此泄漏会自行 revert:

B+Dbad=(S−D)+Rrew+Rproto+(Edist−Epaid),ΔB=Δowed
为 BlazePhoenix 原创(Staking._owed / conserves,dust 容差 1e-8 BZPX)。守卫比较的是变化量,而不是总量——既消除了因不变量导致的 DoS,又仍能抓住唯一重要的那笔交易:泄漏价值的交易。isSolvent() ⇔ B ≥ owed,每个区块都可免费读取。这里的偿付能力不是仪表盘上的承诺,而是一个以 revert 作保镖的算术恒等式。

不要轻信本页,请自行复现

上文的每一项主张都可以在链上核查。从这里开始:

cast call <staking> "solvency()((uint256,uint256,uint256,uint256,bool,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint256))" --rpc-url https://mainnet.base.org — re-derive the identity term by term
引用本文

采用 CC BY-NC-ND 4.0 许可:引用时请注明出处并附链接。商业使用和衍生版本须获得 BlazePhoenix 的书面许可;译文由 BlazePhoenix 提供。 Copy a ready-made citation:

BlazePhoenix (2026). Master Conservation Identity:让隐藏的缺口无法触及,而不只是可被观察. BlazePhoenix Engineering. https://blazephoenix.xyz/zh/learn/master-conservation-identity/
@misc{blazephoenix_master_conservation_identity,
  title  = {Master Conservation Identity:让隐藏的缺口无法触及,而不只是可被观察},
  author = {BlazePhoenix},
  year   = {2026},
  url    = {https://blazephoenix.xyz/zh/learn/master-conservation-identity/},
  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).

相关工程文章

Next in Invariants & security · 16 / 18
Zero-custody trading bots: an SDK pattern where the bot never touches funds ›The @blazephoenix/sdk pattern for Telegram and Discord bots: the bot quotes and builds the transaction, the USER signs in their own wallet via a deep link — no private keys on the server, no custody, no license burden.5 min

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

Go to APP