Documentation
¶
Overview ¶
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Code generated by fastssz. DO NOT EDIT.
Index ¶
- Constants
- Variables
- func CombineHashes(left *chainhash.Hash, right *chainhash.Hash) chainhash.Hash
- type AcceptedVoteInfo
- func (a *AcceptedVoteInfo) Copy() AcceptedVoteInfo
- func (a *AcceptedVoteInfo) HashTreeRoot() ([32]byte, error)
- func (a *AcceptedVoteInfo) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (a *AcceptedVoteInfo) Marshal() ([]byte, error)
- func (a *AcceptedVoteInfo) MarshalSSZ() ([]byte, error)
- func (a *AcceptedVoteInfo) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (a *AcceptedVoteInfo) SizeSSZ() (size int)
- func (a *AcceptedVoteInfo) Unmarshal(b []byte) error
- func (a *AcceptedVoteInfo) UnmarshalSSZ(buf []byte) error
- type AccountInfo
- func (a *AccountInfo) HashTreeRoot() ([32]byte, error)
- func (a *AccountInfo) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (a *AccountInfo) MarshalSSZ() ([]byte, error)
- func (a *AccountInfo) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (a *AccountInfo) SizeSSZ() (size int)
- func (a *AccountInfo) UnmarshalSSZ(buf []byte) error
- type Block
- func (b *Block) DepositMerkleRoot() chainhash.Hash
- func (b *Block) ExitMerkleRoot() chainhash.Hash
- func (b *Block) GetTxs() []string
- func (b *Block) GovernanceVoteMerkleRoot() chainhash.Hash
- func (b *Block) Hash() chainhash.Hash
- func (b *Block) HashTreeRoot() ([32]byte, error)
- func (b *Block) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (b *Block) Marshal() ([]byte, error)
- func (b *Block) MarshalSSZ() ([]byte, error)
- func (b *Block) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (b *Block) ProposerSlashingsRoot() chainhash.Hash
- func (b *Block) RANDAOSlashingsRoot() chainhash.Hash
- func (b *Block) SerializedEpochs(accounts map[[48]byte]struct{}) []byte
- func (b *Block) SerializedTx(accounts map[[20]byte]struct{}) []byte
- func (b *Block) SizeSSZ() (size int)
- func (b *Block) TransactionMerkleRoot() chainhash.Hash
- func (b *Block) TransactionMultiMerkleRoot() chainhash.Hash
- func (b *Block) Unmarshal(bb []byte) error
- func (b *Block) UnmarshalSSZ(buf []byte) error
- func (b *Block) VoteSlashingRoot() chainhash.Hash
- func (b *Block) VotesMerkleRoot() chainhash.Hash
- type BlockHeader
- func (b *BlockHeader) Hash() chainhash.Hash
- func (b *BlockHeader) HashTreeRoot() ([32]byte, error)
- func (b *BlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (b *BlockHeader) Marshal() ([]byte, error)
- func (b *BlockHeader) MarshalSSZ() ([]byte, error)
- func (b *BlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (b *BlockHeader) SizeSSZ() (size int)
- func (b *BlockHeader) Unmarshal(by []byte) error
- func (b *BlockHeader) UnmarshalSSZ(buf []byte) error
- type BlockNodeDisk
- func (b *BlockNodeDisk) HashTreeRoot() ([32]byte, error)
- func (b *BlockNodeDisk) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (b *BlockNodeDisk) Marshal() ([]byte, error)
- func (b *BlockNodeDisk) MarshalSSZ() ([]byte, error)
- func (b *BlockNodeDisk) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (b *BlockNodeDisk) SizeSSZ() (size int)
- func (b *BlockNodeDisk) Unmarshal(by []byte) error
- func (b *BlockNodeDisk) UnmarshalSSZ(buf []byte) error
- type CoinsState
- type CoinsStateSerializable
- func (c *CoinsStateSerializable) HashTreeRoot() ([32]byte, error)
- func (c *CoinsStateSerializable) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (c *CoinsStateSerializable) Marshal() ([]byte, error)
- func (c *CoinsStateSerializable) MarshalSSZ() ([]byte, error)
- func (c *CoinsStateSerializable) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (c *CoinsStateSerializable) SizeSSZ() (size int)
- func (c *CoinsStateSerializable) Unmarshal(b []byte) error
- func (c *CoinsStateSerializable) UnmarshalSSZ(buf []byte) error
- type CommunityVoteData
- func (c *CommunityVoteData) Copy() *CommunityVoteData
- func (c *CommunityVoteData) Hash() chainhash.Hash
- func (c *CommunityVoteData) HashTreeRoot() ([32]byte, error)
- func (c *CommunityVoteData) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (c *CommunityVoteData) Marshal() ([]byte, error)
- func (c *CommunityVoteData) MarshalSSZ() ([]byte, error)
- func (c *CommunityVoteData) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (c *CommunityVoteData) SizeSSZ() (size int)
- func (c *CommunityVoteData) Unmarshal(b []byte) error
- func (c *CommunityVoteData) UnmarshalSSZ(buf []byte) error
- type CommunityVoteDataInfo
- func (c *CommunityVoteDataInfo) HashTreeRoot() ([32]byte, error)
- func (c *CommunityVoteDataInfo) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (c *CommunityVoteDataInfo) MarshalSSZ() ([]byte, error)
- func (c *CommunityVoteDataInfo) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (c *CommunityVoteDataInfo) SizeSSZ() (size int)
- func (c *CommunityVoteDataInfo) UnmarshalSSZ(buf []byte) error
- type Deposit
- func (d *Deposit) GetPublicKey() (*bls.PublicKey, error)
- func (d *Deposit) GetSignature() (*bls.Signature, error)
- func (d *Deposit) Hash() chainhash.Hash
- func (d *Deposit) HashTreeRoot() ([32]byte, error)
- func (d *Deposit) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (d *Deposit) Marshal() ([]byte, error)
- func (d *Deposit) MarshalSSZ() ([]byte, error)
- func (d *Deposit) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (d *Deposit) SizeSSZ() (size int)
- func (d *Deposit) Unmarshal(b []byte) error
- func (d *Deposit) UnmarshalSSZ(buf []byte) error
- type DepositData
- func (d *DepositData) GetPublicKey() (*bls.PublicKey, error)
- func (d *DepositData) GetSignature() (*bls.Signature, error)
- func (d *DepositData) HashTreeRoot() ([32]byte, error)
- func (d *DepositData) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (d *DepositData) Marshal() ([]byte, error)
- func (d *DepositData) MarshalSSZ() ([]byte, error)
- func (d *DepositData) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (d *DepositData) SizeSSZ() (size int)
- func (d *DepositData) Unmarshal(b []byte) error
- func (d *DepositData) UnmarshalSSZ(buf []byte) error
- type EpochReceipt
- type Exit
- func (e *Exit) GetSignature() (*bls.Signature, error)
- func (e *Exit) GetValidatorPubKey() (*bls.PublicKey, error)
- func (e *Exit) GetWithdrawPubKey() (*bls.PublicKey, error)
- func (e *Exit) Hash() chainhash.Hash
- func (e *Exit) HashTreeRoot() ([32]byte, error)
- func (e *Exit) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (e *Exit) Marshal() ([]byte, error)
- func (e *Exit) MarshalSSZ() ([]byte, error)
- func (e *Exit) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (e *Exit) SizeSSZ() (size int)
- func (e *Exit) Unmarshal(b []byte) error
- func (e *Exit) UnmarshalSSZ(buf []byte) error
- type Governance
- type GovernanceSerializable
- func (g *GovernanceSerializable) HashTreeRoot() ([32]byte, error)
- func (g *GovernanceSerializable) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (g *GovernanceSerializable) MarshalSSZ() ([]byte, error)
- func (g *GovernanceSerializable) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (g *GovernanceSerializable) SizeSSZ() (size int)
- func (g *GovernanceSerializable) UnmarshalSSZ(buf []byte) error
- type GovernanceVote
- func (g *GovernanceVote) Copy() *GovernanceVote
- func (g *GovernanceVote) Hash() chainhash.Hash
- func (g *GovernanceVote) HashTreeRoot() ([32]byte, error)
- func (g *GovernanceVote) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (g *GovernanceVote) Marshal() ([]byte, error)
- func (g *GovernanceVote) MarshalSSZ() ([]byte, error)
- func (g *GovernanceVote) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (g *GovernanceVote) SignatureHash() chainhash.Hash
- func (g *GovernanceVote) SizeSSZ() (size int)
- func (g *GovernanceVote) Unmarshal(b []byte) error
- func (g *GovernanceVote) UnmarshalSSZ(buf []byte) error
- func (g *GovernanceVote) Valid() bool
- type MultiValidatorVote
- func (m *MultiValidatorVote) HashTreeRoot() ([32]byte, error)
- func (m *MultiValidatorVote) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (m *MultiValidatorVote) Marshal() ([]byte, error)
- func (m *MultiValidatorVote) MarshalSSZ() ([]byte, error)
- func (m *MultiValidatorVote) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (m *MultiValidatorVote) Signature() (*bls.Signature, error)
- func (m *MultiValidatorVote) SizeSSZ() (size int)
- func (m *MultiValidatorVote) Unmarshal(b []byte) error
- func (m *MultiValidatorVote) UnmarshalSSZ(buf []byte) error
- type ProposerSlashing
- func (p *ProposerSlashing) GetSignature1() (*bls.Signature, error)
- func (p *ProposerSlashing) GetSignature2() (*bls.Signature, error)
- func (p *ProposerSlashing) GetValidatorPubkey() (*bls.PublicKey, error)
- func (p *ProposerSlashing) Hash() chainhash.Hash
- func (p *ProposerSlashing) HashTreeRoot() ([32]byte, error)
- func (p *ProposerSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (p *ProposerSlashing) Marshal() ([]byte, error)
- func (p *ProposerSlashing) MarshalSSZ() ([]byte, error)
- func (p *ProposerSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (p *ProposerSlashing) SizeSSZ() (size int)
- func (p *ProposerSlashing) Unmarshal(b []byte) error
- func (p *ProposerSlashing) UnmarshalSSZ(buf []byte) error
- type RANDAOSlashing
- func (r *RANDAOSlashing) GetRandaoReveal() (*bls.Signature, error)
- func (r *RANDAOSlashing) GetValidatorPubkey() (*bls.PublicKey, error)
- func (r *RANDAOSlashing) Hash() chainhash.Hash
- func (r *RANDAOSlashing) HashTreeRoot() ([32]byte, error)
- func (r *RANDAOSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (r *RANDAOSlashing) Marshal() ([]byte, error)
- func (r *RANDAOSlashing) MarshalSSZ() ([]byte, error)
- func (r *RANDAOSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (r *RANDAOSlashing) SizeSSZ() (size int)
- func (r *RANDAOSlashing) Unmarshal(b []byte) error
- func (r *RANDAOSlashing) UnmarshalSSZ(buf []byte) error
- type ReplacementVotes
- func (r *ReplacementVotes) HashTreeRoot() ([32]byte, error)
- func (r *ReplacementVotes) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (r *ReplacementVotes) Marshal() ([]byte, error)
- func (r *ReplacementVotes) MarshalSSZ() ([]byte, error)
- func (r *ReplacementVotes) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (r *ReplacementVotes) SizeSSZ() (size int)
- func (r *ReplacementVotes) Unmarshal(b []byte) error
- func (r *ReplacementVotes) UnmarshalSSZ(buf []byte) error
- type SerializableState
- func (s *SerializableState) HashTreeRoot() ([32]byte, error)
- func (s *SerializableState) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (s *SerializableState) Marshal() ([]byte, error)
- func (s *SerializableState) MarshalSSZ() ([]byte, error)
- func (s *SerializableState) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (s *SerializableState) SizeSSZ() (size int)
- func (s *SerializableState) Unmarshal(b []byte) error
- func (s *SerializableState) UnmarshalSSZ(buf []byte) error
- type Tx
- func (t Tx) FromPubkeyHash() ([20]byte, error)
- func (t Tx) GetPublic() (*bls.PublicKey, error)
- func (t Tx) GetSignature() (*bls.Signature, error)
- func (t *Tx) Hash() chainhash.Hash
- func (t *Tx) HashTreeRoot() ([32]byte, error)
- func (t *Tx) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (t *Tx) Marshal() ([]byte, error)
- func (t *Tx) MarshalSSZ() ([]byte, error)
- func (t *Tx) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (t Tx) SignatureMessage() chainhash.Hash
- func (t *Tx) SizeSSZ() (size int)
- func (t *Tx) Unmarshal(b []byte) error
- func (t *Tx) UnmarshalSSZ(buf []byte) error
- func (t *Tx) VerifySig() error
- type TxMulti
- func (t TxMulti) FromPubkeyHash() ([20]byte, error)
- func (t *TxMulti) Hash() chainhash.Hash
- func (t *TxMulti) HashTreeRoot() ([32]byte, error)
- func (t *TxMulti) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (t *TxMulti) Marshal() ([]byte, error)
- func (t *TxMulti) MarshalSSZ() ([]byte, error)
- func (t *TxMulti) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (t TxMulti) SignatureMessage() chainhash.Hash
- func (t *TxMulti) SizeSSZ() (size int)
- func (t *TxMulti) Unmarshal(b []byte) error
- func (t *TxMulti) UnmarshalSSZ(buf []byte) error
- func (t *TxMulti) VerifySig() error
- type UpdateWitness
- type Validator
- func (v *Validator) Copy() Validator
- func (v *Validator) HashTreeRoot() ([32]byte, error)
- func (v *Validator) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (v *Validator) IsActive() bool
- func (v *Validator) IsActiveAtEpoch(epoch uint64) bool
- func (v *Validator) Marshal() ([]byte, error)
- func (v *Validator) MarshalSSZ() ([]byte, error)
- func (v *Validator) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (v *Validator) SizeSSZ() (size int)
- func (v *Validator) StatusString() string
- func (v *Validator) Unmarshal(b []byte) error
- func (v *Validator) UnmarshalSSZ(buf []byte) error
- type ValidatorHelloMessage
- func (v *ValidatorHelloMessage) HashTreeRoot() ([32]byte, error)
- func (v *ValidatorHelloMessage) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (v *ValidatorHelloMessage) Marshal() ([]byte, error)
- func (v *ValidatorHelloMessage) MarshalSSZ() ([]byte, error)
- func (v *ValidatorHelloMessage) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (v *ValidatorHelloMessage) SignatureMessage() []byte
- func (v *ValidatorHelloMessage) SizeSSZ() (size int)
- func (v *ValidatorHelloMessage) Unmarshal(b []byte) error
- func (v *ValidatorHelloMessage) UnmarshalSSZ(buf []byte) error
- type VerificationWitness
- type VoteData
- func (v *VoteData) Copy() VoteData
- func (v *VoteData) Equals(other *VoteData) bool
- func (v *VoteData) FirstSlotValid(p *params.ChainParams) uint64
- func (v *VoteData) Hash() chainhash.Hash
- func (v *VoteData) HashTreeRoot() ([32]byte, error)
- func (v *VoteData) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (v *VoteData) IsDoubleVote(v2 *VoteData) bool
- func (v *VoteData) IsSurroundVote(v2 *VoteData) bool
- func (v *VoteData) LastSlotValid(p *params.ChainParams) uint64
- func (v *VoteData) Marshal() ([]byte, error)
- func (v *VoteData) MarshalSSZ() ([]byte, error)
- func (v *VoteData) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (v *VoteData) SizeSSZ() (size int)
- func (v *VoteData) String() string
- func (v *VoteData) Unmarshal(b []byte) error
- func (v *VoteData) UnmarshalSSZ(buf []byte) error
- type VoteSlashing
- func (v *VoteSlashing) Hash() chainhash.Hash
- func (v *VoteSlashing) HashTreeRoot() ([32]byte, error)
- func (v *VoteSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error)
- func (v *VoteSlashing) Marshal() ([]byte, error)
- func (v *VoteSlashing) MarshalSSZ() ([]byte, error)
- func (v *VoteSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (v *VoteSlashing) SizeSSZ() (size int)
- func (v *VoteSlashing) Unmarshal(b []byte) error
- func (v *VoteSlashing) UnmarshalSSZ(buf []byte) error
Constants ¶
const ( RewardMatchedFromEpoch uint64 = iota PenaltyMissingFromEpoch RewardMatchedToEpoch PenaltyMissingToEpoch RewardMatchedBeaconBlock PenaltyMissingBeaconBlock RewardIncludedVote RewardInclusionDistance PenaltyInactivityLeak PenaltyInactivityLeakNoVote )
const ( // MaxReplacementsVoteSize is the maximum amount of bytes a ReplacementVotes can have MaxReplacementsVoteSize = 52 // MaxGovernanceVoteSize is the maximum amount of bytes a GovernanceVote can have MaxGovernanceVoteSize = 116 + multisig.MaxMultisigSize // MaxCommunityVoteDataSize is the maximum amount of bytes a CommunityVoteData can have MaxCommunityVoteDataSize = 104 )
const ( // EnterVotingPeriod can be done by anyone on the network to signal that they // want a voting period to start. EnterVotingPeriod uint64 = iota // VoteFor can be done by anyone on the network during a voting period to vote // for a specific assignment of managers. VoteFor // UpdateManagersInstantly updates the current managers on the condition that // the signature is signed by 5/5 of the managers. UpdateManagersInstantly // UpdateManagersVote immediately triggers a community vote to re-elect certain // managers on the condition that the signature is signed by 3/5 of the managers. UpdateManagersVote )
const ( // StatusStarting is when the validator is waiting to join. StatusStarting uint64 = iota // StatusActive is when the validator is currently in the queue. StatusActive // StatusActivePendingExit is when a validator is queued to be removed from the // active set. StatusActivePendingExit // StatusExitedWithPenalty is when the validator is exited due to a slashing condition // being violated. StatusExitedWithPenalty // StatusExitedWithoutPenalty is when a validator is exited due to a drop below // the ejection balance. StatusExitedWithoutPenalty )
const MaxBlockHeaderBytes = 372
MaxBlockHeaderBytes is the maximum amount of bytes a header can contain.
const MaxBlockSize = 1024 * 1024 * 2.5 // 2.5 MB
MaxBlockSize defines the maximum bytes on a block object.
const MaxDepositDataSize = 164
MaxDepositDataSize is the maximum amount of bytes the deposit data can contain.
const MaxDepositSize = MaxDepositDataSize + 48 + 96
MaxDepositSize is the maximum amount of bytes a deposit can contain.
const MaxExitSize = 192
MaxExitSize is the maximum amount of bytes an exit can contain.
const ( // MaxTransactionSize is the maximum size of the transaction information with a single transfer payload MaxTransactionMultiSize = multisig.MaxMultisigSize + 20 + 8 + 8 + 8 )
const (
// MaxTransactionSize is the maximum size of the transaction information with a single transfer payload
MaxTransactionSize = 188
)
const (
// MaxValidatorHelloMessageSize is the maximum amount of bytes a CombinedSignature can contain.
MaxValidatorHelloMessageSize = 160
)
Variables ¶
var EmptyTree = chainhash.Hash{}
EmptyTree is the hash of an empty tree.
var EmptyTrees [256]chainhash.Hash
EmptyTrees are empty trees for each level.
var ErrorBlockHeaderSize = errors.New("blockheader size is too big")
ErrorBlockHeaderSize returns when the Blockheader decompresed size is above MaxBlockHeaderBytes
var ( // ErrorInvalidSignature returned when a tx signature is invalid. ErrorInvalidSignature = errors.New("invalid tx signature") )
var ( // ErrorMultiInvalidSignature returned when a tx signature is invalid. ErrorMultiInvalidSignature = errors.New("invalid tx multi signature") )
Functions ¶
Types ¶
type AcceptedVoteInfo ¶
type AcceptedVoteInfo struct { // Data is the data of the vote which specifies the signed part of the attestation. Data *VoteData // ParticipationBitfield is any validator that participated in the vote. // Max size is the same as the MultiValidatorVote bitlist size. ParticipationBitfield bitfield.Bitlist `ssz:"bitlist" ssz-max:"6250"` // Proposer is the proposer that included the attestation in a block. Proposer uint64 // InclusionDelay is the delay from the attestation slot to the slot included. InclusionDelay uint64 }
AcceptedVoteInfo is vote data and participation for accepted votes.
func (*AcceptedVoteInfo) Copy ¶
func (a *AcceptedVoteInfo) Copy() AcceptedVoteInfo
Copy returns a copy of the AcceptedVoteInfo.
func (*AcceptedVoteInfo) HashTreeRoot ¶
func (a *AcceptedVoteInfo) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the AcceptedVoteInfo object
func (*AcceptedVoteInfo) HashTreeRootWith ¶
func (a *AcceptedVoteInfo) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the AcceptedVoteInfo object with a hasher
func (*AcceptedVoteInfo) Marshal ¶
func (a *AcceptedVoteInfo) Marshal() ([]byte, error)
Marshal encodes the data.
func (*AcceptedVoteInfo) MarshalSSZ ¶
func (a *AcceptedVoteInfo) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the AcceptedVoteInfo object
func (*AcceptedVoteInfo) MarshalSSZTo ¶
func (a *AcceptedVoteInfo) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the AcceptedVoteInfo object to a target array
func (*AcceptedVoteInfo) SizeSSZ ¶
func (a *AcceptedVoteInfo) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the AcceptedVoteInfo object
func (*AcceptedVoteInfo) Unmarshal ¶
func (a *AcceptedVoteInfo) Unmarshal(b []byte) error
Unmarshal decodes the data.
func (*AcceptedVoteInfo) UnmarshalSSZ ¶
func (a *AcceptedVoteInfo) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the AcceptedVoteInfo object
type AccountInfo ¶
AccountInfo is the information contained into both slices. It represents the account hash and a value.
func (*AccountInfo) HashTreeRoot ¶
func (a *AccountInfo) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the AccountInfo object
func (*AccountInfo) HashTreeRootWith ¶
func (a *AccountInfo) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the AccountInfo object with a hasher
func (*AccountInfo) MarshalSSZ ¶
func (a *AccountInfo) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the AccountInfo object
func (*AccountInfo) MarshalSSZTo ¶
func (a *AccountInfo) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the AccountInfo object to a target array
func (*AccountInfo) SizeSSZ ¶
func (a *AccountInfo) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the AccountInfo object
func (*AccountInfo) UnmarshalSSZ ¶
func (a *AccountInfo) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the AccountInfo object
type Block ¶
type Block struct { Header *BlockHeader // = 372 bytes Votes []*MultiValidatorVote `ssz-max:"32"` // MaxVotesPerBlock 32 * 6474 = 207168 bytes Txs []*Tx `ssz-max:"5000"` // MaxTxsPerBlock 204 * 5000 = 1020000 bytes TxsMulti []*TxMulti `ssz-max:"128"` // MaxTxsPerBlock Deposits []*Deposit `ssz-max:"128"` // MaxDepositsPerBlock 308 * 128 = 39424 bytes Exits []*Exit `ssz-max:"128"` // MaxExitsPerBlock 192 * 128 = 24576 bytes VoteSlashings []*VoteSlashing `ssz-max:"10"` // MaxVoteSlashingPerBlock 666 * 10 = 6660 bytes RANDAOSlashings []*RANDAOSlashing `ssz-max:"20"` // MaxRANDAOSlashingPerBlock 152 * 20 = 3040 bytes ProposerSlashings []*ProposerSlashing `ssz-max:"2"` // MaxProposerSlashingPerBlock 984 * 2 = 1968 bytes GovernanceVotes []*GovernanceVote `ssz-max:"128"` // MaxGovernanceVotesPerBlock 260 * 128 = 33280 bytes Signature [96]byte `ssz-size:"96"` // = 96 bytes RandaoSignature [96]byte `ssz-size:"96"` // = 96 bytes }
Block is a block in the blockchain.
func GetGenesisBlock ¶
func GetGenesisBlock() Block
GetGenesisBlock gets the genesis block for a certain chain parameters.
func (*Block) DepositMerkleRoot ¶
DepositMerkleRoot calculates the merkle root of the Deposits in the block.
func (*Block) ExitMerkleRoot ¶
ExitMerkleRoot calculates the merkle root of the Exits in the block.
func (*Block) GovernanceVoteMerkleRoot ¶
GovernanceVoteMerkleRoot calculates the merkle root of the GovernanceVotes in the block.
func (*Block) HashTreeRoot ¶
HashTreeRoot ssz hashes the Block object
func (*Block) HashTreeRootWith ¶
HashTreeRootWith ssz hashes the Block object with a hasher
func (*Block) MarshalSSZ ¶
MarshalSSZ ssz marshals the Block object
func (*Block) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Block object to a target array
func (*Block) ProposerSlashingsRoot ¶
ProposerSlashingsRoot calculates the merkle root of the ProposerSlashings in the block.
func (*Block) RANDAOSlashingsRoot ¶
RANDAOSlashingsRoot calculates the merkle root of the RANDAOSlashings in the block.
func (*Block) SerializedEpochs ¶
SerializedEpochs return a slice serialized epochs that include one of the passed public keys.
func (*Block) SerializedTx ¶
SerializedTx return a slice serialized transactions that include one of the passed accounts.
func (*Block) TransactionMerkleRoot ¶
TransactionMerkleRoot calculates the merkle root of the Txs in the block.
func (*Block) TransactionMultiMerkleRoot ¶
TransactionMultiMerkleRoot calculates the merkle root of the TxsMulti in the block.
func (*Block) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Block object
func (*Block) VoteSlashingRoot ¶
VoteSlashingRoot calculates the merkle root of the VoteSlashings in the block.
func (*Block) VotesMerkleRoot ¶
VotesMerkleRoot calculates the merkle root of the Votes in the block.
type BlockHeader ¶
type BlockHeader struct { Version uint64 Nonce uint64 TxMerkleRoot [32]byte `ssz-size:"32"` TxMultiMerkleRoot [32]byte `ssz-size:"32"` VoteMerkleRoot [32]byte `ssz-size:"32"` DepositMerkleRoot [32]byte `ssz-size:"32"` ExitMerkleRoot [32]byte `ssz-size:"32"` VoteSlashingMerkleRoot [32]byte `ssz-size:"32"` RANDAOSlashingMerkleRoot [32]byte `ssz-size:"32"` ProposerSlashingMerkleRoot [32]byte `ssz-size:"32"` GovernanceVotesMerkleRoot [32]byte `ssz-size:"32"` PrevBlockHash [32]byte `ssz-size:"32"` Timestamp uint64 Slot uint64 StateRoot [32]byte `ssz-size:"32"` FeeAddress [20]byte `ssz-size:"20"` }
BlockHeader is the container of merkle roots for the blockchain
func (*BlockHeader) Hash ¶
func (b *BlockHeader) Hash() chainhash.Hash
Hash calculates the hash of the block header.
func (*BlockHeader) HashTreeRoot ¶
func (b *BlockHeader) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the BlockHeader object
func (*BlockHeader) HashTreeRootWith ¶
func (b *BlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the BlockHeader object with a hasher
func (*BlockHeader) Marshal ¶
func (b *BlockHeader) Marshal() ([]byte, error)
Marshal encodes the data.
func (*BlockHeader) MarshalSSZ ¶
func (b *BlockHeader) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the BlockHeader object
func (*BlockHeader) MarshalSSZTo ¶
func (b *BlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the BlockHeader object to a target array
func (*BlockHeader) SizeSSZ ¶
func (b *BlockHeader) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the BlockHeader object
func (*BlockHeader) Unmarshal ¶
func (b *BlockHeader) Unmarshal(by []byte) error
Unmarshal decodes the data.
func (*BlockHeader) UnmarshalSSZ ¶
func (b *BlockHeader) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the BlockHeader object
type BlockNodeDisk ¶
type BlockNodeDisk struct { StateRoot [32]byte `ssz-size:"32"` Height uint64 Slot uint64 Children [][32]byte `ssz-max:"64"` Hash [32]byte `ssz-size:"32"` Parent [32]byte `ssz-size:"32"` }
BlockNodeDisk is a block node stored on disk.
func (*BlockNodeDisk) HashTreeRoot ¶
func (b *BlockNodeDisk) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the BlockNodeDisk object
func (*BlockNodeDisk) HashTreeRootWith ¶
func (b *BlockNodeDisk) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the BlockNodeDisk object with a hasher
func (*BlockNodeDisk) Marshal ¶
func (b *BlockNodeDisk) Marshal() ([]byte, error)
Marshal encodes de data
func (*BlockNodeDisk) MarshalSSZ ¶
func (b *BlockNodeDisk) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the BlockNodeDisk object
func (*BlockNodeDisk) MarshalSSZTo ¶
func (b *BlockNodeDisk) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the BlockNodeDisk object to a target array
func (*BlockNodeDisk) SizeSSZ ¶
func (b *BlockNodeDisk) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the BlockNodeDisk object
func (*BlockNodeDisk) Unmarshal ¶
func (b *BlockNodeDisk) Unmarshal(by []byte) error
Unmarshal decodes the data
func (*BlockNodeDisk) UnmarshalSSZ ¶
func (b *BlockNodeDisk) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the BlockNodeDisk object
type CoinsState ¶
type CoinsState struct { Balances map[[20]byte]uint64 Nonces map[[20]byte]uint64 ProofsVerified map[[32]byte]struct{} }
CoinsState is the state that we use to store accounts balances and Nonces
func (*CoinsState) Copy ¶
func (u *CoinsState) Copy() CoinsState
Copy copies CoinsState and returns a new one.
func (*CoinsState) FromSerializable ¶
func (u *CoinsState) FromSerializable(ser *CoinsStateSerializable)
FromSerializable creates a CoinsState
func (*CoinsState) GetTotal ¶
func (u *CoinsState) GetTotal() uint64
GetTotal returns the total supply on the state
func (*CoinsState) Marshal ¶
func (u *CoinsState) Marshal() ([]byte, error)
Marshal serialize to bytes the struct
func (*CoinsState) ToSerializable ¶
func (u *CoinsState) ToSerializable() CoinsStateSerializable
ToSerializable converts the struct from maps to slices.
func (*CoinsState) Unmarshal ¶
func (u *CoinsState) Unmarshal(b []byte) error
Unmarshal deserialize the bytes to struct
type CoinsStateSerializable ¶
type CoinsStateSerializable struct { Balances []*AccountInfo `ssz-max:"2097152"` Nonces []*AccountInfo `ssz-max:"2097152"` Proofs [][32]byte `ssz-max:"2097152"` }
CoinsStateSerializable is a struct to properly serialize the coinstate efficiently
func (*CoinsStateSerializable) HashTreeRoot ¶
func (c *CoinsStateSerializable) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the CoinsStateSerializable object
func (*CoinsStateSerializable) HashTreeRootWith ¶
func (c *CoinsStateSerializable) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the CoinsStateSerializable object with a hasher
func (*CoinsStateSerializable) Marshal ¶
func (c *CoinsStateSerializable) Marshal() ([]byte, error)
func (*CoinsStateSerializable) MarshalSSZ ¶
func (c *CoinsStateSerializable) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the CoinsStateSerializable object
func (*CoinsStateSerializable) MarshalSSZTo ¶
func (c *CoinsStateSerializable) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the CoinsStateSerializable object to a target array
func (*CoinsStateSerializable) SizeSSZ ¶
func (c *CoinsStateSerializable) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the CoinsStateSerializable object
func (*CoinsStateSerializable) Unmarshal ¶
func (c *CoinsStateSerializable) Unmarshal(b []byte) error
func (*CoinsStateSerializable) UnmarshalSSZ ¶
func (c *CoinsStateSerializable) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the CoinsStateSerializable object
type CommunityVoteData ¶
type CommunityVoteData struct {
ReplacementCandidates [][20]byte `ssz-max:"5"`
}
CommunityVoteData is the votes that users sign to vote for a specific candidate.
func (*CommunityVoteData) Copy ¶
func (c *CommunityVoteData) Copy() *CommunityVoteData
Copy copies the community vote data.
func (*CommunityVoteData) Hash ¶
func (c *CommunityVoteData) Hash() chainhash.Hash
Hash calculates the hash of the vote data.
func (*CommunityVoteData) HashTreeRoot ¶
func (c *CommunityVoteData) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the CommunityVoteData object
func (*CommunityVoteData) HashTreeRootWith ¶
func (c *CommunityVoteData) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the CommunityVoteData object with a hasher
func (*CommunityVoteData) Marshal ¶
func (c *CommunityVoteData) Marshal() ([]byte, error)
Marshal encodes the data.
func (*CommunityVoteData) MarshalSSZ ¶
func (c *CommunityVoteData) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the CommunityVoteData object
func (*CommunityVoteData) MarshalSSZTo ¶
func (c *CommunityVoteData) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the CommunityVoteData object to a target array
func (*CommunityVoteData) SizeSSZ ¶
func (c *CommunityVoteData) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the CommunityVoteData object
func (*CommunityVoteData) Unmarshal ¶
func (c *CommunityVoteData) Unmarshal(b []byte) error
Unmarshal decodes the data.
func (*CommunityVoteData) UnmarshalSSZ ¶
func (c *CommunityVoteData) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the CommunityVoteData object
type CommunityVoteDataInfo ¶
type CommunityVoteDataInfo struct { Hash [32]byte `ssz-size:"32"` Data *CommunityVoteData }
CommunityVoteDataInfo contains information about a community vote.
func (*CommunityVoteDataInfo) HashTreeRoot ¶
func (c *CommunityVoteDataInfo) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the CommunityVoteDataInfo object
func (*CommunityVoteDataInfo) HashTreeRootWith ¶
func (c *CommunityVoteDataInfo) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the CommunityVoteDataInfo object with a hasher
func (*CommunityVoteDataInfo) MarshalSSZ ¶
func (c *CommunityVoteDataInfo) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the CommunityVoteDataInfo object
func (*CommunityVoteDataInfo) MarshalSSZTo ¶
func (c *CommunityVoteDataInfo) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the CommunityVoteDataInfo object to a target array
func (*CommunityVoteDataInfo) SizeSSZ ¶
func (c *CommunityVoteDataInfo) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the CommunityVoteDataInfo object
func (*CommunityVoteDataInfo) UnmarshalSSZ ¶
func (c *CommunityVoteDataInfo) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the CommunityVoteDataInfo object
type Deposit ¶
type Deposit struct { // PublicKey is the public key of the address that is depositing. PublicKey [48]byte // Signature is the signature signing the deposit data. Signature [96]byte // Data is the data that describes the new validator. Data *DepositData }
Deposit is a deposit a user can submit to queue as a validator.
func (*Deposit) GetPublicKey ¶
GetPublicKey returns the bls public key of the deposit.
func (*Deposit) GetSignature ¶
GetSignature returns the bls signature of the deposit.
func (*Deposit) HashTreeRoot ¶
HashTreeRoot ssz hashes the Deposit object
func (*Deposit) HashTreeRootWith ¶
HashTreeRootWith ssz hashes the Deposit object with a hasher
func (*Deposit) MarshalSSZ ¶
MarshalSSZ ssz marshals the Deposit object
func (*Deposit) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Deposit object to a target array
func (*Deposit) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Deposit object
type DepositData ¶
type DepositData struct { // PublicKey is the key used for the validator. PublicKey [48]byte // ProofOfPossession is the public key signed by the private key to prove that you own the address and prevent rogue public-key attacks. ProofOfPossession [96]byte // WithdrawalAddress is the address to withdraw to. WithdrawalAddress [20]byte }
DepositData is the part of the deposit that is signed
func (*DepositData) GetPublicKey ¶
func (d *DepositData) GetPublicKey() (*bls.PublicKey, error)
GetPublicKey returns the bls public key of the deposit data.
func (*DepositData) GetSignature ¶
func (d *DepositData) GetSignature() (*bls.Signature, error)
GetSignature returns the bls signature of the deposit data.
func (*DepositData) HashTreeRoot ¶
func (d *DepositData) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the DepositData object
func (*DepositData) HashTreeRootWith ¶
func (d *DepositData) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the DepositData object with a hasher
func (*DepositData) Marshal ¶
func (d *DepositData) Marshal() ([]byte, error)
Marshal encodes the data.
func (*DepositData) MarshalSSZ ¶
func (d *DepositData) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the DepositData object
func (*DepositData) MarshalSSZTo ¶
func (d *DepositData) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the DepositData object to a target array
func (*DepositData) SizeSSZ ¶
func (d *DepositData) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the DepositData object
func (*DepositData) Unmarshal ¶
func (d *DepositData) Unmarshal(b []byte) error
Unmarshal decodes the data.
func (*DepositData) UnmarshalSSZ ¶
func (d *DepositData) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the DepositData object
type EpochReceipt ¶
EpochReceipt is a balance change carried our by an epoch transition.
func (*EpochReceipt) String ¶
func (e *EpochReceipt) String() string
func (EpochReceipt) TypeString ¶
func (e EpochReceipt) TypeString() string
type Exit ¶
Exit exits the validator from the queue.
func (*Exit) GetSignature ¶
GetSignature returns the exit bls signature.
func (*Exit) GetValidatorPubKey ¶
GetValidatorPubKey returns the validator bls public key
func (*Exit) GetWithdrawPubKey ¶
GetWithdrawPubKey returns the withdraw bls public key
func (*Exit) HashTreeRoot ¶
HashTreeRoot ssz hashes the Exit object
func (*Exit) HashTreeRootWith ¶
HashTreeRootWith ssz hashes the Exit object with a hasher
func (*Exit) MarshalSSZ ¶
MarshalSSZ ssz marshals the Exit object
func (*Exit) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Exit object to a target array
func (*Exit) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Exit object
type Governance ¶
type Governance struct { ReplaceVotes map[[20]byte]chainhash.Hash CommunityVotes map[chainhash.Hash]CommunityVoteData }
Governance is a struct that contains CommunityVotes and ReplacementVotes indexes and slices.
func (*Governance) Copy ¶
func (g *Governance) Copy() Governance
Copy copies Governance and returns a new one
func (*Governance) FromSerializable ¶
func (g *Governance) FromSerializable(s *GovernanceSerializable)
FromSerializable creates the struct into a map based struct
func (*Governance) Marshal ¶
func (g *Governance) Marshal() ([]byte, error)
Marshal serializes the struct to bytes
func (*Governance) ToSerializable ¶
func (g *Governance) ToSerializable() GovernanceSerializable
ToSerializable creates a copy of the struct into a slices struct
func (*Governance) Unmarshal ¶
func (g *Governance) Unmarshal(b []byte) error
Unmarshal deserialize the bytes to a struct
type GovernanceSerializable ¶
type GovernanceSerializable struct { ReplaceVotes []*ReplacementVotes `ssz-max:"2097152"` CommunityVotes []*CommunityVoteDataInfo `ssz-max:"2097152"` }
GovernanceSerializable is a struct that contains the Governance state on a serializable struct.
func (*GovernanceSerializable) HashTreeRoot ¶
func (g *GovernanceSerializable) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the GovernanceSerializable object
func (*GovernanceSerializable) HashTreeRootWith ¶
func (g *GovernanceSerializable) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the GovernanceSerializable object with a hasher
func (*GovernanceSerializable) MarshalSSZ ¶
func (g *GovernanceSerializable) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the GovernanceSerializable object
func (*GovernanceSerializable) MarshalSSZTo ¶
func (g *GovernanceSerializable) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the GovernanceSerializable object to a target array
func (*GovernanceSerializable) SizeSSZ ¶
func (g *GovernanceSerializable) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the GovernanceSerializable object
func (*GovernanceSerializable) UnmarshalSSZ ¶
func (g *GovernanceSerializable) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the GovernanceSerializable object
type GovernanceVote ¶
type GovernanceVote struct { Type uint64 Data [100]byte Multisig *multisig.Multisig VoteEpoch uint64 }
GovernanceVote is a vote for governance.
func (*GovernanceVote) Copy ¶
func (g *GovernanceVote) Copy() *GovernanceVote
Copy copies the governance vote.
func (*GovernanceVote) Hash ¶
func (g *GovernanceVote) Hash() chainhash.Hash
Hash calculates the hash of the governance vote.
func (*GovernanceVote) HashTreeRoot ¶
func (g *GovernanceVote) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the GovernanceVote object
func (*GovernanceVote) HashTreeRootWith ¶
func (g *GovernanceVote) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the GovernanceVote object with a hasher
func (*GovernanceVote) Marshal ¶
func (g *GovernanceVote) Marshal() ([]byte, error)
Marshal encodes the data.
func (*GovernanceVote) MarshalSSZ ¶
func (g *GovernanceVote) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the GovernanceVote object
func (*GovernanceVote) MarshalSSZTo ¶
func (g *GovernanceVote) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the GovernanceVote object to a target array
func (*GovernanceVote) SignatureHash ¶
func (g *GovernanceVote) SignatureHash() chainhash.Hash
SignatureHash gets the signed part of the hash.
func (*GovernanceVote) SizeSSZ ¶
func (g *GovernanceVote) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the GovernanceVote object
func (*GovernanceVote) Unmarshal ¶
func (g *GovernanceVote) Unmarshal(b []byte) error
Unmarshal decodes the data.
func (*GovernanceVote) UnmarshalSSZ ¶
func (g *GovernanceVote) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the GovernanceVote object
func (*GovernanceVote) Valid ¶
func (g *GovernanceVote) Valid() bool
Valid returns a boolean that checks for validity of the vote
type MultiValidatorVote ¶
type MultiValidatorVote struct { // Data defines the vote properties. Data *VoteData // Sig is the aggregated signature for all validators voting for the VoteData. Sig [96]byte // ParticipationBitfield is a bitlist that marks the index of the validators voting. ParticipationBitfield bitfield.Bitlist `ssz:"bitlist" ssz-max:"6258"` }
MultiValidatorVote is a vote signed by one or many validators.
func (*MultiValidatorVote) HashTreeRoot ¶
func (m *MultiValidatorVote) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the MultiValidatorVote object
func (*MultiValidatorVote) HashTreeRootWith ¶
func (m *MultiValidatorVote) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the MultiValidatorVote object with a hasher
func (*MultiValidatorVote) Marshal ¶
func (m *MultiValidatorVote) Marshal() ([]byte, error)
Marshal encodes the data.
func (*MultiValidatorVote) MarshalSSZ ¶
func (m *MultiValidatorVote) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the MultiValidatorVote object
func (*MultiValidatorVote) MarshalSSZTo ¶
func (m *MultiValidatorVote) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the MultiValidatorVote object to a target array
func (*MultiValidatorVote) Signature ¶
func (m *MultiValidatorVote) Signature() (*bls.Signature, error)
Signature returns the signature on BLS type
func (*MultiValidatorVote) SizeSSZ ¶
func (m *MultiValidatorVote) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the MultiValidatorVote object
func (*MultiValidatorVote) Unmarshal ¶
func (m *MultiValidatorVote) Unmarshal(b []byte) error
Unmarshal decodes the data.
func (*MultiValidatorVote) UnmarshalSSZ ¶
func (m *MultiValidatorVote) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the MultiValidatorVote object
type ProposerSlashing ¶
type ProposerSlashing struct { BlockHeader1 *BlockHeader BlockHeader2 *BlockHeader Signature1 [96]byte `ssz-size:"96"` Signature2 [96]byte `ssz-size:"96"` ValidatorPublicKey [48]byte `ssz-size:"48"` }
ProposerSlashing is a slashing to a block proposer that proposed two blocks at the same slot.
func (*ProposerSlashing) GetSignature1 ¶
func (p *ProposerSlashing) GetSignature1() (*bls.Signature, error)
GetSignature1 returns the slashing first bls validator signature.
func (*ProposerSlashing) GetSignature2 ¶
func (p *ProposerSlashing) GetSignature2() (*bls.Signature, error)
GetSignature2 returns the slashing second bls validator signature.
func (*ProposerSlashing) GetValidatorPubkey ¶
func (p *ProposerSlashing) GetValidatorPubkey() (*bls.PublicKey, error)
GetValidatorPubkey returns the slashing bls validator public key.
func (*ProposerSlashing) Hash ¶
func (p *ProposerSlashing) Hash() chainhash.Hash
Hash calculates the hash of the proposer slashing.
func (*ProposerSlashing) HashTreeRoot ¶
func (p *ProposerSlashing) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the ProposerSlashing object
func (*ProposerSlashing) HashTreeRootWith ¶
func (p *ProposerSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the ProposerSlashing object with a hasher
func (*ProposerSlashing) Marshal ¶
func (p *ProposerSlashing) Marshal() ([]byte, error)
Marshal encodes the data.
func (*ProposerSlashing) MarshalSSZ ¶
func (p *ProposerSlashing) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the ProposerSlashing object
func (*ProposerSlashing) MarshalSSZTo ¶
func (p *ProposerSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the ProposerSlashing object to a target array
func (*ProposerSlashing) SizeSSZ ¶
func (p *ProposerSlashing) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the ProposerSlashing object
func (*ProposerSlashing) Unmarshal ¶
func (p *ProposerSlashing) Unmarshal(b []byte) error
Unmarshal decodes the data.
func (*ProposerSlashing) UnmarshalSSZ ¶
func (p *ProposerSlashing) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the ProposerSlashing object
type RANDAOSlashing ¶
RANDAOSlashing is a slashing where a validator reveals their RANDAO signature too early.
func (*RANDAOSlashing) GetRandaoReveal ¶
func (r *RANDAOSlashing) GetRandaoReveal() (*bls.Signature, error)
GetRandaoReveal returns the bls signature of the randao reveal.
func (*RANDAOSlashing) GetValidatorPubkey ¶
func (r *RANDAOSlashing) GetValidatorPubkey() (*bls.PublicKey, error)
GetValidatorPubkey returns the validator bls public key.
func (*RANDAOSlashing) Hash ¶
func (r *RANDAOSlashing) Hash() chainhash.Hash
Hash calculates the hash of the RANDAO slashing.
func (*RANDAOSlashing) HashTreeRoot ¶
func (r *RANDAOSlashing) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the RANDAOSlashing object
func (*RANDAOSlashing) HashTreeRootWith ¶
func (r *RANDAOSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the RANDAOSlashing object with a hasher
func (*RANDAOSlashing) Marshal ¶
func (r *RANDAOSlashing) Marshal() ([]byte, error)
Marshal encodes the data.
func (*RANDAOSlashing) MarshalSSZ ¶
func (r *RANDAOSlashing) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the RANDAOSlashing object
func (*RANDAOSlashing) MarshalSSZTo ¶
func (r *RANDAOSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the RANDAOSlashing object to a target array
func (*RANDAOSlashing) SizeSSZ ¶
func (r *RANDAOSlashing) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the RANDAOSlashing object
func (*RANDAOSlashing) Unmarshal ¶
func (r *RANDAOSlashing) Unmarshal(b []byte) error
Unmarshal decodes the data.
func (*RANDAOSlashing) UnmarshalSSZ ¶
func (r *RANDAOSlashing) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the RANDAOSlashing object
type ReplacementVotes ¶
ReplacementVotes contains information about a replacement candidate selected.
func (*ReplacementVotes) HashTreeRoot ¶
func (r *ReplacementVotes) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the ReplacementVotes object
func (*ReplacementVotes) HashTreeRootWith ¶
func (r *ReplacementVotes) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the ReplacementVotes object with a hasher
func (*ReplacementVotes) Marshal ¶
func (r *ReplacementVotes) Marshal() ([]byte, error)
Marshal encodes the data.
func (*ReplacementVotes) MarshalSSZ ¶
func (r *ReplacementVotes) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the ReplacementVotes object
func (*ReplacementVotes) MarshalSSZTo ¶
func (r *ReplacementVotes) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the ReplacementVotes object to a target array
func (*ReplacementVotes) SizeSSZ ¶
func (r *ReplacementVotes) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the ReplacementVotes object
func (*ReplacementVotes) Unmarshal ¶
func (r *ReplacementVotes) Unmarshal(b []byte) error
Unmarshal decodes the data.
func (*ReplacementVotes) UnmarshalSSZ ¶
func (r *ReplacementVotes) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the ReplacementVotes object
type SerializableState ¶
type SerializableState struct { // CoinsState keeps if accounts balances and transactions. CoinsState *CoinsStateSerializable // ValidatorRegistry keeps track of validators in the state. ValidatorRegistry []*Validator `ssz-max:"2097152"` // LatestValidatorRegistryChange keeps track of the last time the validator // registry was changed. We only want to update the registry if a block was // finalized since the last time it was changed, so we keep track of that // here. LatestValidatorRegistryChange uint64 // RANDAO for figuring out the proposer queue. We don't want any one validator // to have influence over the RANDAO, so we have each proposer contribute. RANDAO [32]byte `ssz-size:"32"` // NextRANDAO is the RANDAO currently being created. Every time a block is // created, we XOR the 32 least-significant bytes of the RandaoReveal with this // value to update it. NextRANDAO [32]byte `ssz-size:"32"` // Slot is the last slot ProcessSlot was called for. Slot uint64 // EpochIndex is the last epoch ProcessEpoch was called for. EpochIndex uint64 // ProposerQueue is the queue of validators scheduled to create a block. ProposerQueue []uint64 `ssz-max:"2097152"` PreviousEpochVoteAssignments []uint64 `ssz-max:"2097152"` CurrentEpochVoteAssignments []uint64 `ssz-max:"2097152"` // NextProposerQueue is the queue of validators scheduled to create a block // in the next epoch. NextProposerQueue []uint64 `ssz-max:"2097152"` // JustifiedBitfield is a bitfield where the nth least significant bit // represents whether the nth last epoch was justified. JustificationBitfield uint64 // FinalizedEpoch is the epoch that was finalized. FinalizedEpoch uint64 // LastBlockHashes is the last LastBlockHashesSize block hashes. LatestBlockHashes [][32]byte `ssz-max:"64"` // JustifiedEpoch is the last epoch that >2/3 of validators voted for. JustifiedEpoch uint64 // JustifiedEpochHash is the block hash of the last epoch that >2/3 of validators voted for. JustifiedEpochHash [32]byte `ssz-size:"32"` // CurrentEpochVotes are votes that are being submitted where // the source epoch matches justified epoch. CurrentEpochVotes []*AcceptedVoteInfo `ssz-max:"2097152"` // PreviousJustifiedEpoch is the second-to-last epoch that >2/3 of validators // voted for. PreviousJustifiedEpoch uint64 // PreviousJustifiedEpochHash is the block hash of the last epoch that >2/3 of validators voted for. PreviousJustifiedEpochHash [32]byte `ssz-size:"32"` // PreviousEpochVotes are votes where the FromEpoch matches PreviousJustifiedEpoch. PreviousEpochVotes []*AcceptedVoteInfo `ssz-max:"2097152"` // CurrentManagers are current managers of the governance funds. CurrentManagers [][20]byte `ssz-max:"5"` // ManagerReplacement is a bitfield where the bits of the managers to replace are 1. ManagerReplacement bitfield.Bitlist `ssz:"bitlist" ssz-max:"2048"` // Governance represents current votes state Governance *GovernanceSerializable VoteEpoch uint64 VoteEpochStartSlot uint64 VotingState uint64 LastPaidSlot uint64 }
SerializableState is a serializable copy of the state
func (*SerializableState) HashTreeRoot ¶
func (s *SerializableState) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the SerializableState object
func (*SerializableState) HashTreeRootWith ¶
func (s *SerializableState) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the SerializableState object with a hasher
func (*SerializableState) Marshal ¶
func (s *SerializableState) Marshal() ([]byte, error)
func (*SerializableState) MarshalSSZ ¶
func (s *SerializableState) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the SerializableState object
func (*SerializableState) MarshalSSZTo ¶
func (s *SerializableState) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the SerializableState object to a target array
func (*SerializableState) SizeSSZ ¶
func (s *SerializableState) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the SerializableState object
func (*SerializableState) Unmarshal ¶
func (s *SerializableState) Unmarshal(b []byte) error
func (*SerializableState) UnmarshalSSZ ¶
func (s *SerializableState) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the SerializableState object
type Tx ¶
type Tx struct { To [20]byte FromPublicKey [48]byte Amount uint64 Nonce uint64 Fee uint64 Signature [96]byte }
Tx represents a transaction on the blockchain.
func (Tx) FromPubkeyHash ¶
FromPubkeyHash calculates the hash of the from public key.
func (Tx) GetSignature ¶
GetSignature returns the bls signature of the transaction.
func (*Tx) HashTreeRoot ¶
HashTreeRoot ssz hashes the Tx object
func (*Tx) HashTreeRootWith ¶
HashTreeRootWith ssz hashes the Tx object with a hasher
func (*Tx) MarshalSSZ ¶
MarshalSSZ ssz marshals the Tx object
func (*Tx) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Tx object to a target array
func (Tx) SignatureMessage ¶
SignatureMessage gets the message the needs to be signed.
func (*Tx) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Tx object
type TxMulti ¶
type TxMulti struct { To [20]byte Amount uint64 Nonce uint64 Fee uint64 Signature *multisig.Multisig }
TxMulti represents a transaction on the blockchain using a multi signature
func (TxMulti) FromPubkeyHash ¶
FromPubkeyHash calculates the hash of the from public key.
func (*TxMulti) HashTreeRoot ¶
HashTreeRoot ssz hashes the TxMulti object
func (*TxMulti) HashTreeRootWith ¶
HashTreeRootWith ssz hashes the TxMulti object with a hasher
func (*TxMulti) MarshalSSZ ¶
MarshalSSZ ssz marshals the TxMulti object
func (*TxMulti) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the TxMulti object to a target array
func (TxMulti) SignatureMessage ¶
SignatureMessage gets the message the needs to be signed.
func (*TxMulti) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the TxMulti object
type UpdateWitness ¶
type UpdateWitness struct { Key chainhash.Hash OldValue chainhash.Hash NewValue chainhash.Hash WitnessBitfield chainhash.Hash LastLevel uint8 Witnesses []chainhash.Hash }
UpdateWitness allows an executor to securely update the tree root so that only a single key is changed.
func (*UpdateWitness) Copy ¶
func (uw *UpdateWitness) Copy() UpdateWitness
Copy returns a copy of the update witness.
type Validator ¶
type Validator struct { Balance uint64 PubKey [48]byte PayeeAddress [20]byte Status uint64 FirstActiveEpoch uint64 LastActiveEpoch uint64 }
Validator is a validator in the queue.
func (*Validator) HashTreeRoot ¶
HashTreeRoot ssz hashes the Validator object
func (*Validator) HashTreeRootWith ¶
HashTreeRootWith ssz hashes the Validator object with a hasher
func (*Validator) IsActiveAtEpoch ¶
IsActiveAtEpoch checks if a validator is active at a slot.
func (*Validator) MarshalSSZ ¶
MarshalSSZ ssz marshals the Validator object
func (*Validator) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the Validator object to a target array
func (*Validator) StatusString ¶
StatusString returns the status on human readable string
func (*Validator) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the Validator object
type ValidatorHelloMessage ¶
type ValidatorHelloMessage struct { PublicKey [48]byte Timestamp uint64 Nonce uint64 Signature [96]byte }
ValidatorHelloMessage is a message sent by validators to indicate that they are coming online.
func (*ValidatorHelloMessage) HashTreeRoot ¶
func (v *ValidatorHelloMessage) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the ValidatorHelloMessage object
func (*ValidatorHelloMessage) HashTreeRootWith ¶
func (v *ValidatorHelloMessage) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the ValidatorHelloMessage object with a hasher
func (*ValidatorHelloMessage) Marshal ¶
func (v *ValidatorHelloMessage) Marshal() ([]byte, error)
Marshal serializes the hello message to the given writer.
func (*ValidatorHelloMessage) MarshalSSZ ¶
func (v *ValidatorHelloMessage) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the ValidatorHelloMessage object
func (*ValidatorHelloMessage) MarshalSSZTo ¶
func (v *ValidatorHelloMessage) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the ValidatorHelloMessage object to a target array
func (*ValidatorHelloMessage) SignatureMessage ¶
func (v *ValidatorHelloMessage) SignatureMessage() []byte
SignatureMessage gets the signed portion of the message.
func (*ValidatorHelloMessage) SizeSSZ ¶
func (v *ValidatorHelloMessage) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the ValidatorHelloMessage object
func (*ValidatorHelloMessage) Unmarshal ¶
func (v *ValidatorHelloMessage) Unmarshal(b []byte) error
Unmarshal deserializes the validator hello message from the reader.
func (*ValidatorHelloMessage) UnmarshalSSZ ¶
func (v *ValidatorHelloMessage) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the ValidatorHelloMessage object
type VerificationWitness ¶
type VerificationWitness struct { Key chainhash.Hash Value chainhash.Hash WitnessBitfield chainhash.Hash Witnesses []chainhash.Hash LastLevel uint8 }
VerificationWitness allows an executor to verify a specific node in the tree.
func (*VerificationWitness) Copy ¶
func (vw *VerificationWitness) Copy() VerificationWitness
Copy returns a copy of the update witness.
type VoteData ¶
type VoteData struct { // Slot is the slot the validators were assigned. Slot uint64 // FromEpoch is the source epoch of the vote which should either be // the current justified epoch or the previous justified epoch. FromEpoch uint64 // FromHash is the block hash of the FromEpoch. FromHash [32]byte // ToEpoch is the target epoch of the vote which should either be the // current epoch or the previous epoch. ToEpoch uint64 // ToHash is the block hash of the ToEpoch. ToHash [32]byte // BeaconBlockHash is for the fork choice. BeaconBlockHash [32]byte // Nonce identifies the client that proposed the block. Nonce uint64 }
VoteData is the part of a vote that needs to be signed.
func (*VoteData) FirstSlotValid ¶
func (v *VoteData) FirstSlotValid(p *params.ChainParams) uint64
FirstSlotValid return the first slot valid for current validator vote
func (*VoteData) HashTreeRoot ¶
HashTreeRoot ssz hashes the VoteData object
func (*VoteData) HashTreeRootWith ¶
HashTreeRootWith ssz hashes the VoteData object with a hasher
func (*VoteData) IsDoubleVote ¶
IsDoubleVote checks if the two votes form a double vote.
func (*VoteData) IsSurroundVote ¶
IsSurroundVote checks if the two votes form a surrounded vote.
func (*VoteData) LastSlotValid ¶
func (v *VoteData) LastSlotValid(p *params.ChainParams) uint64
LastSlotValid return the last slot valid for current validator vote
func (*VoteData) MarshalSSZ ¶
MarshalSSZ ssz marshals the VoteData object
func (*VoteData) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the VoteData object to a target array
func (*VoteData) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the VoteData object
type VoteSlashing ¶
type VoteSlashing struct { Vote1 *MultiValidatorVote Vote2 *MultiValidatorVote }
VoteSlashing is a slashing where validators vote in the span of their other votes.
func (*VoteSlashing) Hash ¶
func (v *VoteSlashing) Hash() chainhash.Hash
Hash calculates the hash of the slashing.
func (*VoteSlashing) HashTreeRoot ¶
func (v *VoteSlashing) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the VoteSlashing object
func (*VoteSlashing) HashTreeRootWith ¶
func (v *VoteSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error)
HashTreeRootWith ssz hashes the VoteSlashing object with a hasher
func (*VoteSlashing) Marshal ¶
func (v *VoteSlashing) Marshal() ([]byte, error)
Marshal encodes the data.
func (*VoteSlashing) MarshalSSZ ¶
func (v *VoteSlashing) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the VoteSlashing object
func (*VoteSlashing) MarshalSSZTo ¶
func (v *VoteSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the VoteSlashing object to a target array
func (*VoteSlashing) SizeSSZ ¶
func (v *VoteSlashing) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the VoteSlashing object
func (*VoteSlashing) Unmarshal ¶
func (v *VoteSlashing) Unmarshal(b []byte) error
Unmarshal decodes the data.
func (*VoteSlashing) UnmarshalSSZ ¶
func (v *VoteSlashing) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the VoteSlashing object
Source Files
¶
- block.go
- block_encoding.go
- blockheader.go
- blockheader_encoding.go
- blocknodedisk.go
- blocknodedisk_encoding.go
- coins.go
- coins_encoding.go
- deposit.go
- deposit_encoding.go
- epochreceipt.go
- exit.go
- exit_encoding.go
- genesis.go
- governance.go
- governance_encoding.go
- governance_votes.go
- governance_votes_encoding.go
- slashing.go
- slashing_encoding.go
- state.go
- state_encoding.go
- tree.go
- tx.go
- tx_encoding.go
- tx_multi.go
- tx_multi_encoding.go
- validator.go
- validator_encoding.go
- validatorhello.go
- validatorhello_encoding.go
- votes.go
- votes_encoding.go