@@ -2,6 +2,7 @@ use std::collections::HashMap;
22use std:: future:: Future ;
33use std:: net:: { Ipv4Addr , SocketAddr } ;
44use std:: path:: PathBuf ;
5+ use std:: sync:: Arc ;
56use std:: time:: Duration ;
67
78use apollo_base_layer_tests:: anvil_base_layer:: AnvilBaseLayer ;
@@ -117,9 +118,9 @@ use serde_json::{json, to_value};
117118use starknet_api:: block:: BlockNumber ;
118119use starknet_api:: core:: { ChainId , ContractAddress } ;
119120use starknet_api:: execution_resources:: GasAmount ;
120- use starknet_api:: rpc_transaction:: RpcTransaction ;
121+ use starknet_api:: rpc_transaction:: { RpcInvokeTransaction , RpcTransaction } ;
121122use starknet_api:: staking:: StakingWeight ;
122- use starknet_api:: transaction:: fields:: ContractAddressSalt ;
123+ use starknet_api:: transaction:: fields:: { ContractAddressSalt , Proof , ProofFacts } ;
123124use starknet_api:: transaction:: { L1HandlerTransaction , TransactionHash , TransactionHasher } ;
124125use starknet_committer:: db:: forest_trait:: {
125126 ForestMetadata ,
@@ -231,6 +232,57 @@ impl TestScenario for DeployAndInvokeTxs {
231232 }
232233}
233234
235+ fn load_proof_flow_proof_facts ( ) -> ProofFacts {
236+ let path = concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/resources/proof_flow/proof_facts.json" ) ;
237+ let json = std:: fs:: read_to_string ( path)
238+ . expect ( "Failed to read proof_facts.json — run the fixture generator first" ) ;
239+ serde_json:: from_str ( & json) . expect ( "Failed to parse proof_facts.json" )
240+ }
241+
242+ fn load_proof_flow_proof ( ) -> Proof {
243+ let path = concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/resources/proof_flow/proof.bin" ) ;
244+ let bytes =
245+ std:: fs:: read ( path) . expect ( "Failed to read proof.bin — run the fixture generator first" ) ;
246+ Proof ( Arc :: new ( bytes) )
247+ }
248+
249+ pub struct ProofFlowTxs {
250+ proof_facts : ProofFacts ,
251+ proof : Proof ,
252+ }
253+
254+ impl Default for ProofFlowTxs {
255+ fn default ( ) -> Self {
256+ Self :: new ( )
257+ }
258+ }
259+
260+ impl ProofFlowTxs {
261+ pub fn new ( ) -> Self {
262+ Self { proof_facts : load_proof_flow_proof_facts ( ) , proof : load_proof_flow_proof ( ) }
263+ }
264+ }
265+
266+ impl TestScenario for ProofFlowTxs {
267+ fn create_txs (
268+ & self ,
269+ tx_generator : & mut MultiAccountTransactionGenerator ,
270+ account_id : AccountId ,
271+ ) -> ( Vec < RpcTransaction > , Vec < L1HandlerTransaction > ) {
272+ let tx = tx_generator. account_with_id_mut ( account_id) . generate_trivial_rpc_invoke_tx ( 1 ) ;
273+ let RpcTransaction :: Invoke ( RpcInvokeTransaction :: V3 ( mut inner) ) = tx else {
274+ panic ! ( "Expected RpcInvokeTransactionV3" )
275+ } ;
276+ inner. proof_facts = self . proof_facts . clone ( ) ;
277+ inner. proof = self . proof . clone ( ) ;
278+ ( vec ! [ RpcTransaction :: Invoke ( RpcInvokeTransaction :: V3 ( inner) ) ] , vec ! [ ] )
279+ }
280+
281+ fn n_txs ( & self ) -> usize {
282+ 1
283+ }
284+ }
285+
234286// TODO(Tsabary): clean the passed args.
235287#[ allow( clippy:: too_many_arguments) ]
236288pub fn create_node_config (
0 commit comments