@@ -7,6 +7,7 @@ use crate::{
77use anyhow:: anyhow;
88use attestation_report:: { Risc0ZKVMProof , ZKDCAPQuote , ZKVMProof } ;
99use crypto:: Address ;
10+ use dcap_quote_verifier:: { collaterals:: IntelCollateral , verifier:: VerifiedOutput } ;
1011use keymanager:: EnclaveKeyManager ;
1112use lcp_types:: Time ;
1213use log:: * ;
@@ -52,7 +53,8 @@ pub fn run_zkdcap_ra(
5253 elf,
5354 disable_pre_execution,
5455 current_time,
55- res,
56+ res. raw_quote ,
57+ res. collateral ,
5658 )
5759}
5860
@@ -81,26 +83,29 @@ pub fn run_zkdcap_ra_simulation(
8183 elf,
8284 disable_pre_execution,
8385 current_time,
84- res,
86+ res. raw_quote ,
87+ res. collateral ,
8588 )
8689}
8790
91+ #[ allow( clippy:: too_many_arguments) ]
8892fn zkdcap_ra (
8993 key_manager : & EnclaveKeyManager ,
9094 target_enclave_key : Address ,
9195 prover_mode : Risc0ProverMode ,
9296 elf : & [ u8 ] ,
9397 disable_pre_execution : bool ,
9498 current_time : Time ,
95- res : DCAPRemoteAttestationResult ,
99+ raw_quote : Vec < u8 > ,
100+ collateral : IntelCollateral ,
96101) -> Result < ( ) , Error > {
97102 let image_id = compute_image_id ( elf)
98103 . map_err ( |e| Error :: anyhow ( anyhow ! ( "cannot compute image id: {}" , e) ) ) ?;
99104
100105 debug ! (
101106 "proving with input: quote={}, collateral={}, current_time={}" ,
102- hex:: encode( & res . raw_quote) ,
103- hex:: encode( res . collateral. to_bytes( ) ) ,
107+ hex:: encode( & raw_quote) ,
108+ hex:: encode( collateral. to_bytes( ) ) ,
104109 current_time
105110 ) ;
106111
@@ -109,8 +114,8 @@ fn zkdcap_ra(
109114 let res = get_executor ( )
110115 . execute (
111116 build_env (
112- & res . raw_quote ,
113- & res . collateral . to_bytes ( ) ,
117+ & raw_quote,
118+ & collateral. to_bytes ( ) ,
114119 current_time. as_unix_timestamp_secs ( ) ,
115120 ) ?,
116121 elf,
@@ -128,8 +133,8 @@ fn zkdcap_ra(
128133 let prover_info = prove (
129134 & prover_mode,
130135 build_env (
131- & res . raw_quote ,
132- & res . collateral . to_bytes ( ) ,
136+ & raw_quote,
137+ & collateral. to_bytes ( ) ,
133138 current_time. as_unix_timestamp_secs ( ) ,
134139 ) ?,
135140 elf,
@@ -160,7 +165,15 @@ fn zkdcap_ra(
160165 ) ;
161166 }
162167
163- let quote = res. get_ra_quote ( current_time) ;
168+ let output = VerifiedOutput :: from_bytes ( & prover_info. receipt . journal . bytes )
169+ . map_err ( |e| Error :: anyhow ( anyhow ! ( "cannot parse receipt: {}" , e) ) ) ?;
170+
171+ let quote = DCAPRemoteAttestationResult {
172+ raw_quote,
173+ output,
174+ collateral,
175+ }
176+ . get_ra_quote ( current_time) ;
164177 key_manager
165178 . save_ra_quote (
166179 target_enclave_key,
0 commit comments