Skip to content

Commit

Permalink
Don't try to propose until we hit safe head (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog authored Nov 7, 2024
1 parent e9427f7 commit a0c0087
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions op-proposer/proposer/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ var (
ErrProposerNotRunning = errors.New("proposer is not running")
)

func init() {
if aggregateBatchSize <= 1 {
panic("aggregateBatchSize must be greater than 1")
}
}

type OOContract interface {
Version(*bind.CallOpts) (string, error)
LatestL2Output(opts *bind.CallOpts) (bindings.TypesOutputProposal, error)
Expand Down Expand Up @@ -319,6 +325,12 @@ func (l *L2OutputSubmitter) nextOutput(ctx context.Context, latestOutput binding
}
proposal := l.pending[0]

if proposal.To.Number < latestSafe.Number {
l.Log.Info("Aggregated output is not the latest safe block, waiting for more proofs",
"aggregated", l2BlockRefToBlockID(proposal.To), "latestSafe", latestSafe)
return nil, false, nil
}

if proposal.To.Hash != latestSafe.Hash {
l.Log.Warn("Aggregated output does not match the latest batched block, possible reorg",
"aggregated", l2BlockRefToBlockID(proposal.To), "latestSafe", latestSafe)
Expand Down

0 comments on commit a0c0087

Please sign in to comment.