diff --git a/packages/taiko-client/prover/proof_producer/sgx_producer.go b/packages/taiko-client/prover/proof_producer/sgx_producer.go index 3f4861fd933..91ca16064f3 100644 --- a/packages/taiko-client/prover/proof_producer/sgx_producer.go +++ b/packages/taiko-client/prover/proof_producer/sgx_producer.go @@ -308,6 +308,9 @@ 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 } @@ -315,7 +318,8 @@ func (s *SGXProofProducer) requestBatchProof( 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:]) diff --git a/packages/taiko-client/prover/proof_producer/zkvm_producer.go b/packages/taiko-client/prover/proof_producer/zkvm_producer.go index 3e2711a1962..98f8529acc5 100644 --- a/packages/taiko-client/prover/proof_producer/zkvm_producer.go +++ b/packages/taiko-client/prover/proof_producer/zkvm_producer.go @@ -479,6 +479,10 @@ 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 } @@ -486,7 +490,7 @@ func (s *ZKvmProofProducer) requestBatchProof( 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:])