Skip to content

Commit

Permalink
feat(taiko-client): catch raiko deserialization errors (#18644)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 authored Dec 25, 2024
1 parent 59d4f10 commit 98a98fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/taiko-client/prover/proof_producer/sgx_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,18 @@ func (s *SGXProofProducer) requestBatchProof(
return nil, fmt.Errorf("failed to get batch proof, msg: %s", output.ErrorMessage)
}

if output.Data == nil {
return nil, fmt.Errorf("unexpected structure error, response: %s", string(resBytes))
}
if output.Data.Status == ErrProofInProgress.Error() {
return nil, ErrProofInProgress
}
if output.Data.Status == StatusRegistered {
return nil, ErrRetry
}

if len(output.Data.Proof.Proof) == 0 {
if output.Data.Proof == nil ||
len(output.Data.Proof.Proof) == 0 {
return nil, errEmptyProof
}
proof = common.Hex2Bytes(output.Data.Proof.Proof[2:])
Expand Down
6 changes: 5 additions & 1 deletion packages/taiko-client/prover/proof_producer/zkvm_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,18 @@ func (s *ZKvmProofProducer) requestBatchProof(
if len(output.ErrorMessage) > 0 || len(output.Error) > 0 {
return nil, fmt.Errorf("failed to get batch proof, msg: %s", output.ErrorMessage)
}
if output.Data == nil {
return nil, fmt.Errorf("unexpected structure error, response: %s", string(resBytes))
}

if output.Data.Status == ErrProofInProgress.Error() {
return nil, ErrProofInProgress
}
if output.Data.Status == StatusRegistered {
return nil, ErrRetry
}

if len(output.Data.Proof.Proof) == 0 {
if output.Data.Proof == nil || len(output.Data.Proof.Proof) == 0 {
return nil, errEmptyProof
}
proof = common.Hex2Bytes(output.Data.Proof.Proof[2:])
Expand Down

0 comments on commit 98a98fd

Please sign in to comment.