@@ -37,33 +37,34 @@ type SGXProofProducer struct {
37
37
DummyProofProducer
38
38
}
39
39
40
- // SGXRequestProofBody represents the JSON body for requesting the proof.
41
- type SGXRequestProofBody struct {
42
- JsonRPC string `json:"jsonrpc"` //nolint:revive,stylecheck
43
- ID * big.Int `json:"id"`
44
- Method string `json:"method"`
45
- Params []* SGXRequestProofBodyParam `json:"params"`
40
+ // RaikoRequestProofBody represents the JSON body for requesting the proof.
41
+ type RaikoRequestProofBody struct {
42
+ L2RPC string `json:"rpc"`
43
+ L1RPC string `json:"l1_rpc"`
44
+ L1BeaconRPC string `json:"beacon_rpc"`
45
+ Block * big.Int `json:"block_number"`
46
+ Prover string `json:"prover"`
47
+ Graffiti string `json:"graffiti"`
48
+ Type string `json:"proof_type"`
49
+ SGX * SGXRequestProofBodyParam `json:"sgx"`
50
+ RISC0 RISC0RequestProofBodyParam `json:"risc0"`
46
51
}
47
52
48
- // SGXRequestProofBodyParam represents the JSON body of RequestProofBody 's `param ` field.
53
+ // SGXRequestProofBodyParam represents the JSON body of RaikoRequestProofBody 's `sgx ` field.
49
54
type SGXRequestProofBodyParam struct {
50
- Type string `json:"proof_type"`
51
- Block * big.Int `json:"block_number"`
52
- L2RPC string `json:"rpc"`
53
- L1RPC string `json:"l1_rpc"`
54
- L1BeaconRPC string `json:"beacon_rpc"`
55
- Prover string `json:"prover"`
56
- Graffiti string `json:"graffiti"`
57
- ProofParam * ProofParam `json:"sgx"`
58
- }
59
-
60
- // ProofParam represents the JSON body of SGXRequestProofBodyParam's `sgx` field.
61
- type ProofParam struct {
62
55
Setup bool `json:"setup"`
63
56
Bootstrap bool `json:"bootstrap"`
64
57
Prove bool `json:"prove"`
65
58
}
66
59
60
+ // RISC0RequestProofBodyParam represents the JSON body of RaikoRequestProofBody's `risc0` field.
61
+ type RISC0RequestProofBodyParam struct {
62
+ Bonsai bool `json:"bonsai"`
63
+ Snark bool `json:"snark"`
64
+ Profile bool `json:"profile"`
65
+ ExecutionPo2 * big.Int `json:"execution_po2"`
66
+ }
67
+
67
68
// SGXRequestProofBodyResponse represents the JSON body of the response of the proof requests.
68
69
type SGXRequestProofBodyResponse struct {
69
70
JsonRPC string `json:"jsonrpc"` //nolint:revive,stylecheck
@@ -162,32 +163,27 @@ func (s *SGXProofProducer) callProverDaemon(ctx context.Context, opts *ProofRequ
162
163
163
164
// requestProof sends a RPC request to proverd to try to get the requested proof.
164
165
func (s * SGXProofProducer ) requestProof (opts * ProofRequestOptions ) (* RaikoHostOutput , error ) {
165
- reqBody := SGXRequestProofBody {
166
- JsonRPC : "2.0" ,
167
- ID : common .Big1 ,
168
- Method : "proof" ,
169
- Params : []* SGXRequestProofBodyParam {{
170
- Type : s .ProofType ,
171
- Block : opts .BlockID ,
172
- L2RPC : s .L2Endpoint ,
173
- L1RPC : s .L1Endpoint ,
174
- L1BeaconRPC : s .L1BeaconEndpoint ,
175
- Prover : opts .ProverAddress .Hex ()[2 :],
176
- Graffiti : opts .Graffiti ,
177
- ProofParam : & ProofParam {
178
- Setup : false ,
179
- Bootstrap : false ,
180
- Prove : true ,
181
- },
182
- }},
166
+ reqBody := RaikoRequestProofBody {
167
+ Type : s .ProofType ,
168
+ Block : opts .BlockID ,
169
+ L2RPC : s .L2Endpoint ,
170
+ L1RPC : s .L1Endpoint ,
171
+ L1BeaconRPC : s .L1BeaconEndpoint ,
172
+ Prover : opts .ProverAddress .Hex ()[2 :],
173
+ Graffiti : opts .Graffiti ,
174
+ SGX : & SGXRequestProofBodyParam {
175
+ Setup : false ,
176
+ Bootstrap : false ,
177
+ Prove : true ,
178
+ },
183
179
}
184
180
185
181
jsonValue , err := json .Marshal (reqBody )
186
182
if err != nil {
187
183
return nil , err
188
184
}
189
185
190
- res , err := http .Post (s .RaikoHostEndpoint , "application/json" , bytes .NewBuffer (jsonValue ))
186
+ res , err := http .Post (s .RaikoHostEndpoint + "/proof" , "application/json" , bytes .NewBuffer (jsonValue ))
191
187
if err != nil {
192
188
return nil , err
193
189
}
0 commit comments