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: 5531456b0862c42236f8f810ebb855a85abe8316f714607db6ea03de509f5986 Version: 0.1.3
Code generated by fastssz. DO NOT EDIT. Hash: 486bbb5cb9679c5573c01f2d027214760fa6641cb1a94204b41f0eed8d3d6c66 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
- Variables
- func ComputeETHDomain(domain spec.DomainType, fork spec.Version, genesisValidatorRoot spec.Root) (spec.Domain, error)
- func ComputeETHSigningRoot(obj ssz.HashRoot, domain spec.Domain) (spec.Root, error)
- func ComputeSigningRoot(data Root, domain SignatureDomain) ([32]byte, error)
- func Decrypt(sk *rsa.PrivateKey, cipherText []byte) ([]byte, error)
- func Encrypt(pk *rsa.PublicKey, plainText []byte) ([]byte, error)
- func GenerateETHDepositData(validatorPK, withdrawalCredentials []byte, fork phase0.Version, ...) ([]byte, *phase0.DepositData, error)
- func GenerateKey() ([]byte, []byte, error)
- func GetPublicKeyPem(sk *rsa.PrivateKey) ([]byte, error)
- func InitBLS()
- func PemToPrivateKey(skPem []byte) (*rsa.PrivateKey, error)
- func PemToPublicKey(pkPem []byte) (*rsa.PublicKey, error)
- func PrivateKeyToPem(sk *rsa.PrivateKey) []byte
- func ReconstructSignatures(signatures map[OperatorID][]byte) (*bls.Sign, error)
- func VerifyReconstructedSignature(sig *bls.Sign, validatorPubKey []byte, root [32]byte) error
- type BeaconNetwork
- func (n BeaconNetwork) EpochStartTime(epoch spec.Epoch) time.Time
- func (n BeaconNetwork) EstimatedCurrentEpoch() spec.Epoch
- func (n BeaconNetwork) EstimatedCurrentSlot() spec.Slot
- func (n BeaconNetwork) EstimatedEpochAtSlot(slot spec.Slot) spec.Epoch
- func (n BeaconNetwork) EstimatedSlotAtTime(time int64) spec.Slot
- func (n BeaconNetwork) EstimatedTimeAtSlot(slot spec.Slot) int64
- func (n BeaconNetwork) FirstSlotAtEpoch(epoch spec.Epoch) spec.Slot
- func (n BeaconNetwork) ForkVersion() [4]byte
- func (n BeaconNetwork) MinGenesisTime() uint64
- func (n BeaconNetwork) SlotDurationSec() time.Duration
- func (n BeaconNetwork) SlotsPerEpoch() uint64
- type BeaconRole
- type BeaconSigner
- type ConsensusData
- func (cid *ConsensusData) Decode(data []byte) error
- func (cid *ConsensusData) Encode() ([]byte, error)
- func (ci *ConsensusData) GetAggregateAndProof() (*phase0.AggregateAndProof, error)
- func (ci *ConsensusData) GetAttestationData() (*phase0.AttestationData, error)
- func (ci *ConsensusData) GetBlindedBlockData() (*api.VersionedBlindedProposal, ssz.HashRoot, error)
- func (ci *ConsensusData) GetBlockData() (blk *api.VersionedProposal, signingRoot ssz.HashRoot, err error)
- func (ci *ConsensusData) GetSyncCommitteeBlockRoot() (phase0.Root, error)
- func (ci *ConsensusData) GetSyncCommitteeContributions() (Contributions, error)
- func (c *ConsensusData) GetTree() (*ssz.Node, error)
- func (c *ConsensusData) HashTreeRoot() ([32]byte, error)
- func (c *ConsensusData) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (c *ConsensusData) MarshalSSZ() ([]byte, error)
- func (c *ConsensusData) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (c *ConsensusData) SizeSSZ() (size int)
- func (c *ConsensusData) UnmarshalSSZ(buf []byte) error
- func (cid *ConsensusData) Validate() error
- type Contribution
- func (c *Contribution) GetTree() (*ssz.Node, error)
- func (c *Contribution) HashTreeRoot() ([32]byte, error)
- func (c *Contribution) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (c *Contribution) MarshalSSZ() ([]byte, error)
- func (c *Contribution) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (c *Contribution) SizeSSZ() (size int)
- func (c *Contribution) UnmarshalSSZ(buf []byte) error
- type Contributions
- func (c *Contributions) GetTree() (*ssz.Node, error)
- func (c *Contributions) HashTreeRoot() ([32]byte, error)
- func (c *Contributions) HashTreeRootWith(hh ssz.HashWalker) error
- func (c *Contributions) MarshalSSZ() ([]byte, error)
- func (c *Contributions) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (c Contributions) SizeSSZ() int
- func (c *Contributions) UnmarshalSSZ(buf []byte) error
- type DKGSigner
- type DomainType
- type Duty
- func (d *Duty) GetTree() (*ssz.Node, error)
- func (d *Duty) HashTreeRoot() ([32]byte, error)
- func (d *Duty) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (d *Duty) MarshalSSZ() ([]byte, error)
- func (d *Duty) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (d *Duty) SizeSSZ() (size int)
- func (d *Duty) UnmarshalSSZ(buf []byte) error
- type Encoder
- type ForkData
- type KeyManager
- type MessageID
- type MessageSignature
- type MsgType
- type NetworkID
- type Operator
- func (n *Operator) GetID() OperatorID
- func (n *Operator) GetPublicKey() []byte
- func (o *Operator) GetTree() (*ssz.Node, error)
- func (o *Operator) HashTreeRoot() ([32]byte, error)
- func (o *Operator) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (o *Operator) MarshalSSZ() ([]byte, error)
- func (o *Operator) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (o *Operator) SizeSSZ() (size int)
- func (o *Operator) UnmarshalSSZ(buf []byte) error
- type OperatorID
- type PartialSigMsgType
- type PartialSignatureMessage
- func (pcsm *PartialSignatureMessage) Decode(data []byte) error
- func (pcsm *PartialSignatureMessage) Encode() ([]byte, error)
- func (pcsm *PartialSignatureMessage) GetRoot() ([32]byte, error)
- func (p *PartialSignatureMessage) GetTree() (*ssz.Node, error)
- func (p *PartialSignatureMessage) HashTreeRoot() ([32]byte, error)
- func (p *PartialSignatureMessage) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (p *PartialSignatureMessage) MarshalSSZ() ([]byte, error)
- func (p *PartialSignatureMessage) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (p *PartialSignatureMessage) SizeSSZ() (size int)
- func (p *PartialSignatureMessage) UnmarshalSSZ(buf []byte) error
- func (pcsm *PartialSignatureMessage) Validate() error
- type PartialSignatureMessages
- func (msgs *PartialSignatureMessages) Decode(data []byte) error
- func (msgs *PartialSignatureMessages) Encode() ([]byte, error)
- func (msgs PartialSignatureMessages) GetRoot() ([32]byte, error)
- func (p *PartialSignatureMessages) GetTree() (*ssz.Node, error)
- func (p *PartialSignatureMessages) HashTreeRoot() ([32]byte, error)
- func (p *PartialSignatureMessages) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (p *PartialSignatureMessages) MarshalSSZ() ([]byte, error)
- func (p *PartialSignatureMessages) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (p *PartialSignatureMessages) SizeSSZ() (size int)
- func (p *PartialSignatureMessages) UnmarshalSSZ(buf []byte) error
- func (msgs PartialSignatureMessages) Validate() error
- type Root
- type SSVMessage
- func (msg *SSVMessage) Decode(data []byte) error
- func (msg *SSVMessage) Encode() ([]byte, error)
- func (msg *SSVMessage) GetData() []byte
- func (msg *SSVMessage) GetID() MessageID
- func (s *SSVMessage) GetTree() (*ssz.Node, error)
- func (msg *SSVMessage) GetType() MsgType
- func (s *SSVMessage) HashTreeRoot() ([32]byte, error)
- func (s *SSVMessage) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (s *SSVMessage) MarshalSSZ() ([]byte, error)
- func (s *SSVMessage) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (s *SSVMessage) SizeSSZ() (size int)
- func (s *SSVMessage) UnmarshalSSZ(buf []byte) error
- type SSVSigner
- type SSZ32Bytes
- func (b SSZ32Bytes) GetTree() (*ssz.Node, error)
- func (b SSZ32Bytes) HashTreeRoot() ([32]byte, error)
- func (b SSZ32Bytes) HashTreeRootWith(hh ssz.HashWalker) error
- func (b SSZ32Bytes) MarshalSSZ() ([]byte, error)
- func (b SSZ32Bytes) MarshalSSZTo(dst []byte) ([]byte, error)
- func (b SSZ32Bytes) SizeSSZ() int
- func (b *SSZ32Bytes) UnmarshalSSZ(buf []byte) error
- type SSZBytes
- type SSZTransactions
- type SSZUint64
- type SSZWithdrawals
- type Share
- func (share *Share) Decode(data []byte) error
- func (share *Share) Encode() ([]byte, error)
- func (s *Share) GetTree() (*ssz.Node, error)
- func (share *Share) HasPartialQuorum(cnt int) bool
- func (share *Share) HasQuorum(cnt int) bool
- func (s *Share) HashTreeRoot() ([32]byte, error)
- func (s *Share) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (s *Share) MarshalSSZ() ([]byte, error)
- func (s *Share) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (s *Share) SizeSSZ() (size int)
- func (s *Share) UnmarshalSSZ(buf []byte) error
- type Signature
- func (s Signature) Aggregate(other Signature) (Signature, error)
- func (s Signature) ECRecover(data Root, domain DomainType, sigType SignatureType, address common.Address) error
- func (s Signature) Verify(data Root, domain DomainType, sigType SignatureType, pkByts []byte) error
- func (s Signature) VerifyByOperators(data MessageSignature, domain DomainType, sigType SignatureType, ...) error
- func (s Signature) VerifyMultiPubKey(data Root, domain DomainType, sigType SignatureType, pks [][]byte) error
- type SignatureDomain
- type SignatureType
- type SignedPartialSignatureMessage
- func (spcsm *SignedPartialSignatureMessage) Decode(data []byte) error
- func (spcsm *SignedPartialSignatureMessage) Encode() ([]byte, error)
- func (spcsm *SignedPartialSignatureMessage) GetRoot() ([32]byte, error)
- func (spcsm *SignedPartialSignatureMessage) GetSignature() Signature
- func (spcsm *SignedPartialSignatureMessage) GetSigners() []OperatorID
- func (s *SignedPartialSignatureMessage) GetTree() (*ssz.Node, error)
- func (s *SignedPartialSignatureMessage) HashTreeRoot() ([32]byte, error)
- func (s *SignedPartialSignatureMessage) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (s *SignedPartialSignatureMessage) MarshalSSZ() ([]byte, error)
- func (s *SignedPartialSignatureMessage) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (s *SignedPartialSignatureMessage) SizeSSZ() (size int)
- func (s *SignedPartialSignatureMessage) UnmarshalSSZ(buf []byte) error
- func (spcsm *SignedPartialSignatureMessage) Validate() error
- type ThreadSafeF
- type Validate
- type ValidatorPK
Constants ¶
const BLSWithdrawalPrefixByte = byte(0)
BLSWithdrawalPrefixByte is the BLS withdrawal prefix
const DefaultGasLimit = 30_000_000
DefaultGasLimit sets gas limit used in validator registrations.
const MaxEffectiveBalanceInGwei uint64 = 32000000000
MaxEffectiveBalanceInGwei is the max effective balance
Variables ¶
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} )
var ( MainnetNetworkID = NetworkID{0x0} PrimusNetworkID = NetworkID{0x1} ShifuNetworkID = NetworkID{0x2} JatoNetworkID = NetworkID{0x3} JatoV2NetworkID = NetworkID{0x4} )
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.
var GenesisForkVersion = spec.Version{0, 0, 0, 0}
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 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 Encrypt ¶ added in v0.2.2
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
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 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
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
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
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 { SSVSigner // 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) HashTreeRoot ¶ added in v0.3.0
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
MarshalSSZ ssz marshals the Duty object
func (*Duty) MarshalSSZTo ¶ added in v0.3.0
MarshalSSZTo ssz marshals the Duty object to a target array
func (*Duty) SizeSSZ ¶ added in v0.3.0
SizeSSZ returns the ssz encoded size in bytes for the Duty object
func (*Duty) UnmarshalSSZ ¶ added in v0.3.0
UnmarshalSSZ ssz unmarshals the Duty object
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 SSVSigner AddShare(shareKey *bls.SecretKey) error 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 NewMsgID ¶
func NewMsgID(domain DomainType, pk []byte, role BeaconRole) MessageID
func (MessageID) GetRoleType ¶
func (msg MessageID) GetRoleType() BeaconRole
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 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) ForkAtEpoch ¶ added in v0.3.5
GetCurrentFork returns the ForkData with highest Epoch smaller or equal to "epoch"
func (NetworkID) GetForksData ¶ added in v0.3.5
GetForksData return a sorted list of the forks of the network
type Operator ¶
type Operator struct { OperatorID OperatorID PubKey []byte `ssz-size:"48"` }
Operator represents an SSV operator node
func (*Operator) GetPublicKey ¶
GetPublicKey returns the public key with which the node is identified with
func (*Operator) HashTreeRoot ¶ added in v0.3.0
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
MarshalSSZ ssz marshals the Operator object
func (*Operator) MarshalSSZTo ¶ added in v0.3.0
MarshalSSZTo ssz marshals the Operator object to a target array
func (*Operator) SizeSSZ ¶ added in v0.3.0
SizeSSZ returns the ssz encoded size in bytes for the Operator object
func (*Operator) UnmarshalSSZ ¶ added in v0.3.0
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 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 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 SSVSigner ¶
type SSVSigner interface {
SignRoot(data Root, sigType SignatureType, pk []byte) (Signature, error)
}
SSVSigner used for all SSV specific signing
type SSZ32Bytes ¶ added in v0.3.0
type SSZ32Bytes [32]byte
SSZ32Bytes --
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) HashTreeRoot ¶ added in v0.2.7
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) HashTreeRoot ¶ added in v0.2.7
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 {
Share holds all info about the QBFT/ SSV Committee for msg signing and verification
func (*Share) HasPartialQuorum ¶
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 ¶
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
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
MarshalSSZ ssz marshals the Share object
func (*Share) MarshalSSZTo ¶ added in v0.3.0
MarshalSSZTo ssz marshals the Share object to a target array
func (*Share) SizeSSZ ¶ added in v0.3.0
SizeSSZ returns the ssz encoded size in bytes for the Share object
func (*Share) UnmarshalSSZ ¶ added in v0.3.0
UnmarshalSSZ ssz unmarshals the Share object
type Signature ¶
type Signature []byte
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 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 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
Source Files ¶
- beacon_types.go
- beacon_types_encoding.go
- bls.go
- consensus_data.go
- consensus_data_encoding.go
- crypto.go
- domain_type.go
- encoder.go
- encryption.go
- eth1_deposit.go
- generate.go
- messages.go
- messages_encoding.go
- operator.go
- operator_encoding.go
- partial_sig_message.go
- partial_sig_message_encoding.go
- share.go
- share_encoding.go
- signer.go
- ssz.go
- threadsafe_func.go
- types.go