Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AwaitingBlockInfoOrCommitmentState ¶
type AwaitingBlockInfoOrCommitmentState struct {
Header *starknet.MessageHeader
ValidRound types.Round
}
AwaitingBlockInfoOrCommitmentState handles the transition after ProposalInit, accepting either a BlockInfo (for full proposals) or a Commitment (for empty blocks).
func (*AwaitingBlockInfoOrCommitmentState) OnEvent ¶
func (s *AwaitingBlockInfoOrCommitmentState) OnEvent( ctx context.Context, transition Transition, part *consensus.ProposalPart, ) (ProposalStateMachine, error)
type AwaitingProposalFinState ¶
type AwaitingProposalFinState struct {
Header *starknet.MessageHeader
ValidRound types.Round
Value *starknet.Value
}
AwaitingProposalFinState handles the final phase of the proposal flow, waiting for a ProposalFin message that commits the hash of the proposed value.
func (*AwaitingProposalFinState) OnEvent ¶
func (s *AwaitingProposalFinState) OnEvent( ctx context.Context, transition Transition, part *consensus.ProposalPart, ) (ProposalStateMachine, error)
type FinState ¶
FinState contains the output of the proposal flow.
func (*FinState) OnEvent ¶
func (s *FinState) OnEvent( ctx context.Context, transition Transition, part *consensus.ProposalPart, ) (ProposalStateMachine, error)
type InitialState ¶
type InitialState struct{}
InitialState handles the first step in the proposal flow, accepting only a ProposalInit message to begin the process.
func (*InitialState) OnEvent ¶
func (s *InitialState) OnEvent( ctx context.Context, transition Transition, part *consensus.ProposalPart, ) (ProposalStateMachine, error)
type ProposalStateMachine ¶
type ProposalStateMachine interface {
OnEvent(context.Context, Transition, *consensus.ProposalPart) (ProposalStateMachine, error)
}
type ProposalStreamDemux ¶ added in v0.14.7
type ProposalStreamDemux[V types.Hashable[H], H types.Hash, A types.Addr] interface { Loop(context.Context, *pubsub.Topic) Listen() <-chan types.Proposal[V, H, A] }
func NewProposalStreamDemux ¶ added in v0.14.7
type ReceivingTransactionsState ¶
type ReceivingTransactionsState struct {
Header *starknet.MessageHeader
ValidRound types.Round
Value *starknet.Value
}
ReceivingTransactionsState handles the flow where transaction batches are received, continuing until a ProposalCommitment message is received to conclude the input.
func (*ReceivingTransactionsState) OnEvent ¶
func (s *ReceivingTransactionsState) OnEvent( ctx context.Context, transition Transition, part *consensus.ProposalPart, ) (ProposalStateMachine, error)
type Transition ¶
type Transition interface {
OnProposalInit(
context.Context,
*InitialState,
*consensus.ProposalInit,
) (*AwaitingBlockInfoOrCommitmentState, error)
OnEmptyBlockCommitment(
context.Context,
*AwaitingBlockInfoOrCommitmentState,
*consensus.ProposalCommitment,
) (*AwaitingProposalFinState, error)
OnBlockInfo(
context.Context,
*AwaitingBlockInfoOrCommitmentState,
*consensus.BlockInfo,
) (*ReceivingTransactionsState, error)
OnTransactions(
context.Context,
*ReceivingTransactionsState,
[]*consensus.ConsensusTransaction,
) (*ReceivingTransactionsState, error)
OnProposalCommitment(
context.Context,
*ReceivingTransactionsState,
*consensus.ProposalCommitment,
) (*AwaitingProposalFinState, error)
OnProposalFin(
context.Context,
*AwaitingProposalFinState,
*consensus.ProposalFin,
) (*FinState, error)
}
func NewTransition ¶
func NewTransition() Transition