From 52a843389c956393e723ae0fc6ecccabbb5b8240 Mon Sep 17 00:00:00 2001 From: Dori Medini Date: Thu, 30 Apr 2026 16:41:42 +0300 Subject: [PATCH] central_systest_blobs: initial block production --- .../resources/blob_file_generation | 2 +- .../resources/preconfirmed_block.json | 79 +++++++++++++++++-- .../src/cende_blob_regression_test.rs | 26 +++++- 3 files changed, 97 insertions(+), 10 deletions(-) diff --git a/crates/central_systest_blobs/resources/blob_file_generation b/crates/central_systest_blobs/resources/blob_file_generation index 7813681f5b4..62f9457511f 100644 --- a/crates/central_systest_blobs/resources/blob_file_generation +++ b/crates/central_systest_blobs/resources/blob_file_generation @@ -1 +1 @@ -5 \ No newline at end of file +6 \ No newline at end of file diff --git a/crates/central_systest_blobs/resources/preconfirmed_block.json b/crates/central_systest_blobs/resources/preconfirmed_block.json index 67829e299b4..daa375f8112 100644 --- a/crates/central_systest_blobs/resources/preconfirmed_block.json +++ b/crates/central_systest_blobs/resources/preconfirmed_block.json @@ -1,5 +1,5 @@ { - "block_number": 0, + "block_number": 1, "pre_confirmed_block": { "l1_da_mode": "CALLDATA", "l1_data_gas_price": { @@ -17,10 +17,79 @@ "sequencer_address": "0x1000", "starknet_version": "0.14.3", "status": "PRE_CONFIRMED", - "timestamp": 1000, - "transaction_receipts": [], - "transaction_state_diffs": [], - "transactions": [] + "timestamp": 1001, + "transaction_receipts": [ + { + "actual_fee": "0x0", + "events": [], + "execution_resources": { + "builtin_instance_counter": {}, + "data_availability": { + "l1_data_gas": 0, + "l1_gas": 0, + "l2_gas": 0 + }, + "n_memory_holes": 0, + "n_steps": 0, + "total_gas_consumed": { + "l1_data_gas": 0, + "l1_gas": 0, + "l2_gas": 0 + } + }, + "execution_status": "SUCCEEDED", + "l2_to_l1_messages": [], + "transaction_hash": "0x2bd201c1de8711bc3748efdbba3b2e997d44792dee9b4a8c598cf8663f99824", + "transaction_index": 0 + } + ], + "transaction_state_diffs": [ + { + "declared_classes": [ + { + "class_hash": "0x77fcf11f339d18db724aa522729b4c0e4e04aa85a6f104c10b469c020207dc1", + "compiled_class_hash": "0x1738a9f4a4bb3f014041cdb569087473d4ee4428328dc507cdac7da2df39b12" + } + ], + "deployed_contracts": [], + "migrated_compiled_classes": [], + "nonces": {}, + "old_declared_contracts": [], + "replaced_classes": [], + "storage_diffs": {} + } + ], + "transactions": [ + { + "account_deployment_data": [], + "class_hash": "0x77fcf11f339d18db724aa522729b4c0e4e04aa85a6f104c10b469c020207dc1", + "compiled_class_hash": "0x1738a9f4a4bb3f014041cdb569087473d4ee4428328dc507cdac7da2df39b12", + "fee_data_availability_mode": 0, + "nonce": "0x0", + "nonce_data_availability_mode": 0, + "paymaster_data": [], + "resource_bounds": { + "L1_DATA_GAS": { + "max_amount": "0x0", + "max_price_per_unit": "0x1" + }, + "L1_GAS": { + "max_amount": "0x0", + "max_price_per_unit": "0x1" + }, + "L2_GAS": { + "max_amount": "0x2540be400", + "max_price_per_unit": "0x0" + } + }, + "sender_address": "0x424f4f545354524150", + "signature": [], + "tip": "0x0", + "transaction_hash": "0x2bd201c1de8711bc3748efdbba3b2e997d44792dee9b4a8c598cf8663f99824", + "type": "DECLARE", + "version": "0x3" + } + ] }, "round": 0, "write_iteration": 0 diff --git a/crates/central_systest_blobs/src/cende_blob_regression_test.rs b/crates/central_systest_blobs/src/cende_blob_regression_test.rs index 3780e25b599..12aa74dcb08 100644 --- a/crates/central_systest_blobs/src/cende_blob_regression_test.rs +++ b/crates/central_systest_blobs/src/cende_blob_regression_test.rs @@ -33,6 +33,7 @@ use blockifier::test_utils::dict_state_reader::DictStateReader; use blockifier::transaction::account_transaction::AccountTransaction as BlockifierAccountTx; use blockifier::transaction::transaction_execution::Transaction as BlockifierTx; use blockifier::transaction::transactions::ExecutableTransaction; +use blockifier_test_utils::cairo_versions::{CairoVersion, RunnableCairo1}; use blockifier_test_utils::contracts::FeatureContract; use expect_test::expect_file; use google_cloud_storage::client::{Client, ClientConfig}; @@ -215,7 +216,6 @@ impl BlobFactory { /// Executes the unblocked transactions and applies the changes to the state. /// Any subsequent transaction added will end up in the next block. - #[expect(dead_code)] async fn close_block(&mut self) { let block_context = self.next_block_context(); let block_info = block_context.block_info().clone(); @@ -362,7 +362,6 @@ impl BlobFactory { // Tx generation // ===================== - #[expect(dead_code)] fn boostrap_declare_tx(&mut self, contract: FeatureContract) { let sender_address = ExecutableDeclareTx::bootstrap_address(); let sierra = contract.get_sierra(); @@ -601,9 +600,28 @@ async fn fetch_blob_file(client: &Client) -> Vec { #[tokio::test] async fn test_make_data() { - let blob_factory = BlobFactory::new(); + let mut blob_factory = BlobFactory::new(); let chain_info = OsChainInfo::from(&blob_factory.chain_info).to_hex_map(); - // TODO(Dori): create txs. + + // Create the list of transactions to be included in the blobs: + // 1. bootstrap declare of an ERC20 contract. + // 2. bootstrap declare of an account with real validate. + // TODO(Dori): the rest of the txs. + // 3. deploy account (with zero fees). + // 4. deploy ERC20 contract from the account (with zero fees), while minting some tokens to the + // sender account. + // (from this point - all txs include non-zero fees, and no more bootstrap declares) + // 5. declare the test contract. + // 6. deploy the test contract. + // 7. deploy another instance of the test contract. + // 8. invoke the test contract: something with a state change. + // 9. invoke the test contract: test syscalls. + let erc20_contract = FeatureContract::ERC20(CairoVersion::Cairo1(RunnableCairo1::Casm)); + let account_with_real_validate = FeatureContract::AccountWithRealValidate(RunnableCairo1::Casm); + blob_factory.boostrap_declare_tx(erc20_contract); + blob_factory.close_block().await; + blob_factory.boostrap_declare_tx(account_with_real_validate); + let (blobs, preconfirmed_block) = blob_factory.finalize().await; expect_file![CHAIN_INFO_PATH].assert_eq(&serde_json::to_string_pretty(&chain_info).unwrap()); expect_file![PRECONFIRMED_BLOCK_PATH].assert_eq(&to_normalized_json(&preconfirmed_block));