types

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: GPL-3.0 Imports: 26 Imported by: 93

Documentation

Overview

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

Code generated by fastssz. DO NOT EDIT. Hash: ef4991a12b343903a19b31aa213a75c6723ea5208c1d516be1efcec22904cbb8 Version: 0.1.2

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

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

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

Code generated by fastssz. DO NOT EDIT. Hash: d62e6a290e2d192b3ca3b3ed67d59f367705729f024c19852bd7b3626c48211c 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}
	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
)

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 added in v0.2.2

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

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

func EncodeSignedSSVMessage added in v0.3.7

func EncodeSignedSSVMessage(message []byte, operatorID OperatorID, signature [256]byte) []byte

EncodeSignedSSVMessage serializes the message, op id and signature into bytes

func Encrypt added in v0.2.2

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

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

func GenerateETHDepositData

func GenerateETHDepositData(
	validatorPK, withdrawalCredentials []byte,
	fork phase0.Version,
	domain phase0.DomainType) ([]byte, *phase0.DepositData, error)

GenerateETHDepositData returns un-signed deposit data and deposit data root for signature

func GenerateKey added in v0.2.2

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

GenerateKey using rsa random generate keys

func GetPublicKeyPem added in v0.2.2

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 added in v0.2.2

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

PemToPrivateKey return rsa private key from pem

func PemToPublicKey added in v0.2.2

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

PemToPublicKey return rsa public key from pem

func PrivateKeyToPem added in v0.2.2

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 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 added in v0.3.0

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 added in v0.3.0

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

func (BeaconNetwork) FirstSlotAtEpoch added in v0.3.0

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
)

List of roles

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 []byte, data *spec.AttestationData) error
	// IsBeaconBlockSlashable returns error if the given block is slashable
	IsBeaconBlockSlashable(pk []byte, slot spec.Slot) error
}

type ConsensusData

type ConsensusData struct {
	// Duty max size is
	// 			8 + 48 + 6*8 + 13*8 = 208 ~= 2^8
	Duty    Duty
	Version spec.DataVersion
	// PreConsensusJustifications max size is
	//			13*SignedPartialSignatureMessage(2^16) ~= 2^20
	PreConsensusJustifications []*SignedPartialSignatureMessage `ssz-max:"13"`
	// DataSSZ has max size as following
	// Biggest object is a Deneb.BlockContents with:
	// - KZGProofs: 6 * 48 = 288
	// - Blobs: 6 * 131072 = 786432
	// - A BeaconBlock: 2*32+2*8 + BeaconBlockBody
	// BeaconBlockBody is
	//			96 + ETH1Data(2*32+8) + 32 +
	//			16*ProposerSlashing(2*SignedBeaconBlockHeader(96 + 3*32 + 2*8)) +
	//			2*AttesterSlashing(2*IndexedAttestation(2048 + 96 + AttestationData(2*8 + 32 + 2*(8+32)))) +
	//			128*Attestation(2048 + 96 + AttestationData(2*8 + 32 + 2*(8+32))) +
	//			16*Deposit(33*32 + 48 + 32 + 8 + 96) +
	//			16*SignedVoluntaryExit(96 + 2*8) +
	//			SyncAggregate(64 + 96) +
	//			ExecutionPayload(32 + 20 + 2*32 + 256 + 32 + 4*8 + 3*32 + 1048576*1073741824 + 16 * (2*8 + 20 + 8) + 8 + 8) +
	//			BLSToExecutionChanges(16 * (96 + (8 + 48 + 20))) +
	//			KZGCommitment(4096 * 48)
	// = 1315964 (everything but transactions) + 2^50 (transaction list)
	// 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)
	// Adding to the rest of the data, we have: 1,315,964 + 2,500,000  = 3,815,964 bytes ~<= 2^22
	// Explanation on why transaction sizes are so big https://github.com/ethereum/consensus-specs/pull/2686
	// 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
}

ConsensusData holds all relevant duty and data Decided on by consensus

func (*ConsensusData) Decode

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

func (*ConsensusData) Encode

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

func (*ConsensusData) GetAggregateAndProof added in v0.3.0

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

func (*ConsensusData) GetAttestationData added in v0.3.0

func (ci *ConsensusData) GetAttestationData() (*phase0.AttestationData, error)

func (*ConsensusData) GetBlindedBlockData added in v0.3.1

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

GetBlindedBlockData ISSUE 221: GetBlockData/GetBlindedBlockData return versioned block only

func (*ConsensusData) GetBlockData added in v0.3.1

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

GetBlockData ISSUE 221: GetBlockData/GetBlindedBlockData return versioned block only

func (*ConsensusData) GetSyncCommitteeBlockRoot added in v0.3.0

func (ci *ConsensusData) GetSyncCommitteeBlockRoot() (phase0.Root, error)

func (*ConsensusData) GetSyncCommitteeContributions added in v0.3.0

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

func (*ConsensusData) GetTree added in v0.3.0

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

GetTree ssz hashes the ConsensusData object

func (*ConsensusData) HashTreeRoot added in v0.3.0

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

HashTreeRoot ssz hashes the ConsensusData object

func (*ConsensusData) HashTreeRootWith added in v0.3.0

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

HashTreeRootWith ssz hashes the ConsensusData object with a hasher

func (*ConsensusData) MarshalSSZ added in v0.3.0

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

MarshalSSZ ssz marshals the ConsensusData object

func (*ConsensusData) MarshalSSZTo added in v0.3.0

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

MarshalSSZTo ssz marshals the ConsensusData object to a target array

func (*ConsensusData) SizeSSZ added in v0.3.0

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

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

func (*ConsensusData) UnmarshalSSZ added in v0.3.0

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

UnmarshalSSZ ssz unmarshals the ConsensusData object

func (*ConsensusData) Validate added in v0.3.0

func (cid *ConsensusData) Validate() error

type Contribution added in v0.3.0

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

func (*Contribution) GetTree added in v0.3.0

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

GetTree ssz hashes the Contribution object

func (*Contribution) HashTreeRoot added in v0.3.0

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

HashTreeRoot ssz hashes the Contribution object

func (*Contribution) HashTreeRootWith added in v0.3.0

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

HashTreeRootWith ssz hashes the Contribution object with a hasher

func (*Contribution) MarshalSSZ added in v0.3.0

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

MarshalSSZ ssz marshals the Contribution object

func (*Contribution) MarshalSSZTo added in v0.3.0

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

MarshalSSZTo ssz marshals the Contribution object to a target array

func (*Contribution) SizeSSZ added in v0.3.0

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

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

func (*Contribution) UnmarshalSSZ added in v0.3.0

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

UnmarshalSSZ ssz unmarshals the Contribution object

type Contributions added in v0.3.0

type Contributions []*Contribution

Contributions --

func (*Contributions) GetTree added in v0.3.0

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

func (*Contributions) HashTreeRoot added in v0.3.0

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

func (*Contributions) HashTreeRootWith added in v0.3.0

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

func (*Contributions) MarshalSSZ added in v0.3.0

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

MarshalSSZ --

func (*Contributions) MarshalSSZTo added in v0.3.0

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

MarshalSSZTo --

func (Contributions) SizeSSZ added in v0.3.0

func (c Contributions) SizeSSZ() int

SizeSSZ returns the size of the serialized object.

func (*Contributions) UnmarshalSSZ added in v0.3.0

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

UnmarshalSSZ --

type DKGSigner

type DKGSigner interface {
	ShareSigner
	// SignDKGOutput signs output according to the SIP https://docs.google.com/document/d/1TRVUHjFyxINWW2H9FYLNL2pQoLy6gmvaI62KL_4cREQ/edit
	SignDKGOutput(output Root, address common.Address) (Signature, error)
	// SignETHDepositRoot signs an ethereum deposit root
	SignETHDepositRoot(root []byte, address common.Address) (Signature, error)
}

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 added in v0.3.5

func (d DomainType) GetNetworkID() NetworkID

type Duty

type Duty 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"`
}

Duty represent data regarding the duty type with the duty data

func (*Duty) GetTree added in v0.3.0

func (d *Duty) GetTree() (*ssz.Node, error)

GetTree ssz hashes the Duty object

func (*Duty) HashTreeRoot added in v0.3.0

func (d *Duty) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the Duty object

func (*Duty) HashTreeRootWith added in v0.3.0

func (d *Duty) HashTreeRootWith(hh ssz.HashWalker) (err error)

HashTreeRootWith ssz hashes the Duty object with a hasher

func (*Duty) MarshalSSZ added in v0.3.0

func (d *Duty) MarshalSSZ() ([]byte, error)

MarshalSSZ ssz marshals the Duty object

func (*Duty) MarshalSSZTo added in v0.3.0

func (d *Duty) MarshalSSZTo(buf []byte) (dst []byte, err error)

MarshalSSZTo ssz marshals the Duty object to a target array

func (*Duty) SizeSSZ added in v0.3.0

func (d *Duty) SizeSSZ() (size int)

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

func (*Duty) UnmarshalSSZ added in v0.3.0

func (d *Duty) UnmarshalSSZ(buf []byte) error

UnmarshalSSZ ssz unmarshals the Duty object

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 added in v0.3.5

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 KeyManager

type KeyManager interface {
	BeaconSigner
	ShareSigner
	// AddShare saves a share key
	AddShare(shareKey *bls.SecretKey) error
	// RemoveShare removes a share key
	RemoveShare(pubKey string) error
}

KeyManager is an interface responsible for all key manager functions

type MessageID

type MessageID [56]byte

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

func MessageIDFromBytes added in v0.2.7

func MessageIDFromBytes(mid []byte) MessageID

func NewMsgID

func NewMsgID(domain DomainType, pk []byte, role BeaconRole) MessageID

func (MessageID) GetDomain added in v0.3.0

func (msg MessageID) GetDomain() []byte

func (MessageID) GetPubKey

func (msg MessageID) GetPubKey() []byte

func (MessageID) GetRoleType

func (msg MessageID) GetRoleType() BeaconRole

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
	// DKGMsgType represent all DKG related messages
	DKGMsgType
)

type NetworkID added in v0.3.5

type NetworkID [1]byte

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

func (NetworkID) Byte added in v0.3.5

func (n NetworkID) Byte() byte

func (NetworkID) ForkAtEpoch added in v0.3.5

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

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

func (NetworkID) GetForksData added in v0.3.5

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

GetForksData return a sorted list of the forks of the network

type Operator

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

Operator represents an SSV operator node

func (*Operator) GetID

func (n *Operator) GetID() OperatorID

GetID returns the node's ID

func (*Operator) GetSSVOperatorPublicKey added in v0.3.8

func (n *Operator) GetSSVOperatorPublicKey() []byte

GetSSVOperatorPublicKey returns the ssv public key with which the node is identified with

func (*Operator) GetSharePublicKey added in v0.3.8

func (n *Operator) GetSharePublicKey() []byte

GetSharePublicKey returns the share public key

func (*Operator) GetTree added in v0.3.0

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

GetTree ssz hashes the Operator object

func (*Operator) HashTreeRoot added in v0.3.0

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

HashTreeRoot ssz hashes the Operator object

func (*Operator) HashTreeRootWith added in v0.3.0

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

HashTreeRootWith ssz hashes the Operator object with a hasher

func (*Operator) MarshalSSZ added in v0.3.0

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

MarshalSSZ ssz marshals the Operator object

func (*Operator) MarshalSSZTo added in v0.3.0

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

MarshalSSZTo ssz marshals the Operator object to a target array

func (*Operator) SizeSSZ added in v0.3.0

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

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

func (*Operator) UnmarshalSSZ added in v0.3.0

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

func DecodeSignedSSVMessage added in v0.3.7

func DecodeSignedSSVMessage(encoded []byte) ([]byte, OperatorID, [256]byte, error)

DecodeSignedSSVMessage deserializes signed message bytes messsage, op id and a signature

type OperatorSigner added in v0.3.8

type OperatorSigner interface {
	SignSSVMessage(data []byte) ([256]byte, error)
}

OperatorSigner used for to sign protocol messages

type PartialSigMsgType added in v0.3.0

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 added in v0.3.0

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
}

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

func (*PartialSignatureMessage) Decode added in v0.3.0

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

Decode returns error if decoding failed

func (*PartialSignatureMessage) Encode added in v0.3.0

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

Encode returns a msg encoded bytes or error

func (*PartialSignatureMessage) GetRoot added in v0.3.0

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

func (*PartialSignatureMessage) GetTree added in v0.3.0

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

GetTree ssz hashes the PartialSignatureMessage object

func (*PartialSignatureMessage) HashTreeRoot added in v0.3.0

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

HashTreeRoot ssz hashes the PartialSignatureMessage object

func (*PartialSignatureMessage) HashTreeRootWith added in v0.3.0

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

HashTreeRootWith ssz hashes the PartialSignatureMessage object with a hasher

func (*PartialSignatureMessage) MarshalSSZ added in v0.3.0

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

MarshalSSZ ssz marshals the PartialSignatureMessage object

func (*PartialSignatureMessage) MarshalSSZTo added in v0.3.0

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

MarshalSSZTo ssz marshals the PartialSignatureMessage object to a target array

func (*PartialSignatureMessage) SizeSSZ added in v0.3.0

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

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

func (*PartialSignatureMessage) UnmarshalSSZ added in v0.3.0

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

UnmarshalSSZ ssz unmarshals the PartialSignatureMessage object

func (*PartialSignatureMessage) Validate added in v0.3.0

func (pcsm *PartialSignatureMessage) Validate() error

type PartialSignatureMessages added in v0.3.0

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

func (*PartialSignatureMessages) Decode added in v0.3.0

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

Decode returns error if decoding failed

func (*PartialSignatureMessages) Encode added in v0.3.0

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

Encode returns a msg encoded bytes or error

func (PartialSignatureMessages) GetRoot added in v0.3.0

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

GetRoot returns the root used for signing and verification

func (*PartialSignatureMessages) GetTree added in v0.3.0

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

GetTree ssz hashes the PartialSignatureMessages object

func (*PartialSignatureMessages) HashTreeRoot added in v0.3.0

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

HashTreeRoot ssz hashes the PartialSignatureMessages object

func (*PartialSignatureMessages) HashTreeRootWith added in v0.3.0

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

HashTreeRootWith ssz hashes the PartialSignatureMessages object with a hasher

func (*PartialSignatureMessages) MarshalSSZ added in v0.3.0

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

MarshalSSZ ssz marshals the PartialSignatureMessages object

func (*PartialSignatureMessages) MarshalSSZTo added in v0.3.0

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

MarshalSSZTo ssz marshals the PartialSignatureMessages object to a target array

func (*PartialSignatureMessages) SizeSSZ added in v0.3.0

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

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

func (*PartialSignatureMessages) UnmarshalSSZ added in v0.3.0

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

UnmarshalSSZ ssz unmarshals the PartialSignatureMessages object

func (PartialSignatureMessages) Validate added in v0.3.0

func (msgs PartialSignatureMessages) Validate() error

type Root

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

type SSVMessage

type SSVMessage struct {
	MsgType MsgType
	MsgID   MessageID `ssz-size:"56"`
	// Data max size is qbft SignedMessage max ~= 5243144 + 2^20 + 96 + 13 ~= 6291829
	Data []byte `ssz-max:"6291829"`
}

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 added in v0.3.0

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

GetTree ssz hashes the SSVMessage object

func (*SSVMessage) GetType

func (msg *SSVMessage) GetType() MsgType

func (*SSVMessage) HashTreeRoot added in v0.3.0

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

HashTreeRoot ssz hashes the SSVMessage object

func (*SSVMessage) HashTreeRootWith added in v0.3.0

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

HashTreeRootWith ssz hashes the SSVMessage object with a hasher

func (*SSVMessage) MarshalSSZ added in v0.3.0

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

MarshalSSZ ssz marshals the SSVMessage object

func (*SSVMessage) MarshalSSZTo added in v0.3.0

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

MarshalSSZTo ssz marshals the SSVMessage object to a target array

func (*SSVMessage) SizeSSZ added in v0.3.0

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

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

func (*SSVMessage) UnmarshalSSZ added in v0.3.0

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

UnmarshalSSZ ssz unmarshals the SSVMessage object

type SSZ32Bytes added in v0.3.0

type SSZ32Bytes [32]byte

SSZ32Bytes --

func (SSZ32Bytes) GetTree added in v0.3.0

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

func (SSZ32Bytes) HashTreeRoot added in v0.3.0

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

func (SSZ32Bytes) HashTreeRootWith added in v0.3.0

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

func (SSZ32Bytes) MarshalSSZ added in v0.3.0

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

MarshalSSZ --

func (SSZ32Bytes) MarshalSSZTo added in v0.3.0

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

MarshalSSZTo --

func (SSZ32Bytes) SizeSSZ added in v0.3.0

func (b SSZ32Bytes) SizeSSZ() int

SizeSSZ returns the size of the serialized object.

func (*SSZ32Bytes) UnmarshalSSZ added in v0.3.0

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

UnmarshalSSZ --

type SSZBytes added in v0.2.7

type SSZBytes []byte

SSZBytes --

func (SSZBytes) GetTree added in v0.3.0

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

func (SSZBytes) HashTreeRoot added in v0.2.7

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

func (SSZBytes) HashTreeRootWith added in v0.2.7

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

type SSZTransactions added in v0.3.0

type SSZTransactions []bellatrix.Transaction

SSZTransactions --

func (SSZTransactions) GetTree added in v0.3.0

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

func (SSZTransactions) HashTreeRoot added in v0.3.0

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

HashTreeRoot --

func (SSZTransactions) HashTreeRootWith added in v0.3.0

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

type SSZUint64 added in v0.2.7

type SSZUint64 uint64

func (SSZUint64) GetTree added in v0.3.0

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

func (SSZUint64) HashTreeRoot added in v0.2.7

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

HashTreeRoot --

func (SSZUint64) HashTreeRootWith added in v0.2.7

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

type SSZWithdrawals added in v0.3.1

type SSZWithdrawals []*capella.Withdrawal

SSZWithdrawals --

func (SSZWithdrawals) GetTree added in v0.3.1

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

func (SSZWithdrawals) HashTreeRoot added in v0.3.1

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

HashTreeRoot --

func (SSZWithdrawals) HashTreeRootWith added in v0.3.1

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

type Share

type Share struct {
	OperatorID            OperatorID
	ValidatorPubKey       ValidatorPK `ssz-size:"48"`
	SharePubKey           []byte      `ssz-size:"48"`
	Committee             []*Operator `ssz-max:"13"`
	Quorum, PartialQuorum uint64
	DomainType            DomainType `ssz-size:"4"`
	FeeRecipientAddress   [20]byte   `ssz-size:"20"`
	Graffiti              []byte     `ssz-size:"32"`
}

Share holds all info about the QBFT/ SSV Committee for msg signing and verification

func (*Share) Decode

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

func (*Share) Encode

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

func (*Share) GetTree added in v0.3.0

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

GetTree ssz hashes the Share object

func (*Share) HasPartialQuorum

func (share *Share) HasPartialQuorum(cnt int) bool

HasPartialQuorum returns true if at least f+1 items present (cnt is the number of items). It assumes nothing about those items, not their type or structure. https://github.com/ConsenSys/qbft-formal-spec-and-verification/blob/main/dafny/spec/L1/node_auxiliary_functions.dfy#L244

func (*Share) HasQuorum

func (share *Share) HasQuorum(cnt int) bool

HasQuorum returns true if at least 2f+1 items are present (cnt is the number of items). It assumes nothing about those items, not their type or structure https://github.com/ConsenSys/qbft-formal-spec-and-verification/blob/main/dafny/spec/L1/node_auxiliary_functions.dfy#L259

func (*Share) HashTreeRoot added in v0.3.0

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

HashTreeRoot ssz hashes the Share object

func (*Share) HashTreeRootWith added in v0.3.0

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

HashTreeRootWith ssz hashes the Share object with a hasher

func (*Share) MarshalSSZ added in v0.3.0

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

MarshalSSZ ssz marshals the Share object

func (*Share) MarshalSSZTo added in v0.3.0

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

MarshalSSZTo ssz marshals the Share object to a target array

func (*Share) SizeSSZ added in v0.3.0

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

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

func (*Share) UnmarshalSSZ added in v0.3.0

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

UnmarshalSSZ ssz unmarshals the Share object

type ShareSigner added in v0.3.8

type ShareSigner interface {
	SignRoot(data Root, sigType SignatureType, pk []byte) (Signature, error)
}

ShareSigner used for signing with the operator's share

type SignSSVMessageF added in v0.3.9

type SignSSVMessageF = func(data []byte) ([256]byte, error)

type Signature

type Signature []byte

func (Signature) Aggregate

func (s Signature) Aggregate(other Signature) (Signature, error)

Aggregate returns the aggregated signature for the provided messages

func (Signature) ECRecover

func (s Signature) ECRecover(data Root, domain DomainType, sigType SignatureType, address common.Address) error

func (Signature) Verify

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

func (Signature) VerifyByOperators

func (s Signature) VerifyByOperators(data MessageSignature, domain DomainType, sigType SignatureType, operators []*Operator) error

VerifyByOperators verifies signature by the provided operators

func (Signature) VerifyMultiPubKey

func (s Signature) VerifyMultiPubKey(data Root, domain DomainType, sigType SignatureType, pks [][]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}
	DKGSignatureType     SignatureType = [4]byte{3, 0, 0, 0}
)

func (SignatureType) Equal

func (sigType SignatureType) Equal(other SignatureType) bool

type SignatureVerifier added in v0.3.8

type SignatureVerifier interface {
	// Verify verifies a SignedSSVMessage's signature using the necessary keys extracted from the list of Operators
	Verify(msg *SignedSSVMessage, operators []*Operator) error
}

SignatureVerifier is an interface responsible for the verification of SignedSSVMessages

type SignedPartialSignatureMessage added in v0.3.0

type SignedPartialSignatureMessage struct {
	Message   PartialSignatureMessages
	Signature Signature `ssz-size:"96"`
	Signer    OperatorID
}

SignedPartialSignatureMessage is an operator's signature over PartialSignatureMessage

func (*SignedPartialSignatureMessage) Decode added in v0.3.0

func (spcsm *SignedPartialSignatureMessage) Decode(data []byte) error

Decode returns error if decoding failed

func (*SignedPartialSignatureMessage) Encode added in v0.3.0

func (spcsm *SignedPartialSignatureMessage) Encode() ([]byte, error)

Encode returns a msg encoded bytes or error

func (*SignedPartialSignatureMessage) GetRoot added in v0.3.0

func (spcsm *SignedPartialSignatureMessage) GetRoot() ([32]byte, error)

func (*SignedPartialSignatureMessage) GetSignature added in v0.3.0

func (spcsm *SignedPartialSignatureMessage) GetSignature() Signature

func (*SignedPartialSignatureMessage) GetSigners added in v0.3.0

func (spcsm *SignedPartialSignatureMessage) GetSigners() []OperatorID

func (*SignedPartialSignatureMessage) GetTree added in v0.3.0

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

GetTree ssz hashes the SignedPartialSignatureMessage object

func (*SignedPartialSignatureMessage) HashTreeRoot added in v0.3.0

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

HashTreeRoot ssz hashes the SignedPartialSignatureMessage object

func (*SignedPartialSignatureMessage) HashTreeRootWith added in v0.3.0

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

HashTreeRootWith ssz hashes the SignedPartialSignatureMessage object with a hasher

func (*SignedPartialSignatureMessage) MarshalSSZ added in v0.3.0

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

MarshalSSZ ssz marshals the SignedPartialSignatureMessage object

func (*SignedPartialSignatureMessage) MarshalSSZTo added in v0.3.0

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

MarshalSSZTo ssz marshals the SignedPartialSignatureMessage object to a target array

func (*SignedPartialSignatureMessage) SizeSSZ added in v0.3.0

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

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

func (*SignedPartialSignatureMessage) UnmarshalSSZ added in v0.3.0

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

UnmarshalSSZ ssz unmarshals the SignedPartialSignatureMessage object

func (*SignedPartialSignatureMessage) Validate added in v0.3.0

func (spcsm *SignedPartialSignatureMessage) Validate() error

type SignedSSVMessage added in v0.3.7

type SignedSSVMessage struct {
	Signature  [256]byte // Created by the operator's network key
	OperatorID OperatorID
	Data       []byte
}

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

func SSVMessageToSignedSSVMessage added in v0.3.9

func SSVMessageToSignedSSVMessage(msg *SSVMessage, operatorID OperatorID, signSSVMessageF SignSSVMessageF) (*SignedSSVMessage, error)

func (*SignedSSVMessage) Decode added in v0.3.7

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

Decode returns error if decoding failed

func (*SignedSSVMessage) Encode added in v0.3.7

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

Encode returns a msg encoded bytes or error

func (*SignedSSVMessage) GetData added in v0.3.7

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

GetData returns message Data as byte slice

func (*SignedSSVMessage) GetOperatorID added in v0.3.7

func (msg *SignedSSVMessage) GetOperatorID() OperatorID

GetOperatorID returns the sender operator ID

func (*SignedSSVMessage) GetSSVMessageFromData added in v0.3.7

func (msg *SignedSSVMessage) GetSSVMessageFromData() (*SSVMessage, error)

GetSSVMessageFromData returns message SSVMessage decoded from data

func (*SignedSSVMessage) GetSignature added in v0.3.7

func (msg *SignedSSVMessage) GetSignature() [256]byte

GetSignature returns the signature of the OperatorID over Data

func (*SignedSSVMessage) Validate added in v0.3.7

func (msg *SignedSSVMessage) Validate() error

Validate checks the following rules: - OperatorID should not be 0 - Signature length should not be 0 - Data length should not be 0

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 ValidatorPK

type ValidatorPK []byte

ValidatorPK is an eth2 validator public key

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