---
eip: 7716
label: EIP-7716
title: Anti-Correlation Attestation Penalties
status: Draft
type: Standards Track
category: Core
created: 2024-05-25
official: https://eips.ethereum.org/EIPS/eip-7716
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7716.md
canonical: https://eips.huatuo.xyz/zh/eip-7716/
lang: zh
tldr: 共识层变更草案：当大量验证者同时离线时，成倍放大漏证明（attestation）的惩罚，使相关性高的部署（同一云、客户端或运营者）比独立的个人质押者付出更多。
tags: [consensus, staking, penalties, decentralization, validators]
---

# EIP-7716: Anti-Correlation Attestation Penalties

> Scales penalties for fully-offline validators by the excess of concurrently offline stake over its trailing average

**TL;DR:** 共识层变更草案：当大量验证者同时离线时，成倍放大漏证明（attestation）的惩罚，使相关性高的部署（同一云、客户端或运营者）比独立的个人质押者付出更多。

## 它解决什么问题？

如今，漏掉一次证明的验证者，无论是单独失败，还是与三分之一的网络一起失败，付出的惩罚都一样。因此几乎没有经济动机去在客户端、云、地区或机器之间分散部署。在同一套基础设施上运行数千个验证者的大型运营者，不会为这种集中承担任何额外成本。

相关性其实已经有定价，但仅限于超过三分之一质押量离线、inactivity leak 开始生效的情形。低于这个阈值，协议对相关性视而不见。EIP-7716 为大约 1 %–33 % 区间内的相关性故障增加了一个平滑的价格。

## 它如何运作

- 某个验证者在一个 epoch 中，如果**既没有**及时的 source 标志，**也没有**及时的 target 标志，就被视为**离线**。投了错误 target 但 source 及时的验证者是在线的，因此不算离线。
- 对上一个 epoch 的每个 slot，信标链把该 slot 委员会中离线验证者的有效余额加总，得到**离线余额**。
- 状态新增一个字段 `smoothed_offline_balance`，它是该数值的指数移动平均，半衰期约为 6.3 天。
- 每个 slot 有一个**惩罚系数**：

```python
excess = max(offline_balance - smoothed_offline_balance, 0)
penalty_factor = min(1 + PENALTY_SLOPE * excess // per_slot_active_balance,
                     MAX_PENALTY_FACTOR)      # 765 and 256 in the draft
```

- 只有离线验证者的**及时 target 惩罚**会乘以这个系数。source 惩罚、奖励、提议者和同步委员会的支付以及 inactivity leak 都不变。

由于平均值会随时间追上来，相关性故障刚开始时系数最高，持续下去则逐渐衰减。这个设计惩罚的是"相关"，而不是"恢复得慢"，后者对小型运营者打击更大。正常情况下，该系数恰好为 1。

## 示例代码

按草案常量编写的、计算每个 slot 系数的 TypeScript 示意代码：

```ts
const MAX_PENALTY_FACTOR = 256n;
const PENALTY_SLOPE = 765n;           // 3 * (MAX_PENALTY_FACTOR - 1)
const SMOOTHING = 65536n;             // 2**16

export function slotPenaltyFactor(
  offline: bigint,        // gwei offline in this slot's committees
  smoothed: bigint,       // current moving average (gwei)
  totalActive: bigint,    // total active balance (gwei)
  slotsPerEpoch = 32n,
): { factor: bigint; nextSmoothed: bigint } {
  const excess = offline > smoothed ? offline - smoothed : 0n;
  const ref = totalActive / slotsPerEpoch;
  let factor = 1n + (PENALTY_SLOPE * excess) / ref;
  if (factor > MAX_PENALTY_FACTOR) factor = MAX_PENALTY_FACTOR;
  const nextSmoothed = offline > smoothed
    ? smoothed + (offline - smoothed) / SMOOTHING
    : smoothed - (smoothed - offline) / SMOOTHING;
  return { factor, nextSmoothed };
}
```

在这些常量下，当超出量恰好等于每个 slot 质押量的三分之一时，系数正好达到上限 256，此后由 inactivity leak 接管。

## 需要注意

- 状态为 **Draft**。常量和机制在不同修订之间已经发生过变化（早期草案使用 `NET_EXCESS_PENALTIES` 计数器），该 EIP 也未被排入任何分叉。
- 验证者如果独自漏掉证明、与其他验证者没有相关性，付出的代价与现在相同。
- 规范包含用于估算成本的校准表和对过往事件的回放；请把这些数字当作作者的建模，而不是定论的经济学结论。
- 它设计为可以与 [EIP-8333](/eip-8333/)（修改 epoch 检查点的锚定方式）配合，但并不依赖它。


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7716
