EIP-3076 Slashing protection data interchange format (Slashing Protection Interchange Format)

No call decision · Consensus & staking · EIP status Last Call · created 2020-10-27

Defines a standard JSON format that lets a validator carry its block and attestation signing history along when switching consensus clients. This prevents slashing from double-signing that conflicts with past signatures.

Why it is needed

Proof of Stake (PoS) imposes a penalty called slashing on a validator that casts votes that could finalize the chain into two branches. A validator correctly following the protocol normally faces no slashing risk, but switching clients from A to B is different: if B does not know about the blocks and attestations A signed, it can sign again for the same epoch. For example, if A's clock was mistakenly set a day (225 epochs) into the future when it signed, a validator who switches to B without that history risks double-voting in the same epoch for the next 225 epochs. Such clock errors have actually been observed. Chain reorganizations can also assign a new attestation duty for an epoch already signed, so prior signing history is essential even right after switching clients. A common keystore format exists for moving key files, but it does not carry signing history, so a standard format is needed to move that history too.

What changes

Today

After EIP-3076

Who is affected

In depth

File structure: metadata and per-validator records

The interchange file is a single JSON object. metadata must include interchange_format_version (currently 5) and genesis_validators_root. genesis_validators_root is a value computed at genesis that identifies which chain the history belongs to. data is an array of per-validator entries, and each entry must include all three fields: pubkey (a hex BLS public key starting with 0x), signed_blocks, and signed_attestations. Each element of signed_blocks requires slot, with signing_root optional. Each element of signed_attestations requires source_epoch and target_epoch, with signing_root optional. For a validator that has never signed anything, the corresponding array is left empty.

The five conditions to follow after importing

A signer that has imported the file must do the following: (1) Reject signing a block that would be slashable with respect to data.signed_blocks. The criterion is consensus-specs' process_proposer_slashing. If the imported block has no signing_root, every new block for the same slot is treated as slashable. (2) Reject signing a block at or below the minimum recorded slot for that public key, except for a re-signing of the same message confirmed via signing_root. (3) Reject signing an attestation that would be slashable per is_slashable_attestation_data. (4) Reject signing an attestation whose source epoch is less than the minimum recorded source epoch. (5) Reject signing an attestation whose target epoch is at or below the minimum recorded target epoch, again except for a re-signing confirmed via signing_root.

The meaning and computation of signing_root

signing_root is the message data (hash tree root) that was the subject of the BLS signature. Having this value allows a request to re-sign and rebroadcast the same block or attestation to be permitted. A block's signing_root is computed as compute_signing_root(block, domain), where block is the BeaconBlock or BeaconBlockHeader that was signed, and domain is compute_domain(DOMAIN_BEACON_PROPOSER, fork, metadata.genesis_validators_root). An attestation's signing_root is computed the same way over AttestationData, but using DOMAIN_BEACON_ATTESTER for domain.

Unifying Complete and Minimal Strategies into One Format

A client's slashing protection strategy splits into two types. The Complete strategy is a database that stores every message each validator has signed. Because it blocks signing only when slashing is certain, it produces no false positives. The Minimal strategy stores only each validator's latest message. It is simpler and smaller, and secures safety by refusing to sign for any prior slot or epoch. Conditions (2), (4), and (5) unify these two strategies into one format, so a file can hold either a detailed record or just a summarized one.

String Representation, Version 5, Compatibility

Numeric values such as slot and epoch are all written as strings. This choice avoids problems caused by differing integer ranges supported across languages, in particular the fact that JavaScript's number type is a 64-bit float. The reason interchange_format_version is 5 is that the design process went through several breaking changes based on implementer feedback, and it is incompatible with drafts prior to version 5. This EIP is in the Interface category of the Standards Track, and its original status is Last Call (deadline 2021-11-03).

Caveats for Implementing a Complete Database

An implementation that stores every message must, in addition to importing all messages from the file, apply all five conditions. In particular, conditions (2), (4), and (5) may not have existed in prior implementations, and it is recommended that they always be applied, whether to imported records or to records accumulated during normal operation, to keep the implementation simple and reduce the attack surface. For messages imported without a signing_root, it is recommended to assign an internal null-like value distinct from all other values; a value such as 0x0, which has an extremely low chance of colliding with a real value, may also be used. Additionally, if a large gap appears between records when importing two files, the signing activity in that gap is unknown, so signing within it must not occur. This can be avoided by storing an explicit low watermark alongside the data, or by pruning old records at import time to eliminate the gap.

Minimal Database and General Recommendations

An implementation that stores only the latest record must, on import, take the per-validator block at the maximum slot and the attestation at the maximum source/target epoch, and merge them with existing values. Conditions reject based on the minimum value, but the recommended approach is to merge by the maximum value. For example, if a file contains blocks at slots 4, 98, and 243 for validator V, update V's latest signed block to the one at slot 243, but if the database already holds a larger value such as slot 351, keep the existing value. As a general recommendation, both export and import should only be allowed while the validator client or signer is stopped. Exporting while running produces a stale file missing signatures made afterward, which immediately becomes a slashing risk.

Original EIP · ← EIPs