Implements #11616 - EIP-3076 - Minimal database #12475
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is easier to review commit by commit. (Useful information are in commit message description)
What type of PR is this?
Feature
What does this PR do? Why is it needed?
This PR implements the minimal slashing protection database, as specified in EIP-3076.
signed_attestations
:signed_blocks
:Tests
In term of data, the minimal slashing database can be seen as a subset of the complete slashing database, as it has the exact same schema, but contains only the block with the maximum slot and attestations with the maximum source and target for each validator.
=> There is no need to have a database interface and 2 implementations of this interface (complete and minimal), since the minimal database can be simply handled by removing, for each validator, all but the latest message (atomically with the new insertion).
A new
--enable-minimal-slashing-protection-database
flag is defined in the validator client.Design choices about complete/minimal interoperability:
--enable-minimal-slashing-protection-database
flag is set while a pre-existing complete database is found. (The opposite is possible).signed_blocks
orsigned_attestations
with only1
element can be both considered as a minimal JSON interchange file or as a complete JSON interchange file, but with only 1 attestation/block per validator.)Because of
1.
, Prysm validator client should provide a tool to convert a complete database to a minimal one.Example:
Notes about the current antislashing database:
EIP-3076 condition 3 (attestation slashing rules):
Same source, different target ==> ✅
Same source, same target, same root ==> ✅
Same source, same target, different root ==> ❌ (LMD Ghost and/or Casper FFG violation)
Different source, same target ==> ❌ (LMD Ghost and/or Casper FFG violation)
Surrounding ==> ❌ (Casper FFG violation)
Surrounded ==> ❌ (Casper FFG violation)
Which issues(s) does this PR fix?
Fixes #11616