Skip to content

Commit

Permalink
feat(taiko-client): integrate new Raiko APIs (openAPI) (#17254)
Browse files Browse the repository at this point in the history
Co-authored-by: David <[email protected]>
  • Loading branch information
YoGhurt111 and davidtaikocha authored May 20, 2024
1 parent 9eae95f commit fea1cbe
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/taiko-client/prover/proof_producer/sgx_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ type RISC0RequestProofBodyParam struct {

// RaikoRequestProofBodyResponse represents the JSON body of the response of the proof requests.
type RaikoRequestProofBodyResponse struct {
Proof string `json:"proof"` //nolint:revive,stylecheck
ErrorMessage string `json:"message"`
Data *RaikoProofData `json:"data"`
ErrorMessage string `json:"message"`
}

type RaikoProofData struct {
Proof string `json:"proof"` //nolint:revive,stylecheck
}

// RequestProof implements the ProofProducer interface.
Expand Down Expand Up @@ -135,7 +139,14 @@ func (s *SGXProofProducer) callProverDaemon(ctx context.Context, opts *ProofRequ

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

proof = common.Hex2Bytes(output.Proof[2:])
// Raiko returns "" as proof when proof type is native,
// so we just convert "" to bytes
if s.ProofType == ProofTypeCPU {
proof = common.Hex2Bytes(output.Data.Proof)
} else {
proof = common.Hex2Bytes(output.Data.Proof[2:])
}

log.Info(
"Proof generated",
"height", opts.BlockID,
Expand Down

0 comments on commit fea1cbe

Please sign in to comment.