types

package
v0.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesFromTimeoutVote

func BytesFromTimeoutVote(t *Timeout, author string, vote *TimeoutVote) []byte

Types

type BlockData

type BlockData struct {
	Author    string   `json:"author,omitempty"` // NodeIdentifier of the proposer
	Round     uint64   `json:"round,omitempty"`  // Root round number
	Epoch     uint64   `json:"epoch,omitempty"`  // Epoch to establish valid configuration
	Timestamp uint64   `json:"timestamp,omitempty"`
	Payload   *Payload `json:"payload,omitempty"` // Payload that will trigger changes to the state
	// quorum certificate for ancestor
	// before payload can be applied check that local state matches state in qc
	// qc.vote_info.proposed.state_hash == h(UC[])
	Qc *QuorumCert `json:"qc,omitempty"`
	// contains filtered or unexported fields
}

func (*BlockData) Bytes

func (x *BlockData) Bytes() []byte

Bytes serializes entire struct for hash calculation.

func (*BlockData) GetParentRound

func (x *BlockData) GetParentRound() uint64

func (*BlockData) GetRound

func (x *BlockData) GetRound() uint64

func (*BlockData) Hash

func (x *BlockData) Hash(algo gocrypto.Hash) []byte

func (*BlockData) IsValid

func (x *BlockData) IsValid() error

func (*BlockData) String

func (x *BlockData) String() string

Summary - stringer returns a payload summary

func (*BlockData) Verify

func (x *BlockData) Verify(tb types.RootTrustBase) error

type IRChangeReason

type IRChangeReason uint8
const (
	Quorum IRChangeReason = iota
	QuorumNotPossible
	T2Timeout
)

func (IRChangeReason) String

func (r IRChangeReason) String() string

type IRChangeReq

type IRChangeReq struct {
	Partition  types.SystemID
	Shard      types.ShardID
	CertReason IRChangeReason
	// IR change (quorum or no quorum possible of block certification requests)
	Requests  []*certification.BlockCertificationRequest
	Technical certification.TechnicalRecord
	// contains filtered or unexported fields
}

func (*IRChangeReq) Bytes

func (x *IRChangeReq) Bytes() []byte

Bytes serializes entire struct.

func (*IRChangeReq) IsValid

func (x *IRChangeReq) IsValid() error

func (*IRChangeReq) String

func (x *IRChangeReq) String() string

func (*IRChangeReq) Verify

func (x *IRChangeReq) Verify(tb partitions.PartitionTrustBase, luc *types.UnicityCertificate, round, t2InRounds uint64) (*types.InputRecord, error)

type Payload

type Payload struct {
	Requests []*IRChangeReq `json:"requests,omitempty"` // IR change requests with quorum or no quorum possible
	// contains filtered or unexported fields
}

func (*Payload) Bytes

func (x *Payload) Bytes() []byte

Bytes serializes entire struct.

func (*Payload) IsEmpty

func (x *Payload) IsEmpty() bool

func (*Payload) IsValid

func (x *Payload) IsValid() error

type QuorumCert

type QuorumCert struct {
	VoteInfo         *RoundInfo         `json:"vote_info,omitempty"`          // Consensus data
	LedgerCommitInfo *types.UnicitySeal `json:"ledger_commit_info,omitempty"` // Commit info
	Signatures       map[string][]byte  `json:"signatures,omitempty"`         // Node identifier to signature map (NB! aggregated signature schema in spec)
	// contains filtered or unexported fields
}

func NewQuorumCertificate

func NewQuorumCertificate(voteInfo *RoundInfo, commitHash []byte) *QuorumCert

func NewQuorumCertificateFromVote

func NewQuorumCertificateFromVote(voteInfo *RoundInfo, commitInfo *types.UnicitySeal, signatures map[string][]byte) *QuorumCert

func (*QuorumCert) GetCommitRound

func (x *QuorumCert) GetCommitRound() uint64

func (*QuorumCert) GetParentRound

func (x *QuorumCert) GetParentRound() uint64

func (*QuorumCert) GetRound

func (x *QuorumCert) GetRound() uint64

func (*QuorumCert) IsValid

func (x *QuorumCert) IsValid() error

func (*QuorumCert) SignatureBytes

func (x *QuorumCert) SignatureBytes() []byte

SignatureBytes serializes signatures.

func (*QuorumCert) Verify

func (x *QuorumCert) Verify(tb types.RootTrustBase) error

type RoundInfo

type RoundInfo struct {
	RoundNumber       uint64 `json:"root_chain_round_number,omitempty"`
	Epoch             uint64 `json:"root_epoch,omitempty"`
	Timestamp         uint64 `json:"timestamp,omitempty"`
	ParentRoundNumber uint64 `json:"root_chain_parent_round_number,omitempty"`
	CurrentRootHash   []byte `json:"current_root_hash,omitempty"`
	// contains filtered or unexported fields
}

func (*RoundInfo) Bytes

func (x *RoundInfo) Bytes() []byte

func (*RoundInfo) GetParentRound

func (x *RoundInfo) GetParentRound() uint64

func (*RoundInfo) GetRound

func (x *RoundInfo) GetRound() uint64

func (*RoundInfo) Hash

func (x *RoundInfo) Hash(hash gocrypto.Hash) []byte

func (*RoundInfo) IsValid

func (x *RoundInfo) IsValid() error

type Timeout

type Timeout struct {
	Epoch  uint64       `json:"epoch,omitempty"`   // Epoch to establish valid configuration
	Round  uint64       `json:"round,omitempty"`   // Root round number
	HighQc *QuorumCert  `json:"high_qc,omitempty"` // Highest quorum certificate of the validator
	LastTC *TimeoutCert `json:"last_tc,omitempty"` // TC for Round−1 if HighQC.Round != Round−1 (nil otherwise)
	// contains filtered or unexported fields
}

func NewTimeout

func NewTimeout(round, epoch uint64, hqc *QuorumCert, lastTC *TimeoutCert) *Timeout

NewTimeout creates new Timeout for round (epoch) and highest QC seen

func (*Timeout) GetHqcRound

func (x *Timeout) GetHqcRound() uint64

func (*Timeout) GetRound

func (x *Timeout) GetRound() uint64

func (*Timeout) IsValid

func (x *Timeout) IsValid() error

func (*Timeout) Verify

func (x *Timeout) Verify(tb types.RootTrustBase) error

Verify verifies timeout vote received.

type TimeoutCert

type TimeoutCert struct {
	Timeout    *Timeout                `json:"timeout,omitempty"`    // Round and epoch of the timeout event
	Signatures map[string]*TimeoutVote `json:"signatures,omitempty"` // 2f+1 signatures from nodes confirming TC
	// contains filtered or unexported fields
}

func (*TimeoutCert) Add

func (x *TimeoutCert) Add(author string, timeout *Timeout, signature []byte) error

func (*TimeoutCert) GetAuthors

func (x *TimeoutCert) GetAuthors() []string

func (*TimeoutCert) GetHqcRound

func (x *TimeoutCert) GetHqcRound() uint64

func (*TimeoutCert) GetRound

func (x *TimeoutCert) GetRound() uint64

func (*TimeoutCert) IsValid

func (x *TimeoutCert) IsValid() error

func (*TimeoutCert) Verify

func (x *TimeoutCert) Verify(tb types.RootTrustBase) error

type TimeoutVote

type TimeoutVote struct {
	HqcRound  uint64 `json:"hqc_round,omitempty"` // round from timeout.high_qc.voteInfo.round
	Signature []byte `json:"signature,omitempty"` // timeout signature is TimeoutMsg signature - round, epoch, hqc_round, author
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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