Skip to content

Commit

Permalink
fix(taiko-client): fix zk status recognition (#17946)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 authored Aug 18, 2024
1 parent 513d9fe commit 164e476
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/taiko-client--hive_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ name: "Taiko Client Hive Tests"

on:
push:
branches: [main]
branches: [feature/introduce-zk2]
paths:
- "packages/taiko-client/**"
pull_request:
branches: [ feature/introduce-zk2 ]
paths:
- "packages/taiko-client/**"
- "go.mod"
Expand Down
4 changes: 2 additions & 2 deletions packages/taiko-client/prover/proof_producer/sgx_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ func (s *SGXProofProducer) callProverDaemon(ctx context.Context, opts *ProofRequ
return nil, errProofGenerating
}

log.Debug("Proof generation output", "output", output)

// Raiko returns "" as proof when proof type is native,
// so we just convert "" to bytes
if s.ProofType == ProofTypeCPU {
Expand Down Expand Up @@ -210,6 +208,8 @@ func (s *SGXProofProducer) requestProof(
return nil, err
}

log.Debug("Proof generation output", "output", string(resBytes))

var output RaikoRequestProofBodyResponse
if err := json.Unmarshal(resBytes, &output); err != nil {
return nil, err
Expand Down
12 changes: 9 additions & 3 deletions packages/taiko-client/prover/proof_producer/zkvm_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ const (
ZKProofTypeSP1 = "sp1"
)

var ErrProofInProgress = errors.New("work_in_progress")
var (
ErrProofInProgress = errors.New("work_in_progress")
ErrRetry = errors.New("retry")
StatusRegistered = "registered"
)

// RaikoRequestProofBodyResponseV2 represents the JSON body of the response of the proof requests.
type RaikoRequestProofBodyResponseV2 struct {
Expand Down Expand Up @@ -120,8 +124,9 @@ func (s *ZKvmProofProducer) callProverDaemon(ctx context.Context, opts *ProofReq
if output.Data.Status == ErrProofInProgress.Error() {
return nil, ErrProofInProgress
}

log.Debug("Proof generation output", "output", output)
if output.Data.Status == StatusRegistered {
return nil, ErrRetry
}

proof = common.Hex2Bytes(output.Data.Proof.Proof[2:])
log.Info(
Expand Down Expand Up @@ -183,6 +188,7 @@ func (s *ZKvmProofProducer) requestProof(
return nil, err
}

log.Debug("Proof generation output", "output", string(resBytes))
var output RaikoRequestProofBodyResponseV2
if err := json.Unmarshal(resBytes, &output); err != nil {
return nil, err
Expand Down

0 comments on commit 164e476

Please sign in to comment.