Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicatedVote = errors.New("duplicated vote") ErrSenderNotParticipant = errors.New("sender is not a participant") )
View Source
var ( ErrNoTransactions = errors.New("no transactions to execute") ErrNotInSimulatingState = errors.New("sequencer not in simulating state") )
Functions ¶
This section is empty.
Types ¶
type ExecutionEngine ¶
type ExecutionEngine interface {
ChainID() compose.ChainID
// Simulate runs the VM with a tracer for the simulation request.
// The simulation returns a list of written mailbox messages (writeMessages).
// If there's a read miss, readRequest is populated with the expected header.
// If there's a simulation error (not read miss), err is populated.
// Else, err is nil and readRequest is nil (successful transaction execution).
Simulate(request SimulationRequest) (readRequest *MailboxMessageHeader, writeMessages []MailboxMessage, err error)
}
ExecutionEngine represents the execution engine, such as the EVM.
type MailboxMessage ¶
type MailboxMessage struct {
MailboxMessageHeader
Data []byte
}
MailboxMessage carries the data exchanged between sequencers for mailbox fulfillment.
func (MailboxMessage) Equal ¶
func (a MailboxMessage) Equal(b MailboxMessage) bool
type MailboxMessageHeader ¶
type MailboxMessageHeader struct {
SessionID compose.SessionID
SourceChainID compose.ChainID
DestChainID compose.ChainID
Sender compose.EthAddress
Receiver compose.EthAddress
Label string
}
func (MailboxMessageHeader) Equal ¶
func (a MailboxMessageHeader) Equal(b MailboxMessageHeader) bool
type PublisherInstance ¶
type PublisherInstance interface {
Instance() compose.Instance
DecisionState() compose.DecisionState
Run()
ProcessVote(sender compose.ChainID, vote bool) error
Timeout() error
}
func NewPublisherInstance ¶
func NewPublisherInstance( instance compose.Instance, network PublisherNetwork, logger zerolog.Logger, ) (PublisherInstance, error)
type PublisherNetwork ¶
type PublisherNetwork interface {
SendStartInstance(instance compose.Instance)
SendDecided(instanceID compose.InstanceID, decided bool)
}
type SequencerInstance ¶
type SequencerInstance interface {
DecisionState() compose.DecisionState
Run() error
ProcessMailboxMessage(msg MailboxMessage) error
ProcessDecidedMessage(decided bool) error
Timeout()
}
SequencerInstance is an interface that represents the sequencer-side logic for an SCP instance.
func NewSequencerInstance ¶
func NewSequencerInstance( instance compose.Instance, execution ExecutionEngine, network SequencerNetwork, vmSnapshot compose.StateRoot, logger zerolog.Logger, ) (SequencerInstance, error)
type SequencerNetwork ¶
type SequencerNetwork interface {
SendMailboxMessage(recipient compose.ChainID, msg MailboxMessage)
SendVote(vote bool)
}
type SequencerState ¶
type SequencerState int
SequencerState tracks the state machine for a sequencer in an SCP session.
const ( SeqStateSimulating SequencerState = iota SeqStateWaitingDecided SeqStateDone )
type SimulationRequest ¶
type SimulationRequest struct {
// mailbox.putInbox transactions
PutInboxMessages []MailboxMessage
Transactions [][]byte
Snapshot compose.StateRoot
}
SimulationRequest represents the inputs for the mailbox-aware simulator.
Click to show internal directories.
Click to hide internal directories.