attestations

package
v0.0.0-...-c85edb6 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package attestations tracks the life-cycle of the latest attestations from each validator. It also contains libraries to create attestation message, verify attestation correctness and slashing conditions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDoubleVote

func IsDoubleVote(attestation1 *pb.AttestationData, attestation2 *pb.AttestationData) bool

IsDoubleVote checks if both of the attestations have been used to vote for the same slot. Spec:

	def is_double_vote(attestation_data_1: AttestationData,
                  attestation_data_2: AttestationData) -> bool
   """
   Checks if the two ``AttestationData`` have the same target.
   """
   target_epoch_1 = slot_to_epoch(attestation_data_1.slot)
   target_epoch_2 = slot_to_epoch(attestation_data_2.slot)
   return target_epoch_1 == target_epoch_2

func IsSurroundVote

func IsSurroundVote(attestation1 *pb.AttestationData, attestation2 *pb.AttestationData) bool

IsSurroundVote checks if the data provided by the attestations fulfill the conditions for a surround vote. Spec:

	def is_surround_vote(attestation_data_1: AttestationData,
                    attestation_data_2: AttestationData) -> bool:
   """
   Checks if ``attestation_data_1`` surrounds ``attestation_data_2``.
   """
   source_epoch_1 = attestation_data_1.justified_epoch
   source_epoch_2 = attestation_data_2.justified_epoch
   target_epoch_1 = slot_to_epoch(attestation_data_1.slot)
   target_epoch_2 = slot_to_epoch(attestation_data_2.slot)

   return source_epoch_1 < source_epoch_2 and target_epoch_2 < target_epoch_1

func Key

func Key(att *pb.AttestationData) [32]byte

Key generates the blake2b hash of the following attestation fields: slotNumber + shardID + blockHash + obliqueParentHash This is used for attestation table look up in localDB.

Types

This section is empty.

Jump to

Keyboard shortcuts

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