Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
dc8d553
Init compose
MatheusFranco99 Oct 27, 2025
9219656
fix go mod module declaration
MatheusFranco99 Oct 27, 2025
3098e7f
fix go mod renaming
MatheusFranco99 Oct 27, 2025
6596525
downgrade go to 1.23.0
MatheusFranco99 Oct 27, 2025
b434865
refactor Instance.Chains from field to method
MatheusFranco99 Oct 27, 2025
af59b02
Drop unused err and ERChainID field from publisher
MatheusFranco99 Oct 27, 2025
b387094
Added features, logging, and comments:
MatheusFranco99 Oct 27, 2025
05deb09
Add logging and no limit for proof_window=0 config
MatheusFranco99 Oct 27, 2025
1f8c47a
align tests
MatheusFranco99 Oct 27, 2025
6bad137
Add proto files and reamde
MatheusFranco99 Oct 27, 2025
96f717a
Add publisher interface to scp
MatheusFranco99 Oct 28, 2025
4e6df41
Add pending dependency
MatheusFranco99 Oct 28, 2025
b67e314
Add periodID to rollback msg
MatheusFranco99 Oct 29, 2025
f16afce
Export GenerateInstanceID method
MatheusFranco99 Oct 29, 2025
b96001e
Add interface for scp sequencer
MatheusFranco99 Oct 29, 2025
7c95866
Add proto with XTRequest with chain id
MatheusFranco99 Oct 29, 2025
397ad85
Deprecate Transactions interface for XTRequest explicit structure
MatheusFranco99 Oct 29, 2025
4597cc5
Use chain id as uint64
MatheusFranco99 Oct 29, 2025
29572a9
rename scp.go to mailbox.go
MatheusFranco99 Oct 29, 2025
b384351
Add non-participant check in scp/publisher
MatheusFranco99 Nov 1, 2025
6318cbc
Rename proto file
MatheusFranco99 Nov 1, 2025
09620b4
participant check refactor
MatheusFranco99 Nov 1, 2025
d180d98
Add sbcp-v2 spec file
MatheusFranco99 Nov 7, 2025
8fefc57
Add proof pipeline logic to sbcp spec code
MatheusFranco99 Nov 7, 2025
90d7ea4
Add deprecated note to sbcp v1
MatheusFranco99 Nov 7, 2025
1480ead
Fix lock usage
MatheusFranco99 Nov 7, 2025
6ea0acb
check that proof.superblock has finished
MatheusFranco99 Nov 7, 2025
5814c6f
align unit tests
MatheusFranco99 Nov 7, 2025
2c50d7d
align scp
MatheusFranco99 Nov 8, 2025
9c26848
github action for unit tests
MatheusFranco99 Nov 8, 2025
c787c13
check for active instances in endblock call in sbcp.sequencer
MatheusFranco99 Nov 10, 2025
2c679ab
fix typo
MatheusFranco99 Nov 14, 2025
9fc99f6
fix typo
MatheusFranco99 Nov 14, 2025
ed1922e
fix plural typo
MatheusFranco99 Nov 14, 2025
28b382a
add figures
MatheusFranco99 Nov 14, 2025
03dafa1
fix grammar typos and protobuf3 label
MatheusFranco99 Nov 14, 2025
2047756
align settlement to new sbcp v2
MatheusFranco99 Nov 14, 2025
bfa4f5b
add sequencer number and period ID validation to start instance check
MatheusFranco99 Nov 14, 2025
dca0e01
add sbcp readme
MatheusFranco99 Nov 14, 2025
f59c1ff
add scp readme
MatheusFranco99 Nov 14, 2025
69cad85
refactor util code
MatheusFranco99 Nov 16, 2025
82cdcd7
add cdcp markdown
MatheusFranco99 Nov 16, 2025
b2fb540
cdcp spec minimal implementation
MatheusFranco99 Nov 16, 2025
da998f2
Merge branch 'main' into compose-lib
MatheusFranco99 Nov 16, 2025
438759c
fix bold format
MatheusFranco99 Nov 16, 2025
2370e40
mention lib in README and fix protocol version
MatheusFranco99 Nov 24, 2025
0794e98
fix namings
MatheusFranco99 Nov 24, 2025
e1166ec
apply suggestions
MatheusFranco99 Nov 24, 2025
2135f96
add pending block check to locked section
MatheusFranco99 Nov 24, 2025
7513967
fix memory cleanup
MatheusFranco99 Nov 24, 2025
66bab2e
fix instance id computation to encompass chain, tx length, and number…
MatheusFranco99 Nov 24, 2025
3b23404
put session id first in case we use it for versioning
MatheusFranco99 Nov 24, 2025
015761b
adjust readmes
MatheusFranco99 Nov 24, 2025
2a2b6e6
Merge branch 'compose-lib' into cdcp-md-and-impl
MatheusFranco99 Nov 24, 2025
3586694
drop unused function
MatheusFranco99 Nov 24, 2025
882667e
fix lock
MatheusFranco99 Nov 24, 2025
c5f08ad
fix done check
MatheusFranco99 Nov 24, 2025
1452b93
unit tests
MatheusFranco99 Nov 24, 2025
bd161d8
add error cases
MatheusFranco99 Nov 24, 2025
b08aeb5
add comments, checks, and fixed
MatheusFranco99 Nov 24, 2025
49647f2
re-order check and add unit tests
MatheusFranco99 Nov 24, 2025
4998334
add cdcp readme
MatheusFranco99 Nov 24, 2025
0a5d814
clarify hash content
MatheusFranco99 Nov 25, 2025
eafc14b
clarify hash content
MatheusFranco99 Nov 25, 2025
ef208d8
Merge branch 'compose-lib' into cdcp-md-and-impl
MatheusFranco99 Nov 25, 2025
ff18057
rename network proof to superblock proof
MatheusFranco99 Nov 25, 2025
18478c6
add target superblock to publisher constructor
MatheusFranco99 Nov 25, 2025
4833bb3
remove v1 file
MatheusFranco99 Nov 26, 2025
201c4cc
remove v2 mentions
MatheusFranco99 Nov 26, 2025
34aa6e0
add golangci lint
MatheusFranco99 Nov 26, 2025
5e6b18b
fix linter
MatheusFranco99 Nov 26, 2025
c064476
improve readability of StartPeriod
MatheusFranco99 Nov 27, 2025
d738783
Revert "improve readability of StartPeriod"
MatheusFranco99 Nov 27, 2025
7855cc0
clarify input var names
MatheusFranco99 Nov 27, 2025
84de545
Merge branch 'compose-lib' into cdcp-md-and-impl
MatheusFranco99 Nov 27, 2025
1f49e15
Merge branch 'main' into cdcp-md-and-impl
MatheusFranco99 Nov 27, 2025
89001bd
fix linter issue
MatheusFranco99 Nov 27, 2025
84d7483
delete cdcp markdown
MatheusFranco99 Nov 27, 2025
8377c9a
fix wrong spaces
MatheusFranco99 Nov 27, 2025
495acaa
apply suggestions
MatheusFranco99 Dec 12, 2025
8e58dd4
use rwlock
MatheusFranco99 Dec 12, 2025
a8fa96b
make external calls unlocked
MatheusFranco99 Dec 12, 2025
3ac7a6e
fix comments
MatheusFranco99 Dec 12, 2025
f65e0de
O(n*m) to O(n) complexity on checking sent mailbox messages
MatheusFranco99 Dec 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added features, logging, and comments:
- Simulation returns written messages.
- sbcp/sequencer sealed block var renaming.
- Proof timeout config logic
- Proof timeout resets seq number to 0
  • Loading branch information
MatheusFranco99 committed Oct 27, 2025
commit b387094656f0acb87912d27efae6a4669e591daa
13 changes: 13 additions & 0 deletions compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,16 @@ const (
DecisionStateAccepted
DecisionStateRejected
)

func (d *DecisionState) String() string {
switch *d {
case DecisionStatePending:
return "Pending"
case DecisionStateAccepted:
return "Accepted"
case DecisionStateRejected:
return "Rejected"
default:
return "Unknown"
}
}
4 changes: 4 additions & 0 deletions compose/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ require github.com/stretchr/testify v1.9.0

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/zerolog v1.34.0 // indirect
golang.org/x/sys v0.12.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
15 changes: 15 additions & 0 deletions compose/go.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
43 changes: 31 additions & 12 deletions compose/sbcp/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (

type Publisher interface {
// StartPeriod is called whenever a new period starts (i.e. CurrEthereumEpoch % 10 == 0).
StartPeriod(newPeriodID compose.PeriodID) error
StartPeriod() error
// StartInstance is called by the upper layer to try starting a new instance from the queued requests.
StartInstance(req []compose.Transaction) (compose.Instance, error)
// DecideInstance is called once an instance gets decided.
Expand All @@ -35,7 +35,6 @@ type Publisher interface {

type Messenger interface {
BroadcastStartPeriod(periodID compose.PeriodID, targetSuperblockNumber compose.SuperblockNumber)
BroadcastStartInstance(instance compose.Instance)
BroadcastRollback(
superblockNumber compose.SuperblockNumber,
superblockHash compose.SuperBlockHash,
Expand All @@ -54,6 +53,10 @@ type PublisherState struct {
SequenceNumber compose.SequenceNumber // Per-period sequence counter (monotone)
ActiveChains map[compose.ChainID]bool // Chains with active instances

// Proof window duration (in number of superblocks/periods) through which a pending superblock can be proven.
// StartPeriods are rejected if the next superblock is bigger than LastFinalizedSuperblockNumber + ProofWindow.
// 0 value means no window constrain.
ProofWindow uint64
}

type publisher struct {
Expand All @@ -62,18 +65,22 @@ type publisher struct {
PublisherState
}

// NewPublisher creates a new Publisher instance given a config, a period ID and the last settled state.
// TargetSuperblockNumber is set to lastFinalizedSuperblockNumber initially.
// StartPeriod needs to be called to start the first period, automatically incrementing PeriodID and TargetSuperblockNumber.
// Thus, if the current period is N, call NewPublisher with periodID = N-1.
func NewPublisher(messenger Messenger,
periodID compose.PeriodID,
targetSuperblockNumber compose.SuperblockNumber,
lastFinalizedSuperblockNumber compose.SuperblockNumber,
lastFinalizedSuperblockHash compose.SuperBlockHash,
proofWindow uint64,
) Publisher {
return &publisher{
mu: sync.Mutex{},
messenger: messenger,
PublisherState: PublisherState{
PeriodID: periodID,
TargetSuperblockNumber: targetSuperblockNumber,
TargetSuperblockNumber: lastFinalizedSuperblockNumber,

// Last finalized state in L1
LastFinalizedSuperblockNumber: lastFinalizedSuperblockNumber,
Expand All @@ -82,30 +89,39 @@ func NewPublisher(messenger Messenger,
// Instances scheduling
SequenceNumber: 0,
ActiveChains: make(map[compose.ChainID]bool),

ProofWindow: proofWindow,
},
}
}

// StartPeriod is called whenever a new period starts (i.e. CurrEthereumEpoch % 10 == 0).
func (p *publisher) StartPeriod(newPeriodID compose.PeriodID) error {
// SequenceNumber is reset to 0, though ActiveChains is kept because instances may exist through the boundary until finished.
func (p *publisher) StartPeriod() error {
p.mu.Lock()
defer p.mu.Unlock()

if p.TargetSuperblockNumber != p.LastFinalizedSuperblockNumber+1 {
// Proof window constrain
// If the oldest pending superblock is older than ProofWindow, reject starting the new period
// as the upper layer should have called ProofTimeout already.
nextSuperblock := p.TargetSuperblockNumber + 1
if nextSuperblock > p.LastFinalizedSuperblockNumber+compose.SuperblockNumber(1+p.ProofWindow) {
return fmt.Errorf("target superblock is %d, expected %d: %w",
p.TargetSuperblockNumber, p.LastFinalizedSuperblockNumber+1, ErrCannotStartPeriod)
}

p.PeriodID = newPeriodID
p.TargetSuperblockNumber++
p.PeriodID++
p.TargetSuperblockNumber = nextSuperblock

p.messenger.BroadcastStartPeriod(p.PeriodID, p.TargetSuperblockNumber)

p.SequenceNumber = 0
return nil
}

// StartInstance loops through the queued XT requests and tries one instance if possible.
// StartInstance is called by the upper layer to try starting a new instance.
// If the instance can not be started, it returns an error.
// Else, it returns the created instance.
func (p *publisher) StartInstance(request []compose.Transaction) (compose.Instance, error) {
p.mu.Lock()
defer p.mu.Unlock()
Expand All @@ -124,7 +140,6 @@ func (p *publisher) StartInstance(request []compose.Transaction) (compose.Instan
// Create instance
p.SequenceNumber++
instance := compose.Instance{
// TODO: generate unique ID
ID: generateInstanceID(
p.PeriodID,
p.SequenceNumber,
Expand All @@ -138,8 +153,6 @@ func (p *publisher) StartInstance(request []compose.Transaction) (compose.Instan
for _, chainID := range chains {
p.ActiveChains[chainID] = true
}
// Broadcast
p.messenger.BroadcastStartInstance(instance)
return instance, nil
}

Expand All @@ -150,18 +163,21 @@ func (p *publisher) DecideInstance(instance compose.Instance) error {

chains := instance.Chains()

// Check instance chains are really active
for _, chainID := range chains {
if _, ok := p.ActiveChains[chainID]; !ok {
return ErrChainNotActive
}
}

// Remove chains from active
for _, chainID := range chains {
delete(p.ActiveChains, chainID)
}
return nil
}

// AdvanceSettledState is called when L1 emits a new settled state event
func (p *publisher) AdvanceSettledState(
superblockNumber compose.SuperblockNumber,
superblockHash compose.SuperBlockHash,
Expand All @@ -177,11 +193,14 @@ func (p *publisher) AdvanceSettledState(
return nil
}

// ProofTimeout is called whenever a pending superblock is not proven within the allowed proof window.
// It triggers a rollback to the last finalized superblock, resetting the active chains and sequence number.
func (p *publisher) ProofTimeout() {
p.mu.Lock()
defer p.mu.Unlock()

p.ActiveChains = make(map[compose.ChainID]bool)
p.SequenceNumber = 0
p.TargetSuperblockNumber = p.LastFinalizedSuperblockNumber + 1
p.messenger.BroadcastRollback(p.LastFinalizedSuperblockNumber, p.LastFinalizedSuperblockHash)
}
Expand Down
2 changes: 0 additions & 2 deletions compose/sbcp/sbcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"github.com/compose-network/specs/compose"
)

type PriorityQueue [][]compose.Transaction

// generateInstanceID returns SHA256(periodID || seq || req[0].Bytes() || ... || req[n].Bytes())
func generateInstanceID(
periodID compose.PeriodID,
Expand Down
41 changes: 22 additions & 19 deletions compose/sbcp/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package sbcp

import (
"errors"
"github.com/compose-network/specs/compose"
"sync"

"github.com/compose-network/specs/compose"
)

var (
Expand All @@ -28,19 +29,19 @@ type Sequencer interface {
currentPeriodID compose.PeriodID,
) (BlockHeader, error)

// AdvancedSettledState is called when the L1 settlement event has occurred.
// AdvanceSettledState is called when the L1 settlement event has occurred.
AdvanceSettledState(SettledState)

// Block builder:
// Called at start of a new block
// Block builder policy
// BeginBlock is called at start of a new block
BeginBlock(blockNumber BlockNumber) error
// Return whether a local tx is admissible right now.
// CanIncludeLocalTx return whether a local tx is admissible right now.
CanIncludeLocalTx() (include bool, err error)
// SCP start-up hook. Locks local txs from being added (internal logic).
// OnStartInstance is an SCP start-up hook. Locks local txs from being added (internal logic).
OnStartInstance(id compose.InstanceID) error
// SCP decision hook. Unlocks local txs (internal logic).
// OnDecidedInstance is an SCP decision hook. Unlocks local txs (internal logic).
OnDecidedInstance(id compose.InstanceID) error
// End-of-block hook
// EndBlock: hook for when block ends
EndBlock(b BlockHeader) error
}

Expand All @@ -61,8 +62,8 @@ type SequencerState struct {
// Head represents the highest sealed block number.
Head BlockNumber

SealedBlocks map[compose.PeriodID]SealedBlockHeader
SettledState SettledState
SealedBlockHead map[compose.PeriodID]SealedBlockHeader
SettledState SettledState
}

type sequencer struct {
Expand All @@ -86,7 +87,7 @@ func NewSequencer(
PendingBlock: nil,
ActiveInstanceID: nil,
Head: settledState.BlockHeader.Number,
SealedBlocks: make(map[compose.PeriodID]SealedBlockHeader),
SealedBlockHead: make(map[compose.PeriodID]SealedBlockHeader),
SettledState: settledState,
},
}
Expand All @@ -107,7 +108,7 @@ func (s *sequencer) StartPeriod(
// Else, it can be triggered right away.
if s.PendingBlock == nil {
var header *BlockHeader
block, ok := s.SealedBlocks[s.PeriodID-1]
block, ok := s.SealedBlockHead[s.PeriodID-1]
if ok {
header = &block.BlockHeader
}
Expand All @@ -116,7 +117,7 @@ func (s *sequencer) StartPeriod(
return nil
}

// BeginBlock is a hook called at the start of a new block.
// BeginBlock is a hook called at the start of a new L2 block.
func (s *sequencer) BeginBlock(blockNumber BlockNumber) error {
s.mu.Lock()
defer s.mu.Unlock()
Expand Down Expand Up @@ -183,7 +184,7 @@ func (s *sequencer) EndBlock(b BlockHeader) error {
return ErrBlockSealMismatch
}

s.SealedBlocks[s.PendingBlock.PeriodID] = SealedBlockHeader{
s.SealedBlockHead[s.PendingBlock.PeriodID] = SealedBlockHeader{
BlockHeader: b,
PeriodID: s.PendingBlock.PeriodID,
SuperblockNumber: s.PendingBlock.SuperblockNumber,
Expand All @@ -193,7 +194,7 @@ func (s *sequencer) EndBlock(b BlockHeader) error {
// therefore it's time to request proofs for it.
if s.PendingBlock.PeriodID < s.PeriodID {
var header *BlockHeader
block, ok := s.SealedBlocks[s.PeriodID-1]
block, ok := s.SealedBlockHead[s.PeriodID-1]
if ok {
header = &block.BlockHeader
}
Expand All @@ -215,7 +216,8 @@ func (s *sequencer) AdvanceSettledState(settledBlock SettledState) {
s.SettledState = settledBlock
}

// Rollback erases blocks beyond the given superblock number and hash, and returns the safe head block header.
// Rollback message is sent by the publisher to all sequencers.
// The sequencer must erase blocks beyond the given superblock number and hash, and return the safe head block header.
func (s *sequencer) Rollback(
superblockNumber compose.SuperblockNumber,
superblockHash compose.SuperBlockHash,
Expand All @@ -228,11 +230,12 @@ func (s *sequencer) Rollback(
}

// Discard blocks with superblock number greater than the finalized one.
for bn, taggedBlock := range s.SealedBlocks {
if taggedBlock.SuperblockNumber > s.SettledState.SuperblockNumber {
delete(s.SealedBlocks, bn)
for blockPeriodID, sealedBlock := range s.SealedBlockHead {
if sealedBlock.SuperblockNumber > s.SettledState.SuperblockNumber {
delete(s.SealedBlockHead, blockPeriodID)
}
}

// Discard current block and active instance
s.PendingBlock = nil
s.ActiveInstanceID = nil
Expand Down
Loading