Skip to content

Commit

Permalink
skip concurrent proof limit for agg proofs
Browse files Browse the repository at this point in the history
  • Loading branch information
zobront committed Aug 13, 2024
1 parent 27f10c2 commit 98ba72b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion op-proposer/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ var (
MaxConcurrentProofRequestsFlag = &cli.Uint64Flag{
Name: "max-concurrent-proof-requests",
Usage: "Maximum number of proofs to generate concurrently",
Value: 10,
Value: 20,
EnvVars: prefixEnvVars("MAX_CONCURRENT_PROOF_REQUESTS"),
}
TxCacheOutDirFlag = &cli.StringFlag{
Expand Down
21 changes: 13 additions & 8 deletions op-proposer/proposer/prove.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (l *L2OutputSubmitter) ProcessPendingProofs() error {

timeout := uint64(time.Now().Unix()) > req.ProofRequestTime+l.DriverSetup.Cfg.MaxProofTime
// ZTODO: Talk to Succinct about logic of different statuses
if timeout {
if timeout || status == "PROOF_UNCLAIMED" {
// update status in db to "FAILED"
l.Log.Info("proof timed out", "id", req.ProverRequestID)
err = l.db.UpdateProofStatus(req.ID, "FAILED")
Expand Down Expand Up @@ -84,24 +84,29 @@ func (l *L2OutputSubmitter) RequestQueuedProofs(ctx context.Context) error {
if err != nil {
return fmt.Errorf("failed to get unrequested proofs: %w", err)
}

currentRequestedProofs, err := l.db.CountRequestedProofs()
if err != nil {
return fmt.Errorf("failed to count requested proofs: %w", err)
}
if currentRequestedProofs >= int(l.Cfg.MaxConcurrentProofRequests) {
l.Log.Info("max concurrent proof requests reached, waiting for next cycle")
if nextProofToRequest == nil {
return nil
}

if nextProofToRequest.Type == proofrequest.TypeAGG {
blockNumber, blockHash, err := l.checkpointBlockHash(ctx)
if err != nil {
l.Log.Error("failed to checkpoint block hash", "err", err)
return err
}
l.db.AddL1BlockInfoToAggRequest(nextProofToRequest.StartBlock, nextProofToRequest.EndBlock, blockNumber, blockHash.Hex())
} else {
currentRequestedProofs, err := l.db.CountRequestedProofs()
if err != nil {
return fmt.Errorf("failed to count requested proofs: %w", err)
}
if currentRequestedProofs >= int(l.Cfg.MaxConcurrentProofRequests) {
l.Log.Info("max concurrent proof requests reached, waiting for next cycle")
return nil
}
}
go func(p ent.ProofRequest) {
l.Log.Info("requesting proof from server", "proof", p)
err = l.db.UpdateProofStatus(nextProofToRequest.ID, "REQ")
if err != nil {
l.Log.Error("failed to update proof status", "err", err)
Expand Down
2 changes: 1 addition & 1 deletion op-proposer/proposer/span_batches.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (l *L2OutputSubmitter) DeriveNewSpanBatches(ctx context.Context) error {

tmpStart := nextBlock
for {
maxEnd := tmpStart + l.DriverSetup.Cfg.MaxBlockRangePerSpanProof
maxEnd := tmpStart + l.DriverSetup.Cfg.MaxBlockRangePerSpanProof - 1
tmpEnd := uint64(math.Min(float64(maxEnd), float64(end)))

// insert the new span into the db to be requested in the future
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-bedrock/lib/sp1-contracts
Submodule sp1-contracts added at e98c8c
Binary file modified proofs.db
Binary file not shown.

0 comments on commit 98ba72b

Please sign in to comment.