types

package
v1.22.45 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DecideUndecided = coretypes.DecideUndecided
	DecideAccept    = coretypes.DecideAccept
	DecideReject    = coretypes.DecideReject
)

Decision constants re-exported from core/types

View Source
const (
	StatusUnknown    = choices.Unknown
	StatusProcessing = choices.Processing
	StatusRejected   = choices.Rejected
	StatusAccepted   = choices.Accepted
)

Status constants re-exported from choices

Variables

View Source
var (
	// ErrBlockNotFound is returned when a block is not found
	ErrBlockNotFound = errors.New("block not found")

	// ErrInvalidBlock is returned when a block is invalid
	ErrInvalidBlock = errors.New("invalid block")

	// ErrInvalidVote is returned when a vote is invalid
	ErrInvalidVote = errors.New("invalid vote")

	// ErrNoQuorum is returned when there is no quorum
	ErrNoQuorum = errors.New("no quorum")

	// ErrAlreadyVoted is returned when a validator has already voted
	ErrAlreadyVoted = errors.New("already voted")

	// ErrNotValidator is returned when the node is not a validator
	ErrNotValidator = errors.New("not a validator")

	// ErrTimeout is returned when an operation times out
	ErrTimeout = errors.New("operation timeout")

	// ErrNotInitialized is returned when the engine is not initialized
	ErrNotInitialized = errors.New("engine not initialized")
)

Common consensus errors

View Source
var GenesisID = ids.Empty

GenesisID is the ID of the genesis block

Functions

This section is empty.

Types

type Block added in v1.22.0

type Block struct {
	ID       ID        `json:"id"`
	ParentID ID        `json:"parent_id"`
	Height   uint64    `json:"height"`
	Payload  []byte    `json:"payload"`
	Time     time.Time `json:"time"`
}

Block represents a block in the blockchain

type Certificate added in v1.22.0

type Certificate struct {
	BlockID    ID        `json:"block_id"`
	Height     uint64    `json:"height"`
	Votes      []Vote    `json:"votes"`
	Timestamp  time.Time `json:"timestamp"`
	Signatures [][]byte  `json:"signatures"`
}

Certificate represents a consensus certificate

type Config added in v1.22.0

type Config struct {
	// Consensus parameters
	Alpha          int           `json:"alpha"`           // Quorum size
	K              int           `json:"k"`               // Sample size
	MaxOutstanding int           `json:"max_outstanding"` // Max outstanding polls
	MaxPollDelay   time.Duration `json:"max_poll_delay"`  // Max delay between polls

	// Network parameters
	NetworkTimeout time.Duration `json:"network_timeout"`
	MaxMessageSize int           `json:"max_message_size"`

	// Security parameters
	SecurityLevel    int  `json:"security_level"`    // NIST security level
	QuantumResistant bool `json:"quantum_resistant"` // Use PQ crypto
	GPUAcceleration  bool `json:"gpu_acceleration"`  // Use GPU acceleration
}

Config represents consensus configuration

func DefaultConfig added in v1.22.0

func DefaultConfig() Config

DefaultConfig returns default consensus configuration

type Decision

type Decision = coretypes.Decision

Decision re-exports from core/types for consistency

type Hash

type Hash = ids.ID

Core type aliases for convenience

type ID

type ID = ids.ID

Basic identifiers

type NodeID

type NodeID = ids.NodeID

Core type aliases for convenience

type PrivateKey

type PrivateKey []byte

Core type aliases for convenience

type PublicKey

type PublicKey []byte

Core type aliases for convenience

type Signature

type Signature []byte

Cryptographic types

type Status added in v1.22.0

type Status = choices.Status

Status re-exports from choices for consistency

type Vote added in v1.22.0

type Vote struct {
	BlockID   ID       `json:"block_id"`
	VoteType  VoteType `json:"vote_type"`
	Voter     NodeID   `json:"voter"`
	Signature []byte   `json:"signature"`
}

Vote represents a vote on a block

type VoteType added in v1.22.0

type VoteType int

VoteType represents the type of vote

const (
	VotePreference VoteType = iota
	VoteCommit
	VoteCancel
)

Directories

Path Synopsis
Package bag provides multiset data structures for vote collection and counting.
Package bag provides multiset data structures for vote collection and counting.

Jump to

Keyboard shortcuts

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