@@ -29,6 +29,7 @@ use starknet_api::state::SierraContractClass;
2929use starknet_api:: transaction:: fields:: { Fee , Proof , ProofFacts } ;
3030use starknet_api:: transaction:: CalculateContractAddress ;
3131use starknet_api:: { executable_transaction, transaction, StarknetApiError } ;
32+ use starknet_types_core:: felt:: Felt ;
3233use thiserror:: Error ;
3334use tracing:: info;
3435
@@ -42,6 +43,8 @@ pub enum TransactionConverterError {
4243 ClassManagerClientError ( #[ from] ClassManagerClientError ) ,
4344 #[ error( "Class of hash: {class_hash} not found" ) ]
4445 ClassNotFound { class_hash : ClassHash } ,
46+ #[ error( "Proof for proof facts hash: {facts_hash} not found." ) ]
47+ ProofNotFound { facts_hash : Felt } ,
4548 #[ error( transparent) ]
4649 ProofManagerClientError ( #[ from] ProofManagerClientError ) ,
4750 #[ error( transparent) ]
@@ -114,6 +117,12 @@ impl TransactionConverter {
114117 . ok_or ( TransactionConverterError :: ClassNotFound { class_hash } )
115118 }
116119
120+ async fn get_proof ( & self , proof_facts : & ProofFacts ) -> TransactionConverterResult < Proof > {
121+ self . proof_manager_client
122+ . get_proof ( proof_facts. clone ( ) )
123+ . await ?
124+ . ok_or ( TransactionConverterError :: ProofNotFound { facts_hash : proof_facts. hash ( ) } )
125+ }
117126 async fn get_executable (
118127 & self ,
119128 class_hash : ClassHash ,
@@ -164,6 +173,14 @@ impl TransactionConverterTrait for TransactionConverter {
164173 ) -> TransactionConverterResult < RpcTransaction > {
165174 match tx. tx {
166175 InternalRpcTransactionWithoutTxHash :: Invoke ( tx) => {
176+ // We expect the proof to be available here because it has already been verified
177+ // and stored by the proof manager in the gateway.
178+ let proof = if tx. proof_facts . is_empty ( ) {
179+ Proof :: default ( )
180+ } else {
181+ self . get_proof ( & tx. proof_facts ) . await ?
182+ } ;
183+
167184 Ok ( RpcTransaction :: Invoke ( RpcInvokeTransaction :: V3 ( RpcInvokeTransactionV3 {
168185 resource_bounds : tx. resource_bounds ,
169186 signature : tx. signature ,
@@ -176,8 +193,7 @@ impl TransactionConverterTrait for TransactionConverter {
176193 calldata : tx. calldata ,
177194 account_deployment_data : tx. account_deployment_data ,
178195 proof_facts : tx. proof_facts ,
179- // TODO(AvivG): get proof from proof manager once implemented.
180- proof : Proof :: default ( ) ,
196+ proof,
181197 } ) ) )
182198 }
183199 InternalRpcTransactionWithoutTxHash :: Declare ( tx) => {
@@ -186,6 +202,8 @@ impl TransactionConverterTrait for TransactionConverter {
186202 compiled_class_hash : tx. compiled_class_hash ,
187203 signature : tx. signature ,
188204 nonce : tx. nonce ,
205+ // We expect the sierra to be available here because it has already been added
206+ // to the class manager in the gateway.
189207 contract_class : self . get_sierra ( tx. class_hash ) . await ?,
190208 resource_bounds : tx. resource_bounds ,
191209 tip : tx. tip ,
0 commit comments