github.com/prysmaticlabs/prysm@v1.4.4/validator/slashing-protection/local/standard-protection-format/format/format.go (about) 1 // Package format defines methods to parse, import, and export slashing protection data 2 // from a standard JSON file according to EIP-3076 https://eips.ethereum.org/EIPS/eip-3076. This format 3 // is critical to allow safe interoperability between Ethereum consensus clients. 4 package format 5 6 // InterchangeFormatVersion specified by https://eips.ethereum.org/EIPS/eip-3076. 7 // The version Prysm supports is version 5. 8 const InterchangeFormatVersion = "5" 9 10 // EIPSlashingProtectionFormat string representation of a standard 11 // format for representing validator slashing protection db data. 12 type EIPSlashingProtectionFormat struct { 13 Metadata struct { 14 InterchangeFormatVersion string `json:"interchange_format_version"` 15 GenesisValidatorsRoot string `json:"genesis_validators_root"` 16 } `json:"metadata"` 17 Data []*ProtectionData `json:"data"` 18 } 19 20 // ProtectionData field for the standard slashing protection format. 21 type ProtectionData struct { 22 Pubkey string `json:"pubkey"` 23 SignedBlocks []*SignedBlock `json:"signed_blocks"` 24 SignedAttestations []*SignedAttestation `json:"signed_attestations"` 25 } 26 27 // SignedAttestation in the standard slashing protection format file, including 28 // a source epoch, target epoch, and an optional signing root. 29 type SignedAttestation struct { 30 SourceEpoch string `json:"source_epoch"` 31 TargetEpoch string `json:"target_epoch"` 32 SigningRoot string `json:"signing_root,omitempty"` 33 } 34 35 // SignedBlock in the standard slashing protection format, including a slot 36 // and an optional signing root. 37 type SignedBlock struct { 38 Slot string `json:"slot"` 39 SigningRoot string `json:"signing_root,omitempty"` 40 }