Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Sep 10, 2024
1 parent ef1caf8 commit 244d0f6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ L2_CHAIN_ID=
MAX_CONCURRENT_PROOF_REQUESTS=
MAX_BLOCK_RANGE_PER_SPAN_PROOF=30
OP_SUCCINCT_SERVER_URL=http://op-succinct-server:3000
USE_CACHED_DB=false

# SP1 Configuration for the Server
PROVER_NETWORK_RPC=
Expand Down
27 changes: 19 additions & 8 deletions proposer/op/proposer/prove.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,30 @@ func (l *L2OutputSubmitter) RetryRequest(req *ent.ProofRequest) error {
} else {
// If a SPAN proof failed, assume it was too big and the SP1 runtime OOM'd.
// Therefore, create two new entries for the original proof split in half.
// TODO: Never split a SPAN proof into a range smaller than 1 block. Start must always be < end.
l.Log.Info("span proof failed, splitting in half to retry", "req", req)
tmpStart := req.StartBlock
tmpEnd := tmpStart + ((req.EndBlock - tmpStart) / 2)
for i := 0; i < 2; i++ {
err := l.db.NewEntryWithReqAddedTimestamp("SPAN", tmpStart, tmpEnd, 0)
if req.StartBlock+1 == req.EndBlock {
// If the start and end block are consecutive, we can't split the proof in half.
l.Log.Info("Span proof failed. Start and end block are consecutive. Adding to DB to retry.", "req", req)
err := l.db.NewEntryWithReqAddedTimestamp("SPAN", req.StartBlock, req.EndBlock, 0)
if err != nil {
l.Log.Error("failed to add new proof request", "err", err)
return err
}
} else {
// We split in half to retry by default in case the runtime OOM'd.
l.Log.Info("Span proof failed. Start and end block are not consecutive. Splitting in half to retry.", "req", req)
midPoint := req.StartBlock + ((req.EndBlock - req.StartBlock) / 2)

err := l.db.NewEntryWithReqAddedTimestamp("SPAN", req.StartBlock, midPoint, 0)
if err != nil {
l.Log.Error("failed to add first half proof request", "err", err)
return err
}

tmpStart = tmpEnd + 1
tmpEnd = req.EndBlock
err = l.db.NewEntryWithReqAddedTimestamp("SPAN", midPoint+1, req.EndBlock, 0)
if err != nil {
l.Log.Error("failed to add second half proof request", "err", err)
return err
}
}
}

Expand Down

0 comments on commit 244d0f6

Please sign in to comment.