Skip to content

Commit

Permalink
continue in process pending proofs loop
Browse files Browse the repository at this point in the history
  • Loading branch information
zobront committed Aug 13, 2024
1 parent 98ba72b commit a10e54a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion op-node/cmd/batch_decoder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
chainID, err := l1Client.ChainID(ctx)
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion op-proposer/proposer/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func (db *ProofDB) CloseDB() error {
}

func (db *ProofDB) NewEntry(proofType string, start, end uint64) error {
return db.NewEntryWithReqAddedTimestamp(proofType, start, end, uint64(time.Now().Unix()))
}

func (db *ProofDB) NewEntryWithReqAddedTimestamp(proofType string, start, end, now uint64) error {
// Convert string to proofrequest.Type
var pType proofrequest.Type
switch proofType {
Expand All @@ -57,7 +61,7 @@ func (db *ProofDB) NewEntry(proofType string, start, end uint64) error {
SetStartBlock(start).
SetEndBlock(end).
SetStatus(proofrequest.StatusUNREQ).
SetRequestAddedTime(uint64(time.Now().Unix())).
SetRequestAddedTime(now).
Save(context.Background())

if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions op-proposer/proposer/prove.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func (l *L2OutputSubmitter) ProcessPendingProofs() error {
l.Log.Error("failed to update completed proof status", "err", err)
return err
}
continue
}

timeout := uint64(time.Now().Unix()) > req.ProofRequestTime+l.DriverSetup.Cfg.MaxProofTime
Expand All @@ -51,7 +52,7 @@ func (l *L2OutputSubmitter) ProcessPendingProofs() error {
if req.Type == proofrequest.TypeAGG {
l.Log.Error("agg proof failed, adding to db to retry", "req", req)

err = l.db.NewEntry("AGG", req.StartBlock, req.EndBlock)
err = l.db.NewEntryWithReqAddedTimestamp("AGG", req.StartBlock, req.EndBlock, 0)
if err != nil {
l.Log.Error("failed to add new proof request", "err")
return err
Expand All @@ -64,7 +65,7 @@ func (l *L2OutputSubmitter) ProcessPendingProofs() error {
tmpStart := req.StartBlock
tmpEnd := tmpStart + ((req.EndBlock - tmpStart) / 2)
for i := 0; i < 2; i++ {
err = l.db.NewEntry("SPAN", tmpStart, tmpEnd)
err = l.db.NewEntryWithReqAddedTimestamp("SPAN", tmpStart, tmpEnd, 0)
if err != nil {
l.Log.Error("failed to add new proof request", "err", err)
return err
Expand Down
Binary file modified proofs.db
Binary file not shown.

0 comments on commit a10e54a

Please sign in to comment.