struct SequencerState {
lib: HeaderId
tip: HeaderId
finalized_msg: MsgId
// The queue of channel messages that extend from the finalized message
// but have not yet finalized (they may be in mempool, or in non-finalized blocks)
pending: Vec<SignedMantleTx>
// The block tree extending from LIB
unfinalized_tree: BTreeMap<HeaderId, ZoneSdkBlock>
}
// Specialized block representing the relevant information from L1 blocks
// the Zone SDK
struct ZoneSdkBlock {
parent: HeaderId, // parent L1 Block
channel_txs: Vec<SignedMantletx>, // txs interacting with this channel
}
b
zone_block.parent not in seq.unfinalized_tree && zone_block.parent ≠ seq.lib
seq.unfinalized_tree.insert(b.id(), zone_block)new_lib
seq.lib = new_libseq.finalized_msg = <last msg id seen at the point of new_lib>unfinalized_tree to keep only new_lib and its descendantsnew_tip
new_tip not in seq.unfinalized_tree && new_tip ≠ seq.lib
new_tip extends from the channel tip in seq.tip
seq.tip up to new_tip: call it new_msgsseq.tip = new_tipChannelExtended { new_msgs }seq.tip and channel state in new_tip , call it lcm_msglcm_msg from pending, call these orphaned_msgslcm_msg up to channel tip in new_tip , adopted_msgsadopted_msgs to seq.pendingseq.tip = new.tipChannelReog { orphaned_msgs, adopted_msgs }publish(msg)
seq.pending is not empty, use the last msg in the pending queueseq.finalized_msgmsg_txseq.pending.push(msg_tx)mempool.add(msg_tx)Mempool is best effort, and therefore we need stronger guarantees from sequencers that a transaction will be included.
seq.pending txs that are not yet included in the chain at seq.unfinalized_tree[seq.tip] : call them resubmit_txsresubmit_txs to the mempool to guarantee inclusion