interchangeformat

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2020 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package interchangeformat defines methods to parse, import, and export slashing protection data from a standard JSON file according to EIP-3076 https://eips.ethereum.org/EIPS/eip-3076. This format is critical to allow safe interoperability between eth2 clients.

Index

Constants

View Source
const INTERCHANGE_FORMAT_VERSION = "5"

INTERCHANGE_FORMAT_VERSION specified by https://eips.ethereum.org/EIPS/eip-3076. The version Prysm supports is version 5.

Variables

This section is empty.

Functions

func ImportStandardProtectionJSON

func ImportStandardProtectionJSON(ctx context.Context, validatorDB db.Database, r io.Reader) error

ImportStandardProtectionJSON takes in EIP-3076 compliant JSON file used for slashing protection by eth2 validators and imports its data into Prysm's internal representation of slashing protection in the validator client's database. For more information, see the EIP document here: https://eips.ethereum.org/EIPS/eip-3076.

Types

type EIPSlashingProtectionFormat

type EIPSlashingProtectionFormat struct {
	Metadata struct {
		InterchangeFormatVersion string `json:"interchange_format_version"`
		GenesisValidatorsRoot    string `json:"genesis_validators_root"`
	} `json:"metadata"`
	Data []*ProtectionData `json:"data"`
}

EIPSlashingProtectionFormat string representation of a standard format for representing validator slashing protection db data.

func ExportStandardProtectionJSON added in v1.0.1

func ExportStandardProtectionJSON(ctx context.Context, validatorDB db.Database) (*EIPSlashingProtectionFormat, error)

ExportStandardProtectionJSON extracts all slashing protection data from a validator database and packages it into an EIP-3076 compliant, standard

type ProtectionData

type ProtectionData struct {
	Pubkey             string               `json:"pubkey"`
	SignedBlocks       []*SignedBlock       `json:"signed_blocks"`
	SignedAttestations []*SignedAttestation `json:"signed_attestations"`
}

ProtectionData field for the standard slashing protection format.

type SignedAttestation

type SignedAttestation struct {
	SourceEpoch string `json:"source_epoch"`
	TargetEpoch string `json:"target_epoch"`
	SigningRoot string `json:"signing_root,omitempty"`
}

SignedAttestation in the standard slashing protection format file, including a source epoch, target epoch, and an optional signing root.

type SignedBlock

type SignedBlock struct {
	Slot        string `json:"slot"`
	SigningRoot string `json:"signing_root,omitempty"`
}

SignedBlock in the standard slashing protection format, including a slot and an optional signing root.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL