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 {
Proposal *starknet.Proposal
BuildResult *builder.BuildResult
}
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 ¶
type FinState struct {
Proposal *starknet.Proposal
BuildResult *builder.BuildResult
}
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
func NewProposalStreamDemux( log utils.Logger, proposalStore *proposal.ProposalStore[starknet.Hash], transition Transition, bufferSizeConfig *config.BufferSizes, commitNotifier <-chan types.Height, currentHeight types.Height, ) ProposalStreamDemux[starknet.Value, starknet.Hash, starknet.Address]
type ReceivingTransactionsState ¶
type ReceivingTransactionsState struct {
Header *starknet.MessageHeader
ValidRound types.Round
BuildState *builder.BuildState
}
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 {
Network() *utils.Network
OnProposalInit(
context.Context,
*InitialState,
*types.ProposalInit,
) (*AwaitingBlockInfoOrCommitmentState, error)
OnEmptyBlockCommitment(
context.Context,
*AwaitingBlockInfoOrCommitmentState,
*types.ProposalCommitment,
) (*AwaitingProposalFinState, error)
OnBlockInfo(
context.Context,
*AwaitingBlockInfoOrCommitmentState,
*types.BlockInfo,
) (*ReceivingTransactionsState, error)
OnTransactions(
context.Context,
*ReceivingTransactionsState,
[]types.Transaction,
) (*ReceivingTransactionsState, error)
OnProposalCommitment(
context.Context,
*ReceivingTransactionsState,
*types.ProposalCommitment,
) (*AwaitingProposalFinState, error)
OnProposalFin(
context.Context,
*AwaitingProposalFinState,
*types.ProposalFin,
) (*FinState, error)
}
func NewTransition ¶
func NewTransition(builder *builder.Builder) Transition