types

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action[V Hashable[H], H Hash, A Addr] interface {
	// contains filtered or unexported methods
}

type Addr

type Addr interface {
	~[4]uint64
}

type BlockInfo added in v0.14.6

type BlockInfo struct {
	BlockNumber       uint64
	Builder           felt.Felt
	Timestamp         uint64
	L2GasPriceFRI     felt.Felt
	L1GasPriceWEI     felt.Felt
	L1DataGasPriceWEI felt.Felt
	EthToStrkRate     felt.Felt
	L1DAMode          core.L1DAMode
}

This is a subset of the block header used in consensus

type BroadcastPrecommit

type BroadcastPrecommit[H Hash, A Addr] Precommit[H, A]

type BroadcastPrevote

type BroadcastPrevote[H Hash, A Addr] Prevote[H, A]

type BroadcastProposal

type BroadcastProposal[V Hashable[H], H Hash, A Addr] Proposal[V, H, A]

type Commit added in v0.14.6

type Commit[V Hashable[H], H Hash, A Addr] Proposal[V, H, A]

type Hash

type Hash interface {
	~[4]uint64
}

type Hashable

type Hashable[H Hash] interface {
	Hash() H
}

Hashable's Hash() is used as ID()

type Height

type Height uint

type Message

type Message[V Hashable[H], H Hash, A Addr] interface {
	MsgType() MessageType
	GetHeight() Height
}

type MessageHeader

type MessageHeader[A Addr] struct {
	Height Height `cbor:"height"`
	Round  Round  `cbor:"round"`
	Sender A      `cbor:"sender"`
}

type MessageType

type MessageType uint8

MessageType represents the type of message stored in the WAL.

const (
	MessageTypeProposal MessageType = iota
	MessageTypePrevote
	MessageTypePrecommit
	MessageTypeTimeout
	MessageTypeUnknown
)

func (MessageType) String

func (m MessageType) String() string

String returns the string representation of the MessageType.

type Messages

type Messages[V Hashable[H], H Hash, A Addr] struct {
	Proposals  map[Height]map[Round]map[A]Proposal[V, H, A]
	Prevotes   map[Height]map[Round]map[A]Prevote[H, A]
	Precommits map[Height]map[Round]map[A]Precommit[H, A]
}

Todo: would the following representation of message be better:

  height -> round -> address -> ID -> Message
How would we keep track of nil votes? In golan map key cannot be nil.
It is not easy to calculate a zero value when dealing with generics.

func NewMessages

func NewMessages[V Hashable[H], H Hash, A Addr]() Messages[V, H, A]

func (*Messages[V, H, A]) AddPrecommit

func (m *Messages[V, H, A]) AddPrecommit(p Precommit[H, A]) bool

func (*Messages[V, H, A]) AddPrevote

func (m *Messages[V, H, A]) AddPrevote(p Prevote[H, A]) bool

func (*Messages[V, H, A]) AddProposal

func (m *Messages[V, H, A]) AddProposal(p Proposal[V, H, A]) bool

Todo: ensure duplicated messages are ignored.

func (*Messages[V, H, A]) AllMessages

func (m *Messages[V, H, A]) AllMessages(h Height, r Round) (map[A]Proposal[V, H, A], map[A]Prevote[H, A],
	map[A]Precommit[H, A],
)

func (*Messages[V, H, A]) DeleteHeightMessages

func (m *Messages[V, H, A]) DeleteHeightMessages(h Height)

type Precommit

type Precommit[H Hash, A Addr] Vote[H, A]

func (Precommit[H, A]) GetHeight

func (p Precommit[H, A]) GetHeight() Height

func (Precommit[H, A]) MsgType

func (p Precommit[H, A]) MsgType() MessageType

type Prevote

type Prevote[H Hash, A Addr] Vote[H, A]

func (Prevote[H, A]) GetHeight

func (p Prevote[H, A]) GetHeight() Height

func (Prevote[H, A]) MsgType

func (p Prevote[H, A]) MsgType() MessageType

type Proposal

type Proposal[V Hashable[H], H Hash, A Addr] struct {
	MessageHeader[A]
	ValidRound Round `cbor:"valid_round"`
	Value      *V    `cbor:"value"`
}

func (Proposal[V, H, A]) GetHeight

func (p Proposal[V, H, A]) GetHeight() Height

func (Proposal[V, H, A]) MsgType

func (p Proposal[V, H, A]) MsgType() MessageType

type ProposalCommitment added in v0.14.6

type ProposalCommitment struct {
	// BlockNumber is set by the proposer in ProposalInit
	BlockNumber uint64
	Builder     felt.Felt

	// We must set these by hand. They will be compared against ProposalCommitment
	ParentCommitment felt.Felt
	Timestamp        uint64
	ProtocolVersion  semver.Version

	// These also need set by hand. However, we would need to update the DB
	// and blockchain Reader interface, so they are ignored for now.
	OldStateRoot              felt.Felt
	VersionConstantCommitment felt.Felt
	NextL2GasPriceFRI         felt.Felt // If empty proposal, use last value

	// These values may be zero for empty proposals
	StateDiffCommitment   felt.Felt
	TransactionCommitment felt.Felt
	EventCommitment       felt.Felt
	ReceiptCommitment     felt.Felt
	ConcatenatedCounts    felt.Felt
	L1GasPriceFRI         felt.Felt
	L1DataGasPriceFRI     felt.Felt
	L2GasPriceFRI         felt.Felt
	L2GasUsed             felt.Felt
	L1DAMode              core.L1DAMode
}

type ProposalFin added in v0.14.6

type ProposalFin felt.Felt

type ProposalInit added in v0.14.6

type ProposalInit struct {
	BlockNum uint64
	Proposer felt.Felt
}

The fields of the Tendermint proposal which can be known before the proposer completes block building.

type Round

type Round int

type ScheduleTimeout

type ScheduleTimeout Timeout

type Step

type Step uint8
const (
	StepPropose Step = iota
	StepPrevote
	StepPrecommit
)

func (Step) String

func (s Step) String() string

type Timeout

type Timeout struct {
	Step   Step
	Height Height
	Round  Round
	// contains filtered or unexported fields
}

func (Timeout) GetHeight

func (t Timeout) GetHeight() Height

func (Timeout) MsgType

func (t Timeout) MsgType() MessageType

type Transaction added in v0.14.6

type Transaction struct {
	Transaction core.Transaction
	Class       core.Class
	PaidFeeOnL1 *felt.Felt
	Index       int // to order txns in the block
}

type ValueID added in v0.14.6

type ValueID felt.Felt

type Vote

type Vote[H Hash, A Addr] struct {
	MessageHeader[A]
	ID *H `cbor:"id"`
}

type VotingPower

type VotingPower uint

Jump to

Keyboard shortcuts

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