types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: GPL-3.0 Imports: 26 Imported by: 2

Documentation

Overview

Code generated by fastssz. DO NOT EDIT. Hash: c8f61f522e246b3332467b461e0b7d89c6f69fa425f420fcf48080a4a978d5d6 Version: 0.1.3

Code generated by fastssz. DO NOT EDIT. Hash: da7f54b805a60d108e45282c8eafc508bfd48cbce5a494a521cabc5c72f19bc4 Version: 0.1.3

Code generated by fastssz. DO NOT EDIT. Hash: 7a5c0a7558d4a1ddf3c0cddd9b929b54f3f0b68b988bd272059536a2f76bac7a Version: 0.1.3

Code generated by fastssz. DO NOT EDIT. Hash: 2749d9c21190c8258286fb6cf181aca8f225666fe5dc3f1a5dd741fc9531b922 Version: 0.1.3

Code generated by fastssz. DO NOT EDIT. Hash: 377503ffee811939051589f32ef591e2cebb714777a6c94df1a2d1e6c792e4cf Version: 0.1.3

Code generated by fastssz. DO NOT EDIT. Hash: 450a3d2a18a6c7444d064b6cb30637371af29d57782d153231c9dcf220f12b86 Version: 0.1.3

Index

Constants

View Source
const BLSWithdrawalPrefixByte = byte(0)

BLSWithdrawalPrefixByte is the BLS withdrawal prefix

View Source
const DefaultGasLimit = 30_000_000

DefaultGasLimit sets gas limit used in validator registrations.

View Source
const MaxEffectiveBalanceInGwei uint64 = 32000000000

MaxEffectiveBalanceInGwei is the max effective balance

Variables

View Source
var (
	DomainProposer                    = [4]byte{0x00, 0x00, 0x00, 0x00}
	DomainAttester                    = [4]byte{0x01, 0x00, 0x00, 0x00}
	DomainRandao                      = [4]byte{0x02, 0x00, 0x00, 0x00}
	DomainDeposit                     = [4]byte{0x03, 0x00, 0x00, 0x00}
	DomainVoluntaryExit               = [4]byte{0x04, 0x00, 0x00, 0x00}
	DomainSelectionProof              = [4]byte{0x05, 0x00, 0x00, 0x00}
	DomainAggregateAndProof           = [4]byte{0x06, 0x00, 0x00, 0x00}
	DomainSyncCommittee               = [4]byte{0x07, 0x00, 0x00, 0x00}
	DomainSyncCommitteeSelectionProof = [4]byte{0x08, 0x00, 0x00, 0x00}
	DomainContributionAndProof        = [4]byte{0x09, 0x00, 0x00, 0x00}
	DomainApplicationBuilder          = [4]byte{0x00, 0x00, 0x00, 0x01}

	DomainError = [4]byte{0x99, 0x99, 0x99, 0x99}
)
View Source
var (
	MainnetNetworkID = NetworkID{0x0}
	PrimusNetworkID  = NetworkID{0x1}
	ShifuNetworkID   = NetworkID{0x2}
	JatoNetworkID    = NetworkID{0x3}
	JatoV2NetworkID  = NetworkID{0x4}
)
View Source
var (
	GenesisMainnet = DomainType{0x0, 0x0, MainnetNetworkID.Byte(), 0x0}
	AlanMainnet    = DomainType{0x0, 0x0, MainnetNetworkID.Byte(), 0x1}

	PrimusTestnet   = DomainType{0x0, 0x0, PrimusNetworkID.Byte(), 0x0}
	ShifuTestnet    = DomainType{0x0, 0x0, ShifuNetworkID.Byte(), 0x0}
	ShifuV2Testnet  = DomainType{0x0, 0x0, ShifuNetworkID.Byte(), 0x1}
	JatoTestnet     = DomainType{0x0, 0x0, JatoNetworkID.Byte(), 0x1}   // Note the fork version value
	JatoV2Testnet   = DomainType{0x0, 0x0, JatoV2NetworkID.Byte(), 0x1} // Note the fork version value
	JatoAlanTestnet = DomainType{0x0, 0x0, JatoNetworkID.Byte(), 0x2}
)

DomainTypes represent specific forks for specific chains, messages are signed with the domain type making 2 messages from different domains incompatible Historical Note: The fork version values for JatoTestnet and JatoV2Testnet are both set to 0x1 due to an error when these networks were initially introduced. This inconsistency does not align with the sequential versioning observed in other network and fork definitions. It's retained to maintain historical accuracy and to avoid any unforeseen issues that might arise from changing these established values. Future references and modifications should acknowledge this historical inconsistency.

View Source
var GenesisForkVersion = spec.Version{0, 0, 0, 0}
View Source
var GenesisValidatorsRoot = spec.Root{}

Functions

func ComputeETHDomain

func ComputeETHDomain(domain spec.DomainType, fork spec.Version, genesisValidatorRoot spec.Root) (spec.Domain, error)

ComputeETHDomain returns computed domain

func ComputeETHSigningRoot

func ComputeETHSigningRoot(obj ssz.HashRoot, domain spec.Domain) (spec.Root, error)

func ComputeSigningRoot

func ComputeSigningRoot(data Root, domain SignatureDomain) ([32]byte, error)

ComputeSigningRoot returns a singable/ verifiable root calculated from the a provided data and signature domain

func Decrypt

func Decrypt(sk *rsa.PrivateKey, cipherText []byte) ([]byte, error)

Decrypt with secret key (base64) and bytes, return the encrypted key string

func Encrypt

func Encrypt(pk *rsa.PublicKey, plainText []byte) ([]byte, error)

Encrypt with secret key (base64) the bytes, return the encrypted key string

func GenerateKey

func GenerateKey() ([]byte, []byte, error)

GenerateKey using rsa random generate keys

func GetPublicKeyPem

func GetPublicKeyPem(sk *rsa.PrivateKey) ([]byte, error)

GetPublicKeyPem get public key from private key and return []byte represent the public key

func InitBLS

func InitBLS()

InitBLS initializes BLS

func PemToPrivateKey

func PemToPrivateKey(skPem []byte) (*rsa.PrivateKey, error)

PemToPrivateKey return rsa private key from pem

func PemToPublicKey

func PemToPublicKey(pkPem []byte) (*rsa.PublicKey, error)

PemToPublicKey return rsa public key from pem

func PrivateKeyToPem

func PrivateKeyToPem(sk *rsa.PrivateKey) []byte

PrivateKeyToPem converts privateKey to pem encoded

func ReconstructSignatures

func ReconstructSignatures(signatures map[OperatorID][]byte) (*bls.Sign, error)

ReconstructSignatures receives a map of user indexes and serialized bls.Sign. It then reconstructs the original threshold signature using lagrange interpolation

func SignSSVMessage added in v1.0.0

func SignSSVMessage(sk *rsa.PrivateKey, ssvMsg *SSVMessage) ([]byte, error)

func Verify added in v1.0.0

func Verify(msg *SignedSSVMessage, operators []*Operator) error

func VerifyReconstructedSignature

func VerifyReconstructedSignature(sig *bls.Sign, validatorPubKey []byte, root [32]byte) error

Types

type BeaconNetwork

type BeaconNetwork string

BeaconNetwork represents the network.

const (
	// MainNetwork represents the main network.
	MainNetwork BeaconNetwork = "mainnet"

	// HoleskyNetwork represents the Holesky test network.
	HoleskyNetwork BeaconNetwork = "holesky"

	// PraterNetwork represents the Prater test network.
	PraterNetwork BeaconNetwork = "prater"

	// BeaconTestNetwork is a simple test network with a custom genesis time
	BeaconTestNetwork BeaconNetwork = "now_test_network"
)

Available networks.

func NetworkFromString

func NetworkFromString(n string) BeaconNetwork

NetworkFromString returns network from the given string value

func (BeaconNetwork) EpochStartTime

func (n BeaconNetwork) EpochStartTime(epoch spec.Epoch) time.Time

func (BeaconNetwork) EstimatedCurrentEpoch

func (n BeaconNetwork) EstimatedCurrentEpoch() spec.Epoch

EstimatedCurrentEpoch estimates the current epoch https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/beacon-chain.md#compute_start_slot_at_epoch

func (BeaconNetwork) EstimatedCurrentSlot

func (n BeaconNetwork) EstimatedCurrentSlot() spec.Slot

EstimatedCurrentSlot returns the estimation of the current slot

func (BeaconNetwork) EstimatedEpochAtSlot

func (n BeaconNetwork) EstimatedEpochAtSlot(slot spec.Slot) spec.Epoch

EstimatedEpochAtSlot estimates epoch at the given slot

func (BeaconNetwork) EstimatedSlotAtTime

func (n BeaconNetwork) EstimatedSlotAtTime(time int64) spec.Slot

EstimatedSlotAtTime estimates slot at the given time

func (BeaconNetwork) EstimatedTimeAtSlot

func (n BeaconNetwork) EstimatedTimeAtSlot(slot spec.Slot) int64

func (BeaconNetwork) FirstSlotAtEpoch

func (n BeaconNetwork) FirstSlotAtEpoch(epoch spec.Epoch) spec.Slot

func (BeaconNetwork) ForkVersion

func (n BeaconNetwork) ForkVersion() [4]byte

ForkVersion returns the fork version of the network.

func (BeaconNetwork) MinGenesisTime

func (n BeaconNetwork) MinGenesisTime() uint64

MinGenesisTime returns min genesis time value

func (BeaconNetwork) SlotDurationSec

func (n BeaconNetwork) SlotDurationSec() time.Duration

SlotDurationSec returns slot duration

func (BeaconNetwork) SlotsPerEpoch

func (n BeaconNetwork) SlotsPerEpoch() uint64

SlotsPerEpoch returns number of slots per one epoch

type BeaconRole

type BeaconRole uint64

BeaconRole type of the validator role for a specific duty

const (
	BNRoleAttester BeaconRole = iota
	BNRoleAggregator
	BNRoleProposer
	BNRoleSyncCommittee
	BNRoleSyncCommitteeContribution

	BNRoleValidatorRegistration
	BNRoleVoluntaryExit

	BNRoleUnknown = math.MaxUint64
)

func (BeaconRole) String

func (r BeaconRole) String() string

String returns name of the role

type BeaconSigner

type BeaconSigner interface {
	// SignBeaconObject returns signature and root.
	SignBeaconObject(obj ssz.HashRoot, domain spec.Domain, pk []byte, domainType spec.DomainType) (Signature, [32]byte, error)
	// IsAttestationSlashable returns error if attestation is slashable
	IsAttestationSlashable(pk ShareValidatorPK, data *spec.AttestationData) error
	// IsBeaconBlockSlashable returns error if the given block is slashable
	IsBeaconBlockSlashable(pk []byte, slot spec.Slot) error
}

type BeaconVote added in v1.0.0

type BeaconVote struct {
	BlockRoot phase0.Root `ssz-size:"32"`
	Source    *phase0.Checkpoint
	Target    *phase0.Checkpoint
}

BeaconVote is used as the data to be agreed on consensus for the CommitteeRunner

func (*BeaconVote) Decode added in v1.0.0

func (b *BeaconVote) Decode(data []byte) error

Decode the BeaconVote object

func (*BeaconVote) Encode added in v1.0.0

func (b *BeaconVote) Encode() ([]byte, error)

Encode the BeaconVote object

func (*BeaconVote) GetTree added in v1.0.0

func (b *BeaconVote) GetTree() (*ssz.Node, error)

GetTree ssz hashes the BeaconVote object

func (*BeaconVote) HashTreeRoot added in v1.0.0

func (b *BeaconVote) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the BeaconVote object

func (*BeaconVote) HashTreeRootWith added in v1.0.0

func (b *BeaconVote) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the BeaconVote object with a hasher

func (*BeaconVote) MarshalSSZ added in v1.0.0

func (b *BeaconVote) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the BeaconVote object

func (*BeaconVote) MarshalSSZTo added in v1.0.0

func (b *BeaconVote) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the BeaconVote object to a target array

func (*BeaconVote) SizeSSZ added in v1.0.0

func (b *BeaconVote) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the BeaconVote object

func (*BeaconVote) UnmarshalSSZ added in v1.0.0

func (b *BeaconVote) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the BeaconVote object

type CommitteeDuty added in v1.0.0

type CommitteeDuty struct {
	Slot            spec.Slot
	ValidatorDuties []*ValidatorDuty
}

func (*CommitteeDuty) DutySlot added in v1.0.0

func (cd *CommitteeDuty) DutySlot() spec.Slot

func (*CommitteeDuty) RunnerRole added in v1.0.0

func (cd *CommitteeDuty) RunnerRole() RunnerRole

type CommitteeID added in v1.0.0

type CommitteeID [32]byte

func GetCommitteeID added in v1.0.0

func GetCommitteeID(committee []OperatorID) CommitteeID

Return a 32 bytes ID for the cluster of operators

func (CommitteeID) MessageIDBelongs added in v1.0.0

func (cid CommitteeID) MessageIDBelongs(msgID MessageID) bool

type CommitteeMember added in v1.0.0

type CommitteeMember struct {
	OperatorID        OperatorID
	CommitteeID       CommitteeID `ssz-size:"32"`
	SSVOperatorPubKey []byte      `ssz-size:"459"`
	// FaultyNodes is the number of nodes that are considered faulty or malicious in the operator's committee
	FaultyNodes uint64
	// All the members of the committee
	Committee  []*Operator `ssz-max:"13"`
	DomainType DomainType  `ssz-size:"4"`
}

CommitteeMember represents an SSV operator node that is part of a committee

func (*CommitteeMember) Decode added in v1.0.0

func (cm *CommitteeMember) Decode(data []byte) error

func (*CommitteeMember) Encode added in v1.0.0

func (cm *CommitteeMember) Encode() ([]byte, error)

func (*CommitteeMember) GetQuorum added in v1.0.0

func (cm *CommitteeMember) GetQuorum() uint64

func (*CommitteeMember) GetTree added in v1.0.0

func (c *CommitteeMember) GetTree() (*ssz.Node, error)

GetTree ssz hashes the CommitteeMember object

func (*CommitteeMember) HasPartialQuorum added in v1.0.0

func (cm *CommitteeMember) HasPartialQuorum(cnt int) bool

func (*CommitteeMember) HasQuorum added in v1.0.0

func (cm *CommitteeMember) HasQuorum(cnt int) bool

func (*CommitteeMember) HashTreeRoot added in v1.0.0

func (c *CommitteeMember) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the CommitteeMember object

func (*CommitteeMember) HashTreeRootWith added in v1.0.0

func (c *CommitteeMember) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the CommitteeMember object with a hasher

func (*CommitteeMember) MarshalSSZ added in v1.0.0

func (c *CommitteeMember) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the CommitteeMember object

func (*CommitteeMember) MarshalSSZTo added in v1.0.0

func (c *CommitteeMember) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the CommitteeMember object to a target array

func (*CommitteeMember) SizeSSZ added in v1.0.0

func (c *CommitteeMember) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the CommitteeMember object

func (*CommitteeMember) UnmarshalSSZ added in v1.0.0

func (c *CommitteeMember) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the CommitteeMember object

type Contribution

type Contribution struct {
	SelectionProofSig [96]byte `ssz-size:"96"`
	Contribution      altair.SyncCommitteeContribution
}

func (*Contribution) GetTree

func (c *Contribution) GetTree() (*ssz.Node, error)

GetTree ssz hashes the Contribution object

func (*Contribution) HashTreeRoot

func (c *Contribution) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the Contribution object

func (*Contribution) HashTreeRootWith

func (c *Contribution) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the Contribution object with a hasher

func (*Contribution) MarshalSSZ

func (c *Contribution) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the Contribution object

func (*Contribution) MarshalSSZTo

func (c *Contribution) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the Contribution object to a target array

func (*Contribution) SizeSSZ

func (c *Contribution) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the Contribution object

func (*Contribution) UnmarshalSSZ

func (c *Contribution) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the Contribution object

type Contributions

type Contributions []*Contribution

Contributions --

func (*Contributions) GetTree

func (c *Contributions) GetTree() (*ssz.Node, error)

func (*Contributions) HashTreeRoot

func (c *Contributions) HashTreeRoot() ([32]byte, error)

func (*Contributions) HashTreeRootWith

func (c *Contributions) HashTreeRootWith(hh ssz.HashWalker) error

func (*Contributions) MarshalSSZ

func (c *Contributions) MarshalSSZ() ([]byte, error)

MarshalSSZ --

func (*Contributions) MarshalSSZTo

func (c *Contributions) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo --

func (Contributions) SizeSSZ

func (c Contributions) SizeSSZ() int

SizeSSZ returns the size of the serialized object.

func (*Contributions) UnmarshalSSZ

func (c *Contributions) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ --

type DomainType

type DomainType [4]byte

DomainType is a unique identifier for signatures, 2 identical pieces of data signed with different domains will result in different sigs

func (DomainType) GetNetworkID

func (d DomainType) GetNetworkID() NetworkID

type Duty

type Duty interface {
	DutySlot() spec.Slot
	RunnerRole() RunnerRole
}

type Encoder

type Encoder interface {
	// Encode returns the encoded struct in bytes or error
	Encode() ([]byte, error)
	// Decode returns error if decoding failed
	Decode(data []byte) error
}

type ForkData

type ForkData struct {
	// Epoch in which the fork happened
	Epoch phase0.Epoch
	// Domain for the new fork
	Domain DomainType
}

ForkData is a simple structure holding fork information for a specific chain (and its fork)

type MessageID

type MessageID [56]byte

MessageID is used to identify and route messages to the right validator and Runner

func NewMsgID

func NewMsgID(domain DomainType, dutyExecutorID []byte, role RunnerRole) MessageID

func (MessageID) GetDomain

func (msg MessageID) GetDomain() []byte

func (MessageID) GetDutyExecutorID added in v1.0.0

func (msg MessageID) GetDutyExecutorID() []byte

func (MessageID) GetRoleType

func (msg MessageID) GetRoleType() RunnerRole

func (MessageID) String

func (msgID MessageID) String() string

type MessageSignature

type MessageSignature interface {
	Root
	GetSignature() Signature
	GetSigners() []OperatorID
}

MessageSignature includes all functions relevant for a signed message (QBFT message, post consensus msg, etc)

type MsgType

type MsgType uint64
const (
	// SSVConsensusMsgType are all QBFT consensus related messages
	SSVConsensusMsgType MsgType = iota
	// SSVPartialSignatureMsgType are all partial signatures msgs over beacon chain specific signatures
	SSVPartialSignatureMsgType
)

type NetworkID

type NetworkID [1]byte

NetworkID are intended to separate different SSV networks. A network can have many forks in it.

func (NetworkID) Byte

func (n NetworkID) Byte() byte

func (NetworkID) ForkAtEpoch

func (n NetworkID) ForkAtEpoch(epoch phase0.Epoch) (*ForkData, error)

GetCurrentFork returns the ForkData with highest Epoch smaller or equal to "epoch"

func (NetworkID) GetForksData

func (n NetworkID) GetForksData() []*ForkData

GetForksData return a sorted list of the forks of the network

type Operator

type Operator struct {
	OperatorID        OperatorID
	SSVOperatorPubKey []byte `ssz-size:"459"`
}

Operator represents a node in the network that holds an ID and a public key

func (*Operator) GetTree

func (o *Operator) GetTree() (*ssz.Node, error)

GetTree ssz hashes the Operator object

func (*Operator) HashTreeRoot

func (o *Operator) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the Operator object

func (*Operator) HashTreeRootWith

func (o *Operator) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the Operator object with a hasher

func (*Operator) MarshalSSZ

func (o *Operator) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the Operator object

func (*Operator) MarshalSSZTo

func (o *Operator) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the Operator object to a target array

func (*Operator) SizeSSZ

func (o *Operator) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the Operator object

func (*Operator) UnmarshalSSZ

func (o *Operator) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the Operator object

type OperatorID

type OperatorID = uint64

OperatorID is a unique ID for the node, used to create shares and verify msgs

type OperatorSigner

type OperatorSigner struct {
	SSVOperatorSK *rsa.PrivateKey
	OperatorID    OperatorID
}

func (*OperatorSigner) GetOperatorID added in v1.0.0

func (km *OperatorSigner) GetOperatorID() OperatorID

GetOperatorID returns the operator ID

func (*OperatorSigner) SignSSVMessage

func (km *OperatorSigner) SignSSVMessage(ssvMsg *SSVMessage) ([]byte, error)

type PartialSigMsgType

type PartialSigMsgType uint64
const (
	// PostConsensusPartialSig is a partial signature over a decided duty (attestation data, block, etc)
	PostConsensusPartialSig PartialSigMsgType = iota
	// RandaoPartialSig is a partial signature over randao reveal
	RandaoPartialSig
	// SelectionProofPartialSig is a partial signature for aggregator selection proof
	SelectionProofPartialSig
	// ContributionProofs is the partial selection proofs for sync committee contributions (it's an array of sigs)
	ContributionProofs
	// ValidatorRegistrationPartialSig is a partial signature over a ValidatorRegistration object
	ValidatorRegistrationPartialSig
	// VoluntaryExitPartialSig is a partial signature over a VoluntaryExit object
	VoluntaryExitPartialSig
)

type PartialSignatureMessage

type PartialSignatureMessage struct {
	PartialSignature Signature `ssz-size:"96"` // The Beacon chain partial Signature for a duty
	SigningRoot      [32]byte  `ssz-size:"32"` // the root signed in PartialSignature
	Signer           OperatorID
	ValidatorIndex   phase0.ValidatorIndex
}

PartialSignatureMessage is a msg for partial Beacon chain related signatures (like partial attestation, block, randao sigs)

func (*PartialSignatureMessage) Decode

func (pcsm *PartialSignatureMessage) Decode(data []byte) error

Decode returns error if decoding failed

func (*PartialSignatureMessage) Encode

func (pcsm *PartialSignatureMessage) Encode() ([]byte, error)

Encode returns a msg encoded bytes or error

func (*PartialSignatureMessage) GetRoot

func (pcsm *PartialSignatureMessage) GetRoot() ([32]byte, error)

func (*PartialSignatureMessage) GetTree

func (p *PartialSignatureMessage) GetTree() (*ssz.Node, error)

GetTree ssz hashes the PartialSignatureMessage object

func (*PartialSignatureMessage) HashTreeRoot

func (p *PartialSignatureMessage) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the PartialSignatureMessage object

func (*PartialSignatureMessage) HashTreeRootWith

func (p *PartialSignatureMessage) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the PartialSignatureMessage object with a hasher

func (*PartialSignatureMessage) MarshalSSZ

func (p *PartialSignatureMessage) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the PartialSignatureMessage object

func (*PartialSignatureMessage) MarshalSSZTo

func (p *PartialSignatureMessage) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the PartialSignatureMessage object to a target array

func (*PartialSignatureMessage) SizeSSZ

func (p *PartialSignatureMessage) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the PartialSignatureMessage object

func (*PartialSignatureMessage) UnmarshalSSZ

func (p *PartialSignatureMessage) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the PartialSignatureMessage object

func (*PartialSignatureMessage) Validate

func (pcsm *PartialSignatureMessage) Validate() error

type PartialSignatureMessages

type PartialSignatureMessages struct {
	Type     PartialSigMsgType
	Slot     phase0.Slot
	Messages []*PartialSignatureMessage `ssz-max:"1000"`
}

func (*PartialSignatureMessages) Decode

func (msgs *PartialSignatureMessages) Decode(data []byte) error

Decode returns error if decoding failed

func (*PartialSignatureMessages) Encode

func (msgs *PartialSignatureMessages) Encode() ([]byte, error)

Encode returns a msg encoded bytes or error

func (PartialSignatureMessages) GetRoot

func (msgs PartialSignatureMessages) GetRoot() ([32]byte, error)

GetRoot returns the root used for signing and verification

func (*PartialSignatureMessages) GetTree

func (p *PartialSignatureMessages) GetTree() (*ssz.Node, error)

GetTree ssz hashes the PartialSignatureMessages object

func (*PartialSignatureMessages) HashTreeRoot

func (p *PartialSignatureMessages) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the PartialSignatureMessages object

func (*PartialSignatureMessages) HashTreeRootWith

func (p *PartialSignatureMessages) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the PartialSignatureMessages object with a hasher

func (*PartialSignatureMessages) MarshalSSZ

func (p *PartialSignatureMessages) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the PartialSignatureMessages object

func (*PartialSignatureMessages) MarshalSSZTo

func (p *PartialSignatureMessages) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the PartialSignatureMessages object to a target array

func (*PartialSignatureMessages) SizeSSZ

func (p *PartialSignatureMessages) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the PartialSignatureMessages object

func (*PartialSignatureMessages) UnmarshalSSZ

func (p *PartialSignatureMessages) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the PartialSignatureMessages object

func (PartialSignatureMessages) Validate

func (msgs PartialSignatureMessages) Validate() error

func (PartialSignatureMessages) ValidateForSigner added in v1.0.0

func (msgs PartialSignatureMessages) ValidateForSigner(signer OperatorID) error

ValidateForSigner checks if the PartialSignatureMessages are valid for a given signer It checks if the signer is the same as the one in the messages

type Root

type Root interface {
	GetRoot() ([32]byte, error)
}

type RunnerRole added in v1.0.0

type RunnerRole int32

https://github.com/ssvlabs/ssv-spec/issues/423 - this can be taken down to one byte on the wire

const (
	RoleCommittee RunnerRole = iota
	RoleAggregator
	RoleProposer
	RoleSyncCommitteeContribution

	RoleValidatorRegistration
	RoleVoluntaryExit

	RoleUnknown = -1
)

func MapDutyToRunnerRole added in v1.0.0

func MapDutyToRunnerRole(dutyRole BeaconRole) RunnerRole

func (RunnerRole) String added in v1.0.0

func (r RunnerRole) String() string

String returns name of the runner role

type SSVMessage

type SSVMessage struct {
	MsgType MsgType
	MsgID   MessageID `ssz-size:"56"`
	// Data max size is the max between max(qbft.SignedMessage) and max(PartialSignatureMessages)
	// i.e., = max(722412, 144020) = 722412
	Data []byte `ssz-max:"722412"`
}

SSVMessage is the main message passed within the SSV network, it can contain different types of messages (QBTF, Sync, etc.)

func (*SSVMessage) Decode

func (msg *SSVMessage) Decode(data []byte) error

Decode returns error if decoding failed

func (*SSVMessage) Encode

func (msg *SSVMessage) Encode() ([]byte, error)

Encode returns a msg encoded bytes or error

func (*SSVMessage) GetData

func (msg *SSVMessage) GetData() []byte

GetData returns message Data as byte slice

func (*SSVMessage) GetID

func (msg *SSVMessage) GetID() MessageID

GetID returns a unique msg ID that is used to identify to which validator should the message be sent for processing

func (*SSVMessage) GetTree

func (s *SSVMessage) GetTree() (*ssz.Node, error)

GetTree ssz hashes the SSVMessage object

func (*SSVMessage) GetType

func (msg *SSVMessage) GetType() MsgType

func (*SSVMessage) HashTreeRoot

func (s *SSVMessage) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the SSVMessage object

func (*SSVMessage) HashTreeRootWith

func (s *SSVMessage) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the SSVMessage object with a hasher

func (*SSVMessage) MarshalSSZ

func (s *SSVMessage) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the SSVMessage object

func (*SSVMessage) MarshalSSZTo

func (s *SSVMessage) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the SSVMessage object to a target array

func (*SSVMessage) SizeSSZ

func (s *SSVMessage) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the SSVMessage object

func (*SSVMessage) UnmarshalSSZ

func (s *SSVMessage) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the SSVMessage object

type SSZ32Bytes

type SSZ32Bytes [32]byte

SSZ32Bytes --

func (SSZ32Bytes) GetTree

func (b SSZ32Bytes) GetTree() (*ssz.Node, error)

func (SSZ32Bytes) HashTreeRoot

func (b SSZ32Bytes) HashTreeRoot() ([32]byte, error)

func (SSZ32Bytes) HashTreeRootWith

func (b SSZ32Bytes) HashTreeRootWith(hh ssz.HashWalker) error

func (SSZ32Bytes) MarshalSSZ

func (b SSZ32Bytes) MarshalSSZ() ([]byte, error)

MarshalSSZ --

func (SSZ32Bytes) MarshalSSZTo

func (b SSZ32Bytes) MarshalSSZTo(dst []byte) ([]byte, error)

MarshalSSZTo --

func (SSZ32Bytes) SizeSSZ

func (b SSZ32Bytes) SizeSSZ() int

SizeSSZ returns the size of the serialized object.

func (*SSZ32Bytes) UnmarshalSSZ

func (b *SSZ32Bytes) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ --

type SSZBytes

type SSZBytes []byte

SSZBytes --

func (SSZBytes) GetTree

func (b SSZBytes) GetTree() (*ssz.Node, error)

func (SSZBytes) HashTreeRoot

func (b SSZBytes) HashTreeRoot() ([32]byte, error)

func (SSZBytes) HashTreeRootWith

func (b SSZBytes) HashTreeRootWith(hh ssz.HashWalker) error

type SSZTransactions

type SSZTransactions []bellatrix.Transaction

SSZTransactions --

func (SSZTransactions) GetTree

func (b SSZTransactions) GetTree() (*ssz.Node, error)

func (SSZTransactions) HashTreeRoot

func (b SSZTransactions) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (SSZTransactions) HashTreeRootWith

func (b SSZTransactions) HashTreeRootWith(hh ssz.HashWalker) error

type SSZUint64

type SSZUint64 uint64

func (SSZUint64) GetTree

func (s SSZUint64) GetTree() (*ssz.Node, error)

func (SSZUint64) HashTreeRoot

func (s SSZUint64) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (SSZUint64) HashTreeRootWith

func (s SSZUint64) HashTreeRootWith(hh ssz.HashWalker) error

type SSZWithdrawals

type SSZWithdrawals []*capella.Withdrawal

SSZWithdrawals --

func (SSZWithdrawals) GetTree

func (b SSZWithdrawals) GetTree() (*ssz.Node, error)

func (SSZWithdrawals) HashTreeRoot

func (b SSZWithdrawals) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (SSZWithdrawals) HashTreeRootWith

func (b SSZWithdrawals) HashTreeRootWith(hh ssz.HashWalker) error

type Share

type Share struct {
	ValidatorIndex      phase0.ValidatorIndex
	ValidatorPubKey     ValidatorPK      `ssz-size:"48"`
	SharePubKey         ShareValidatorPK `ssz-size:"48"`
	Committee           []*ShareMember   `ssz-max:"13"`
	DomainType          DomainType       `ssz-size:"4"`
	FeeRecipientAddress [20]byte         `ssz-size:"20"`
	Graffiti            []byte           `ssz-size:"32"`
}

Share holds all info about the validator share

func (*Share) Decode

func (share *Share) Decode(data []byte) error

func (*Share) Encode

func (share *Share) Encode() ([]byte, error)

func (*Share) GetTree

func (s *Share) GetTree() (*ssz.Node, error)

GetTree ssz hashes the Share object

func (*Share) HashTreeRoot

func (s *Share) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the Share object

func (*Share) HashTreeRootWith

func (s *Share) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the Share object with a hasher

func (*Share) MarshalSSZ

func (s *Share) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the Share object

func (*Share) MarshalSSZTo

func (s *Share) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the Share object to a target array

func (*Share) SizeSSZ

func (s *Share) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the Share object

func (*Share) UnmarshalSSZ

func (s *Share) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the Share object

type ShareMember added in v1.0.0

type ShareMember struct {
	SharePubKey ShareValidatorPK `ssz-size:"48"`
	Signer      OperatorID
}

ShareMember holds ShareValidatorPK and ValidatorIndex

func (*ShareMember) GetTree added in v1.0.0

func (s *ShareMember) GetTree() (*ssz.Node, error)

GetTree ssz hashes the ShareMember object

func (*ShareMember) HashTreeRoot added in v1.0.0

func (s *ShareMember) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the ShareMember object

func (*ShareMember) HashTreeRootWith added in v1.0.0

func (s *ShareMember) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the ShareMember object with a hasher

func (*ShareMember) MarshalSSZ added in v1.0.0

func (s *ShareMember) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the ShareMember object

func (*ShareMember) MarshalSSZTo added in v1.0.0

func (s *ShareMember) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the ShareMember object to a target array

func (*ShareMember) SizeSSZ added in v1.0.0

func (s *ShareMember) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the ShareMember object

func (*ShareMember) UnmarshalSSZ added in v1.0.0

func (s *ShareMember) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the ShareMember object

type ShareValidatorPK added in v1.0.0

type ShareValidatorPK []byte

ShareValidatorPK is a partial eth2 validator public key 48 bytes long

type SignSSVMessageF

type SignSSVMessageF = func(ssvMessage *SSVMessage) ([]byte, error)

type Signature

type Signature []byte

func (Signature) Verify

func (s Signature) Verify(data Root, domain DomainType, sigType SignatureType, pkByts []byte) error

type SignatureDomain

type SignatureDomain []byte

func ComputeSignatureDomain

func ComputeSignatureDomain(domain DomainType, sigType SignatureType) SignatureDomain

ComputeSignatureDomain returns a signature domain based on the domain type and signature type

type SignatureType

type SignatureType [4]byte
var (
	QBFTSignatureType    SignatureType = [4]byte{1, 0, 0, 0}
	PartialSignatureType SignatureType = [4]byte{2, 0, 0, 0}
)

func (SignatureType) Equal

func (sigType SignatureType) Equal(other SignatureType) bool

type SignedSSVMessage

type SignedSSVMessage struct {
	Signatures  [][]byte     `ssz-max:"13,256"` // Created by the operators' key
	OperatorIDs []OperatorID `ssz-max:"13"`
	SSVMessage  *SSVMessage
	// Full data max value is the max value between ValidatorConsensusData and BeaconVote
	FullData []byte `ssz-max:"4194532"`
}

SignedSSVMessage is the main message passed within the SSV network. It encapsulates the SSVMessage structure and a signature

func (*SignedSSVMessage) Aggregate added in v1.0.0

func (msg *SignedSSVMessage) Aggregate(msgToAggregate *SignedSSVMessage) error

Aggregate will aggregate the signed message if possible (unique signers, same digest, valid)

func (*SignedSSVMessage) CheckSignersInCommittee added in v1.0.0

func (msg *SignedSSVMessage) CheckSignersInCommittee(operators []*Operator) bool

Check if all signedMsg's signers belong to the given committee in O(n+m)

func (*SignedSSVMessage) CommonSigners added in v1.0.0

func (msg *SignedSSVMessage) CommonSigners(ids []OperatorID) bool

CommonSigners returns true if there is at least 1 common signer

func (*SignedSSVMessage) Decode

func (msg *SignedSSVMessage) Decode(data []byte) error

Decode returns error if decoding failed

func (*SignedSSVMessage) DeepCopy added in v1.0.0

func (signedMsg *SignedSSVMessage) DeepCopy() *SignedSSVMessage

DeepCopy returns a new instance of SignedMessage, deep copied

func (*SignedSSVMessage) Encode

func (msg *SignedSSVMessage) Encode() ([]byte, error)

Encode returns a msg encoded bytes or error

func (*SignedSSVMessage) GetRoot added in v1.0.0

func (msg *SignedSSVMessage) GetRoot() ([32]byte, error)

GetRoot returns the root

func (*SignedSSVMessage) GetTree added in v1.0.0

func (s *SignedSSVMessage) GetTree() (*ssz.Node, error)

GetTree ssz hashes the SignedSSVMessage object

func (*SignedSSVMessage) HashTreeRoot added in v1.0.0

func (s *SignedSSVMessage) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the SignedSSVMessage object

func (*SignedSSVMessage) HashTreeRootWith added in v1.0.0

func (s *SignedSSVMessage) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the SignedSSVMessage object with a hasher

func (*SignedSSVMessage) MarshalSSZ added in v1.0.0

func (s *SignedSSVMessage) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the SignedSSVMessage object

func (*SignedSSVMessage) MarshalSSZTo added in v1.0.0

func (s *SignedSSVMessage) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the SignedSSVMessage object to a target array

func (*SignedSSVMessage) MatchedSigners added in v1.0.0

func (msg *SignedSSVMessage) MatchedSigners(ids []OperatorID) bool

MatchedSigners returns true if the provided signer ids are equal to GetOperatorIDs() without order significance

func (*SignedSSVMessage) SizeSSZ added in v1.0.0

func (s *SignedSSVMessage) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the SignedSSVMessage object

func (*SignedSSVMessage) UnmarshalSSZ added in v1.0.0

func (s *SignedSSVMessage) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the SignedSSVMessage object

func (*SignedSSVMessage) Validate

func (msg *SignedSSVMessage) Validate() error

Validate checks the following rules: - OperatorID must have at least one element - Any OperatorID must not be 0 - The number of signatures and OperatorIDs must be the same - Any signature must not have length 0 - SSVMessage must not be nil

func (*SignedSSVMessage) WithoutFullData added in v1.0.0

func (msg *SignedSSVMessage) WithoutFullData() *SignedSSVMessage

WithoutFullData returns SignedMessage without full data

type ThreadSafeF

type ThreadSafeF struct {
	// contains filtered or unexported fields
}

ThreadSafeF makes function execution thread safe

func NewThreadSafeF

func NewThreadSafeF() *ThreadSafeF

NewThreadSafeF returns a new instance of NewThreadSafeF

func (*ThreadSafeF) Run

func (safeF *ThreadSafeF) Run(f func() interface{}) interface{}

Run runs the provided function

type Validate

type Validate interface {
	// Validate returns error if msg validation doesn't pass.
	// Msg validation checks the msg, it's variables for validity.
	Validate() error
}

type ValidatorConsensusData added in v1.0.0

type ValidatorConsensusData struct {
	// Duty max size is
	// 			8 + 48 + 6*8 + 13*8 + 1 = 209
	Duty    ValidatorDuty
	Version spec.DataVersion
	// DataSSZ's max size if the size of the biggest object Deneb.BlockContents.
	// Per definition, Deneb.BlockContents has a field for transaction of size 2^50.
	// We do not need to support such a big DataSSZ size as 2^50 represents 1000X the actual block gas limit
	// Upcoming 40M gas limit produces 40M / 16 (call data cost) = 2,500,000 bytes (https://eips.ethereum.org/EIPS/eip-4488)
	// Explanation on why transaction sizes are so big https://github.com/ethereum/consensus-specs/pull/2686
	// Adding to the rest of the data (see script below), we have: 1,315,964 + 2,500,000  = 3,815,964 bytes ~<= 2^22
	// Python script for Deneb.BlockContents without transactions:
	// 		# Constants
	// 		KZG_PROOFS_SIZE = 6 * 48  # KZGProofs size
	// 		BLOBS_SIZE = 6 * 131072  # Blobs size
	// 		BEACON_BLOCK_OVERHEAD = 2 * 32 + 2 * 8  # Additional overhead for BeaconBlock
	// 		# Components of BeaconBlockBody
	// 		ETH1_DATA_SIZE = 96 + 2 * 32 + 8 + 32  # ETH1Data
	// 		PROPOSER_SLASHING_SIZE = 16 * (2 * (96 + 3 * 32 + 2 * 8))  # ProposerSlashing
	// 		ATTESTER_SLASHING_SIZE = 2 * (2 * (2048 + 96 + (2 * 8 + 32 + 2 * (8 + 32))))  # AttesterSlashing
	// 		ATTESTATION_SIZE = 128 * (2048 + 96 + (2 * 8 + 32 + 2 * (8 + 32)))  # Attestation
	// 		DEPOSIT_SIZE = 16 * (33 * 32 + 48 + 32 + 8 + 96)  # Deposit
	// 		SIGNED_VOLUNTARY_EXIT_SIZE = 16 * (96 + 2 * 8)  # SignedVoluntaryExit
	// 		SYNC_AGGREGATE_SIZE = 64 + 96  # SyncAggregate
	// 		EXECUTION_PAYLOAD_NO_TRANSACTIONS = 32 + 20 + 2*32 + 256 + 32 + 4*8 + 3*32 + 16 * (2*8 + 20 + 8) + 8 + 8
	// 		BLS_TO_EXECUTION_CHANGES_SIZE = 16 * (96 + (8 + 48 + 20))  # BLSToExecutionChanges
	// 		KZG_COMMITMENT_SIZE = 4096 * 48  # KZGCommitment
	// 		# BeaconBlockBody total size without transactions
	// 		beacon_block_body_size_without_transactions = (
	// 		    ETH1_DATA_SIZE + PROPOSER_SLASHING_SIZE + ATTESTER_SLASHING_SIZE +
	// 		    ATTESTATION_SIZE + DEPOSIT_SIZE + SIGNED_VOLUNTARY_EXIT_SIZE +
	// 		    SYNC_AGGREGATE_SIZE + EXECUTION_PAYLOAD_NO_TRANSACTIONS + BLS_TO_EXECUTION_CHANGES_SIZE + KZG_COMMITMENT_SIZE
	// 		)
	// 		# Total size of Deneb.BlockContents and BeaconBlock without transactions
	// 		total_size_without_execution_payload = KZG_PROOFS_SIZE + BLOBS_SIZE + BEACON_BLOCK_OVERHEAD + beacon_block_body_size_without_transactions
	DataSSZ []byte `ssz-max:"4194304"` // 2^22
}

ValidatorConsensusData holds all relevant duty and data Decided on by consensus

func (*ValidatorConsensusData) Decode added in v1.0.0

func (cid *ValidatorConsensusData) Decode(data []byte) error

func (*ValidatorConsensusData) Encode added in v1.0.0

func (cid *ValidatorConsensusData) Encode() ([]byte, error)

func (*ValidatorConsensusData) GetAggregateAndProof added in v1.0.0

func (ci *ValidatorConsensusData) GetAggregateAndProof() (*phase0.AggregateAndProof, error)

func (*ValidatorConsensusData) GetBlindedBlockData added in v1.0.0

func (ci *ValidatorConsensusData) GetBlindedBlockData() (*api.VersionedBlindedProposal, ssz.HashRoot, error)

GetBlindedBlockData ISSUE 221: GetBlockData/GetBlindedBlockData return versioned block only

func (*ValidatorConsensusData) GetBlockData added in v1.0.0

func (ci *ValidatorConsensusData) GetBlockData() (blk *api.VersionedProposal, signingRoot ssz.HashRoot, err error)

GetBlockData ISSUE 221: GetBlockData/GetBlindedBlockData return versioned block only

func (*ValidatorConsensusData) GetSyncCommitteeContributions added in v1.0.0

func (ci *ValidatorConsensusData) GetSyncCommitteeContributions() (Contributions, error)

func (*ValidatorConsensusData) GetTree added in v1.0.0

func (v *ValidatorConsensusData) GetTree() (*ssz.Node, error)

GetTree ssz hashes the ValidatorConsensusData object

func (*ValidatorConsensusData) HashTreeRoot added in v1.0.0

func (v *ValidatorConsensusData) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the ValidatorConsensusData object

func (*ValidatorConsensusData) HashTreeRootWith added in v1.0.0

func (v *ValidatorConsensusData) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the ValidatorConsensusData object with a hasher

func (*ValidatorConsensusData) MarshalSSZ added in v1.0.0

func (v *ValidatorConsensusData) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the ValidatorConsensusData object

func (*ValidatorConsensusData) MarshalSSZTo added in v1.0.0

func (v *ValidatorConsensusData) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the ValidatorConsensusData object to a target array

func (*ValidatorConsensusData) SizeSSZ added in v1.0.0

func (v *ValidatorConsensusData) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the ValidatorConsensusData object

func (*ValidatorConsensusData) UnmarshalSSZ added in v1.0.0

func (v *ValidatorConsensusData) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the ValidatorConsensusData object

func (*ValidatorConsensusData) Validate added in v1.0.0

func (cid *ValidatorConsensusData) Validate() error

type ValidatorDuty added in v1.0.0

type ValidatorDuty struct {
	// Type is the duty type (attest, propose)
	Type BeaconRole
	// PubKey is the public key of the validator that should attest.
	PubKey spec.BLSPubKey `ssz-size:"48"`
	// Slot is the slot in which the validator should attest.
	Slot spec.Slot
	// ValidatorIndex is the index of the validator that should attest.
	ValidatorIndex spec.ValidatorIndex
	// CommitteeIndex is the index of the committee in which the attesting validator has been placed.
	CommitteeIndex spec.CommitteeIndex
	// CommitteeLength is the length of the committee in which the attesting validator has been placed.
	CommitteeLength uint64
	// CommitteesAtSlot is the number of committees in the slot.
	CommitteesAtSlot uint64
	// ValidatorCommitteeIndex is the index of the validator in the list of validators in the committee.
	ValidatorCommitteeIndex uint64
	// ValidatorSyncCommitteeIndices is the index of the validator in the list of validators in the committee.
	ValidatorSyncCommitteeIndices []uint64 `ssz-max:"13"`
}

ValidatorDuty represent data regarding the duty type with the duty data

func (*ValidatorDuty) DutySlot added in v1.0.0

func (bd *ValidatorDuty) DutySlot() spec.Slot

func (*ValidatorDuty) GetTree added in v1.0.0

func (v *ValidatorDuty) GetTree() (*ssz.Node, error)

GetTree ssz hashes the ValidatorDuty object

func (*ValidatorDuty) GetValidatorIndex added in v1.0.0

func (bd *ValidatorDuty) GetValidatorIndex() spec.ValidatorIndex

GetValidatorIndex returns the validator index

func (*ValidatorDuty) HashTreeRoot added in v1.0.0

func (v *ValidatorDuty) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the ValidatorDuty object

func (*ValidatorDuty) HashTreeRootWith added in v1.0.0

func (v *ValidatorDuty) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the ValidatorDuty object with a hasher

func (*ValidatorDuty) MarshalSSZ added in v1.0.0

func (v *ValidatorDuty) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the ValidatorDuty object

func (*ValidatorDuty) MarshalSSZTo added in v1.0.0

func (v *ValidatorDuty) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the ValidatorDuty object to a target array

func (*ValidatorDuty) RunnerRole added in v1.0.0

func (bd *ValidatorDuty) RunnerRole() RunnerRole

func (*ValidatorDuty) SizeSSZ added in v1.0.0

func (v *ValidatorDuty) SizeSSZ() (size int)

SizeSSZ returns the ssz encoded size in bytes for the ValidatorDuty object

func (*ValidatorDuty) UnmarshalSSZ added in v1.0.0

func (v *ValidatorDuty) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the ValidatorDuty object

type ValidatorPK

type ValidatorPK phase0.BLSPubKey

ValidatorPK is an eth2 validator public key 48 bytes long

func (ValidatorPK) MessageIDBelongs

func (vid ValidatorPK) MessageIDBelongs(msgID MessageID) bool

MessageIDBelongs returns true if message ID belongs to validator

Jump to

Keyboard shortcuts

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