@@ -44,6 +44,7 @@ use google_cloud_storage::http::objects::get::GetObjectRequest;
4444use google_cloud_storage:: http:: objects:: upload:: { Media , UploadObjectRequest , UploadType } ;
4545use google_cloud_storage:: http:: Error as GcsError ;
4646use mockall:: predicate:: eq;
47+ use starknet_api:: abi:: abi_utils:: selector_from_name;
4748use starknet_api:: block:: { BlockHash , BlockHashAndNumber , BlockInfo , BlockNumber , BlockTimestamp } ;
4849use starknet_api:: block_hash:: block_hash_calculator:: {
4950 calculate_block_commitments,
@@ -850,19 +851,9 @@ async fn test_make_data() {
850851 let mut blob_factory = BlobFactory :: new ( ) ;
851852 let chain_info = OsChainInfo :: from ( & blob_factory. chain_info ) . to_hex_map ( ) ;
852853
853- // Create the list of transactions to be included in the blobs:
854- // 1. bootstrap declare of an ERC20 contract.
855- // 2. bootstrap declare of an account with real validate.
856- // 3. deploy account (with zero fees).
857- // 4. deploy ERC20 contract from the account (with zero fees), while minting some tokens to the
858- // sender account.
859- // (from this point - all txs include non-zero fees, and no more bootstrap declares)
860- // 5. declare the test contract.
861- // 6. deploy the test contract.
862- // 7. deploy another instance of the test contract.
863- // TODO(Dori): the rest of the txs.
864- // 8. invoke the test contract: something with a state change.
865- // 9. invoke the test contract: test syscalls.
854+ // Create the list of transactions to be included in the blobs.
855+ // Block closing point is arbitrary, although it is preferable not to close after the last tx
856+ // (to ensure the preconfirmed block is not empty).
866857 let erc20_contract = FeatureContract :: ERC20 ( CairoVersion :: Cairo1 ( RunnableCairo1 :: Casm ) ) ;
867858 let account_with_real_validate = FeatureContract :: AccountWithRealValidate ( RunnableCairo1 :: Casm ) ;
868859 let test_contract = FeatureContract :: TestContract ( CairoVersion :: Cairo1 ( RunnableCairo1 :: Casm ) ) ;
@@ -892,17 +883,79 @@ async fn test_make_data() {
892883 blob_factory. close_block ( ) . await ;
893884 blob_factory. make_declare_tx ( test_contract, Some ( * OPERATOR_ADDRESS ) ) ;
894885 blob_factory. close_block ( ) . await ;
895- let _test_contract_address_0 = blob_factory. make_operator_deploy_tx (
886+ let test_contract_address_0 = blob_factory. make_operator_deploy_tx (
896887 test_contract,
897888 calldata ! [ Felt :: ZERO , Felt :: ZERO ] ,
898889 true , // charge fee
899890 ) ;
900891 blob_factory. close_block ( ) . await ;
901- let _test_contract_address_1 = blob_factory. make_operator_deploy_tx (
892+ let test_contract_address_1 = blob_factory. make_operator_deploy_tx (
902893 test_contract,
903894 calldata ! [ Felt :: ONE , Felt :: ONE ] ,
904895 true , // charge fee
905896 ) ;
897+ blob_factory. close_block ( ) . await ;
898+ blob_factory. make_operator_invoke_tx (
899+ test_contract_address_0,
900+ "test_increment" ,
901+ & [ Felt :: ZERO ; 3 ] ,
902+ true , // charge fee
903+ false , // should not revert
904+ ) ;
905+ blob_factory. close_block ( ) . await ;
906+ blob_factory. make_operator_invoke_tx (
907+ test_contract_address_1,
908+ "test_storage_read_write" ,
909+ & [ Felt :: ONE , Felt :: TWO ] ,
910+ true , // charge fee
911+ false , // should not revert
912+ ) ;
913+ blob_factory. close_block ( ) . await ;
914+ blob_factory. make_operator_invoke_tx (
915+ test_contract_address_1,
916+ "test_storage_write" ,
917+ & [ Felt :: THREE , Felt :: ONE ] ,
918+ true , // charge fee
919+ false , // should not revert
920+ ) ;
921+ blob_factory. close_block ( ) . await ;
922+ blob_factory. make_operator_invoke_tx (
923+ test_contract_address_0,
924+ "write_and_revert" ,
925+ & [ Felt :: from ( 7u8 ) , Felt :: ONE ] ,
926+ true , // charge fee
927+ true , // should revert
928+ ) ;
929+ blob_factory. close_block ( ) . await ;
930+ blob_factory. make_operator_invoke_tx (
931+ test_contract_address_1,
932+ "test_call_contract" ,
933+ & [
934+ * * test_contract_address_0,
935+ selector_from_name ( "test_storage_read_write" ) . 0 ,
936+ Felt :: TWO ,
937+ Felt :: from ( 0x1000 ) ,
938+ Felt :: from ( 0x1000 ) ,
939+ ] ,
940+ true , // charge fee
941+ false , // should not revert
942+ ) ;
943+ blob_factory. close_block ( ) . await ;
944+ blob_factory. make_operator_invoke_tx (
945+ test_contract_address_1,
946+ "write_1" ,
947+ & [ Felt :: TWO ] ,
948+ true , // charge fee
949+ false , // should not revert
950+ ) ;
951+ blob_factory. close_block ( ) . await ;
952+ blob_factory. make_operator_invoke_tx (
953+ test_contract_address_0,
954+ "catch_write_revert_panic" ,
955+ & [ * * test_contract_address_1, Felt :: from ( 0x2000 ) ] ,
956+ true , // charge fee
957+ false , // should not revert (inner error is caught)
958+ ) ;
906959
907960 let ( blobs, preconfirmed_block) = blob_factory. finalize ( ) . await ;
908961 expect_file ! [ CHAIN_INFO_PATH ] . assert_eq ( & serde_json:: to_string_pretty ( & chain_info) . unwrap ( ) ) ;
0 commit comments