Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(taiko-client): fix zk status recognition #17946

Merged
merged 3 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading