diff --git a/proposer/op/proposer/prove.go b/proposer/op/proposer/prove.go index 77913b6c..97200337 100644 --- a/proposer/op/proposer/prove.go +++ b/proposer/op/proposer/prove.go @@ -17,11 +17,11 @@ import ( ) const PROOF_STATUS_TIMEOUT = 30 * time.Second -const WITNESSGEN_TIMEOUT = 60 * 60 * time.Second +const WITNESSGEN_TIMEOUT = 60 * 60 * 4 * time.Second // This limit is set to prevent overloading the witness generation server. Until Kona improves their native I/O API (https://github.com/anton-rs/kona/issues/553) // the maximum number of concurrent witness generation requests is roughly num_cpu / 2. Set it to 5 for now to be safe. -const MAX_CONCURRENT_WITNESS_GEN = 3 +const MAX_CONCURRENT_WITNESS_GEN = 10 // Process all of requests in PROVING state. func (l *L2OutputSubmitter) ProcessProvingRequests() error { @@ -257,13 +257,8 @@ func (l *L2OutputSubmitter) prepareProofRequest(p ent.ProofRequest) ([]byte, err // RequestProof handles both mock and real proof requests func (l *L2OutputSubmitter) RequestProof(p ent.ProofRequest, isMock bool) error { - jsonBody, err := l.prepareProofRequest(p) - if err != nil { - return err - } - if isMock { - proofData, err := l.requestMockProof(p.Type, jsonBody) + proofData, err := l.requestMockProof(p.Type, p) if err != nil { return fmt.Errorf("mock proof request failed: %w", err) } @@ -277,7 +272,7 @@ func (l *L2OutputSubmitter) RequestProof(p ent.ProofRequest, isMock bool) error } // Request a real proof from the witness generation server. Returns the proof ID from the network. - proofID, err := l.requestRealProof(p.Type, jsonBody) + proofID, err := l.requestRealProof(p.Type, p) if err != nil { return fmt.Errorf("real proof request failed: %w", err) } @@ -291,8 +286,8 @@ func (l *L2OutputSubmitter) RequestProof(p ent.ProofRequest, isMock bool) error return l.db.SetProverRequestID(p.ID, proofID) } -func (l *L2OutputSubmitter) requestRealProof(proofType proofrequest.Type, jsonBody []byte) ([]byte, error) { - resp, err := l.makeProofRequest(proofType, jsonBody) +func (l *L2OutputSubmitter) requestRealProof(proofType proofrequest.Type, p ent.ProofRequest) ([]byte, error) { + resp, err := l.makeProofRequest(proofType, p) if err != nil { return nil, err } @@ -308,8 +303,8 @@ func (l *L2OutputSubmitter) requestRealProof(proofType proofrequest.Type, jsonBo } // Request a mock proof from the witness generation server. -func (l *L2OutputSubmitter) requestMockProof(proofType proofrequest.Type, jsonBody []byte) ([]byte, error) { - resp, err := l.makeProofRequest(proofType, jsonBody) +func (l *L2OutputSubmitter) requestMockProof(proofType proofrequest.Type, p ent.ProofRequest) ([]byte, error) { + resp, err := l.makeProofRequest(proofType, p) if err != nil { return nil, err } @@ -323,7 +318,12 @@ func (l *L2OutputSubmitter) requestMockProof(proofType proofrequest.Type, jsonBo } // Make a proof request to the witness generation server for the correct proof type. -func (l *L2OutputSubmitter) makeProofRequest(proofType proofrequest.Type, jsonBody []byte) ([]byte, error) { +func (l *L2OutputSubmitter) makeProofRequest(proofType proofrequest.Type, p ent.ProofRequest) ([]byte, error) { + jsonBody, err := l.prepareProofRequest(p) + if err != nil { + return nil, err + } + urlPath := l.getProofEndpoint(proofType) req, err := http.NewRequest("POST", l.Cfg.OPSuccinctServerUrl+"/"+urlPath, bytes.NewBuffer(jsonBody)) if err != nil { @@ -344,7 +344,7 @@ func (l *L2OutputSubmitter) makeProofRequest(proofType proofrequest.Type, jsonBo defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - l.Log.Error("Witness generation request failed", "status", resp.StatusCode, "body", resp.Body) + l.Log.Error("Witness generation request failed. ", "proofType", proofType, "start", p.StartBlock, "end", p.EndBlock, "status", resp.StatusCode, "body", resp.Body) l.Metr.RecordWitnessGenFailure("Failed") return nil, fmt.Errorf("received non-200 status code: %d", resp.StatusCode) }