Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSBCPMessage ¶
IsSBCPMessage returns true if the message belongs to SBCP protocol
Types ¶
type Handler ¶
type Handler interface {
// Handle processes SBCP protocol messages
Handle(ctx context.Context, from string, msg *pb.Message) error
// CanHandle returns true if this handler can process the message
CanHandle(msg *pb.Message) bool
// GetProtocolName returns the protocol name for logging/debugging
GetProtocolName() string
}
Handler defines the interface for SBCP protocol message handling
func NewHandler ¶
func NewHandler(messageHandler MessageHandler, validator Validator, log zerolog.Logger) Handler
NewHandler creates a new SBCP protocol handler
type MessageHandler ¶
type MessageHandler interface {
HandleStartSlot(ctx context.Context, from string, startSlot *pb.StartSlot) error
HandleRequestSeal(ctx context.Context, from string, requestSeal *pb.RequestSeal) error
HandleL2Block(ctx context.Context, from string, l2Block *pb.L2Block) error
HandleStartSC(ctx context.Context, from string, startSC *pb.StartSC) error
HandleRollBackAndStartSlot(ctx context.Context, from string, rb *pb.RollBackAndStartSlot) error
}
MessageHandler defines handlers for specific SBCP message types
type MessageType ¶
type MessageType int
MessageType represents SBCP protocol message types
const ( MsgStartSlot MessageType // SP starts slot MsgRequestSeal // SP requests block seal MsgL2Block // Sequencer submits block MsgStartSC // SP starts a cross-chain transaction MsgRollBackAndStartSlot // SP requests rollback and restart slot )
func ClassifyMessage ¶
func ClassifyMessage(msg *pb.Message) (MessageType, bool)
ClassifyMessage returns SBCP message type from a protobuf message
func (MessageType) IsValid ¶
func (t MessageType) IsValid() bool
IsValid returns true if a message type is valid
func (MessageType) String ¶
func (t MessageType) String() string
String returns a human-readable message type name
type Validator ¶
type Validator interface {
ValidateStartSlot(startSlot *pb.StartSlot) error
ValidateRequestSeal(requestSeal *pb.RequestSeal) error
ValidateL2Block(l2Block *pb.L2Block) error
ValidateStartSC(startSC *pb.StartSC) error
ValidateRollBackAndStartSlot(rb *pb.RollBackAndStartSlot) error
}
Validator defines message validation interface
func NewBasicValidator ¶
func NewBasicValidator() Validator
NewBasicValidator creates a new basic SBCP message validator
Click to show internal directories.
Click to hide internal directories.