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

feat(taiko-client): integrate new Raiko APIs (openAPI) #17254

Merged
merged 3 commits into from
May 20, 2024
Merged
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
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