Skip to content

Commit 2f56d3b

Browse files
committed
fix(coordinator): reject malformed chunk/batch proof submissions with nil StarkProof
A submission carrying "proof": null (or omitting the key) unmarshals to a nil *OpenVMStarkProof; the metric block then dereferences StarkProof.Stat unconditionally and panics in the HTTP handler — skipping proofRecover and the verifier-failure accounting, and leaving the task stuck until the sweeper resets it. Any authenticated prover can trigger this. Guard right after unmarshal so malformed submissions take the normal error path.
1 parent 8cc4b0d commit 2f56d3b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎coordinator/internal/logic/submitproof/proof_receiver.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ func (m *ProofReceiverLogic) HandleZkProof(ctx *gin.Context, proofParameter coor
231231
if unmarshalErr := json.Unmarshal([]byte(proofParameter.Proof), &chunkProof); unmarshalErr != nil {
232232
return unmarshalErr
233233
}
234+
if chunkProof.StarkProof == nil {
235+
return errors.New("invalid chunk proof: missing stark proof")
236+
}
234237
success, verifyErr = m.verifier.VerifyChunkProof(chunkProof, hardForkName)
235238
if stat := chunkProof.StarkProof.Stat; stat != nil {
236239
if g, _ := m.proverSpeed.GetMetricWithLabelValues("chunk", "exec"); g != nil && stat.ExecutionTimeMills > 0 {
@@ -251,6 +254,9 @@ func (m *ProofReceiverLogic) HandleZkProof(ctx *gin.Context, proofParameter coor
251254
if unmarshalErr := json.Unmarshal([]byte(proofParameter.Proof), &batchProof); unmarshalErr != nil {
252255
return unmarshalErr
253256
}
257+
if batchProof.StarkProof == nil {
258+
return errors.New("invalid batch proof: missing stark proof")
259+
}
254260
success, verifyErr = m.verifier.VerifyBatchProof(batchProof, hardForkName)
255261
if stat := batchProof.StarkProof.Stat; stat != nil {
256262
if g, _ := m.proverSpeed.GetMetricWithLabelValues("batch", "exec"); g != nil && stat.ExecutionTimeMills > 0 {

0 commit comments

Comments
 (0)