types

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 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 {
	Version   types.ABVersion
	Author    string   `json:"author"` // NodeIdentifier of the proposer
	Round     uint64   `json:"round"`  // Root round number
	Epoch     uint64   `json:"epoch"`  // Epoch to establish valid configuration
	Timestamp uint64   `json:"timestamp"`
	Payload   *Payload `json:"payload"` // 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"`
	// contains filtered or unexported fields
}

func (*BlockData) Bytes

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

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) GetVersion

func (x *BlockData) GetVersion() types.ABVersion

func (*BlockData) Hash

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

func (*BlockData) IsValid

func (x *BlockData) IsValid() error

func (*BlockData) MarshalCBOR

func (x *BlockData) MarshalCBOR() ([]byte, error)

func (*BlockData) String

func (x *BlockData) String() string

Summary - stringer returns a payload summary

func (*BlockData) UnmarshalCBOR

func (x *BlockData) UnmarshalCBOR(data []byte) error

func (*BlockData) Verify

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

type CertRequestVerifier

type CertRequestVerifier interface {
	IRRound() uint64
	IRPreviousHash() []byte
}

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.PartitionID
	Shard      types.ShardID
	CertReason IRChangeReason
	// IR change (quorum or no quorum possible of block certification requests)
	Requests []*certification.BlockCertificationRequest
	// contains filtered or unexported fields
}

func (*IRChangeReq) IsValid

func (x *IRChangeReq) IsValid() error

func (*IRChangeReq) String

func (x *IRChangeReq) String() string

func (*IRChangeReq) Verify

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

type Payload

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

func (*Payload) IsEmpty

func (x *Payload) IsEmpty() bool

func (*Payload) IsValid

func (x *Payload) IsValid() error

type QuorumCert

type QuorumCert struct {
	VoteInfo         *RoundInfo           `json:"voteInfo"`         // Consensus data
	LedgerCommitInfo *types.UnicitySeal   `json:"ledgerCommitInfo"` // Commit info
	Signatures       map[string]hex.Bytes `json:"signatures"`       // 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, error)

func NewQuorumCertificateFromVote

func NewQuorumCertificateFromVote(voteInfo *RoundInfo, commitInfo *types.UnicitySeal, signatures map[string]hex.Bytes) *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 RequestVerifier

type RequestVerifier interface {
	GetQuorum() uint64
	GetTotalNodes() uint64
	ValidRequest(req *certification.BlockCertificationRequest) error
}

type RoundInfo

type RoundInfo struct {
	Version           types.ABVersion
	RoundNumber       uint64    `json:"rootChainRoundNumber"`
	Epoch             uint64    `json:"rootEpoch"`
	Timestamp         uint64    `json:"timestamp"`
	ParentRoundNumber uint64    `json:"rootChainParentRoundNumber"`
	CurrentRootHash   hex.Bytes `json:"currentRootHash"`
	// contains filtered or unexported fields
}

func (*RoundInfo) GetParentRound

func (x *RoundInfo) GetParentRound() uint64

func (*RoundInfo) GetRound

func (x *RoundInfo) GetRound() uint64

func (*RoundInfo) GetVersion

func (x *RoundInfo) GetVersion() types.ABVersion

func (*RoundInfo) Hash

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

func (*RoundInfo) IsValid

func (x *RoundInfo) IsValid() error

func (*RoundInfo) MarshalCBOR

func (x *RoundInfo) MarshalCBOR() ([]byte, error)

func (*RoundInfo) UnmarshalCBOR

func (x *RoundInfo) UnmarshalCBOR(data []byte) error

type Timeout

type Timeout struct {
	Epoch  uint64      `json:"epoch"`  // Epoch to establish valid configuration
	Round  uint64      `json:"round"`  // Root round number
	HighQc *QuorumCert `json:"highQc"` // Highest quorum certificate of the validator
	// contains filtered or unexported fields
}

func NewTimeout

func NewTimeout(round, epoch uint64, hqc *QuorumCert) *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"`    // Round and epoch of the timeout event
	Signatures map[string]*TimeoutVote `json:"signatures"` // 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:"hqcRound"`  // round from timeout.high_qc.voteInfo.round
	Signature hex.Bytes `json:"signature"` // 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