Skip to content

Commit 4a1e9a3

Browse files
central_systest_blobs: initial block production
1 parent 54e47dc commit 4a1e9a3

3 files changed

Lines changed: 97 additions & 10 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5
1+
6

crates/central_systest_blobs/resources/preconfirmed_block.json

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"block_number": 0,
2+
"block_number": 1,
33
"pre_confirmed_block": {
44
"l1_da_mode": "CALLDATA",
55
"l1_data_gas_price": {
@@ -17,10 +17,79 @@
1717
"sequencer_address": "0x1000",
1818
"starknet_version": "0.14.3",
1919
"status": "PRE_CONFIRMED",
20-
"timestamp": 1000,
21-
"transaction_receipts": [],
22-
"transaction_state_diffs": [],
23-
"transactions": []
20+
"timestamp": 1001,
21+
"transaction_receipts": [
22+
{
23+
"actual_fee": "0x0",
24+
"events": [],
25+
"execution_resources": {
26+
"builtin_instance_counter": {},
27+
"data_availability": {
28+
"l1_data_gas": 0,
29+
"l1_gas": 0,
30+
"l2_gas": 0
31+
},
32+
"n_memory_holes": 0,
33+
"n_steps": 0,
34+
"total_gas_consumed": {
35+
"l1_data_gas": 0,
36+
"l1_gas": 0,
37+
"l2_gas": 0
38+
}
39+
},
40+
"execution_status": "SUCCEEDED",
41+
"l2_to_l1_messages": [],
42+
"transaction_hash": "0x2bd201c1de8711bc3748efdbba3b2e997d44792dee9b4a8c598cf8663f99824",
43+
"transaction_index": 0
44+
}
45+
],
46+
"transaction_state_diffs": [
47+
{
48+
"declared_classes": [
49+
{
50+
"class_hash": "0x77fcf11f339d18db724aa522729b4c0e4e04aa85a6f104c10b469c020207dc1",
51+
"compiled_class_hash": "0x1738a9f4a4bb3f014041cdb569087473d4ee4428328dc507cdac7da2df39b12"
52+
}
53+
],
54+
"deployed_contracts": [],
55+
"migrated_compiled_classes": [],
56+
"nonces": {},
57+
"old_declared_contracts": [],
58+
"replaced_classes": [],
59+
"storage_diffs": {}
60+
}
61+
],
62+
"transactions": [
63+
{
64+
"account_deployment_data": [],
65+
"class_hash": "0x77fcf11f339d18db724aa522729b4c0e4e04aa85a6f104c10b469c020207dc1",
66+
"compiled_class_hash": "0x1738a9f4a4bb3f014041cdb569087473d4ee4428328dc507cdac7da2df39b12",
67+
"fee_data_availability_mode": 0,
68+
"nonce": "0x0",
69+
"nonce_data_availability_mode": 0,
70+
"paymaster_data": [],
71+
"resource_bounds": {
72+
"L1_DATA_GAS": {
73+
"max_amount": "0x0",
74+
"max_price_per_unit": "0x1"
75+
},
76+
"L1_GAS": {
77+
"max_amount": "0x0",
78+
"max_price_per_unit": "0x1"
79+
},
80+
"L2_GAS": {
81+
"max_amount": "0x2540be400",
82+
"max_price_per_unit": "0x0"
83+
}
84+
},
85+
"sender_address": "0x424f4f545354524150",
86+
"signature": [],
87+
"tip": "0x0",
88+
"transaction_hash": "0x2bd201c1de8711bc3748efdbba3b2e997d44792dee9b4a8c598cf8663f99824",
89+
"type": "DECLARE",
90+
"version": "0x3"
91+
}
92+
]
2493
},
2594
"round": 0,
2695
"write_iteration": 0

crates/central_systest_blobs/src/cende_blob_regression_test.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use blockifier::test_utils::dict_state_reader::DictStateReader;
3333
use blockifier::transaction::account_transaction::AccountTransaction as BlockifierAccountTx;
3434
use blockifier::transaction::transaction_execution::Transaction as BlockifierTx;
3535
use blockifier::transaction::transactions::ExecutableTransaction;
36+
use blockifier_test_utils::cairo_versions::{CairoVersion, RunnableCairo1};
3637
use blockifier_test_utils::contracts::FeatureContract;
3738
use expect_test::expect_file;
3839
use google_cloud_storage::client::{Client, ClientConfig};
@@ -208,7 +209,6 @@ impl BlobFactory {
208209

209210
/// Executes the unblocked transactions and applies the changes to the state.
210211
/// Any subsequent transaction added will end up in the next block.
211-
#[expect(dead_code)]
212212
async fn close_block(&mut self) {
213213
let block_context = self.next_block_context();
214214
let block_info = block_context.block_info().clone();
@@ -355,7 +355,6 @@ impl BlobFactory {
355355
// Tx generation
356356
// =====================
357357

358-
#[expect(dead_code)]
359358
fn boostrap_declare_tx(&mut self, contract: FeatureContract) {
360359
let sender_address = ExecutableDeclareTx::bootstrap_address();
361360
let sierra = contract.get_sierra();
@@ -594,9 +593,28 @@ async fn fetch_blob_file(client: &Client) -> Vec<AerospikeBlob> {
594593

595594
#[tokio::test]
596595
async fn test_make_data() {
597-
let blob_factory = BlobFactory::new();
596+
let mut blob_factory = BlobFactory::new();
598597
let chain_info = OsChainInfo::from(&blob_factory.chain_info).to_hex_map();
599-
// TODO(Dori): create txs.
598+
599+
// Create the list of transactions to be included in the blobs:
600+
// 1. bootstrap declare of an ERC20 contract.
601+
// 2. bootstrap declare of an account with real validate.
602+
// TODO(Dori): the rest of the txs.
603+
// 3. deploy account (with zero fees).
604+
// 4. deploy ERC20 contract from the account (with zero fees), while minting some tokens to the
605+
// sender account.
606+
// (from this point - all txs include non-zero fees, and no more bootstrap declares)
607+
// 5. declare the test contract.
608+
// 6. deploy the test contract.
609+
// 7. deploy another instance of the test contract.
610+
// 8. invoke the test contract: something with a state change.
611+
// 9. invoke the test contract: test syscalls.
612+
let erc20_contract = FeatureContract::ERC20(CairoVersion::Cairo1(RunnableCairo1::Casm));
613+
let account_with_real_validate = FeatureContract::AccountWithRealValidate(RunnableCairo1::Casm);
614+
blob_factory.boostrap_declare_tx(erc20_contract);
615+
blob_factory.close_block().await;
616+
blob_factory.boostrap_declare_tx(account_with_real_validate);
617+
600618
let (blobs, preconfirmed_block) = blob_factory.finalize().await;
601619
expect_file![CHAIN_INFO_PATH].assert_eq(&serde_json::to_string_pretty(&chain_info).unwrap());
602620
expect_file![PRECONFIRMED_BLOCK_PATH].assert_eq(&to_normalized_json(&preconfirmed_block));

0 commit comments

Comments
 (0)