Skip to content

Commit 6e16f47

Browse files
central_systest_blobs: add some invokes
1 parent 103c6c9 commit 6e16f47

3 files changed

Lines changed: 91 additions & 53 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
11
1+
12

crates/central_systest_blobs/resources/preconfirmed_block.json

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"block_number": 6,
2+
"block_number": 13,
33
"pre_confirmed_block": {
44
"l1_da_mode": "CALLDATA",
55
"l1_data_gas_price": {
@@ -17,16 +17,16 @@
1717
"sequencer_address": "0x1000",
1818
"starknet_version": "0.14.3",
1919
"status": "PRE_CONFIRMED",
20-
"timestamp": 1006,
20+
"timestamp": 1013,
2121
"transaction_receipts": [
2222
{
23-
"actual_fee": "0x158bf1",
23+
"actual_fee": "0xff313",
2424
"events": [
2525
{
2626
"data": [
2727
"0xf99e7cdfbcce0bf14ce17e4c57fd2d12ad1bca5fc8e46a9fbafc36b59a9955",
2828
"0x1000",
29-
"0x158bf1",
29+
"0xff313",
3030
"0x0"
3131
],
3232
"from_address": "0x6bd1d71a2fb67a567618584ca31da288dbc2e1a8421e4045e05f52c19bfab83",
@@ -38,58 +38,47 @@
3838
"execution_resources": {
3939
"builtin_instance_counter": {
4040
"pedersen_builtin": 4,
41-
"poseidon_builtin": 17,
41+
"poseidon_builtin": 15,
4242
"range_check_builtin": 90
4343
},
4444
"data_availability": {
4545
"l1_data_gas": 0,
46-
"l1_gas": 4095,
46+
"l1_gas": 1652,
4747
"l2_gas": 0
4848
},
4949
"n_memory_holes": 0,
50-
"n_steps": 4403,
50+
"n_steps": 4381,
5151
"total_gas_consumed": {
5252
"l1_data_gas": 0,
53-
"l1_gas": 4646,
54-
"l2_gas": 1407435
53+
"l1_gas": 1652,
54+
"l2_gas": 1043615
5555
}
5656
},
5757
"execution_status": "SUCCEEDED",
5858
"l2_to_l1_messages": [],
59-
"transaction_hash": "0x69baeec4f5fd1665ef711e66f55b891ea8c8427d2cacb2eb39e3b66d320ae0d",
59+
"transaction_hash": "0x4acc6e7cb93683ae3a42ed499788f2d0143e8c3357315e1ecaad4e65f6dd479",
6060
"transaction_index": 0
6161
}
6262
],
6363
"transaction_state_diffs": [
6464
{
6565
"declared_classes": [],
66-
"deployed_contracts": [
67-
{
68-
"address": "0x4021329459ab2dacdd89c397996da9214211fa2abf2cda1bfb8f4cffe6db51f",
69-
"class_hash": "0x4b0dc3014cc21eeeeba97610d8fb3eaf61c428c513a2e9bfcf1b7beb9cb99c0"
70-
}
71-
],
66+
"deployed_contracts": [],
7267
"migrated_compiled_classes": [],
7368
"nonces": {
74-
"0xf99e7cdfbcce0bf14ce17e4c57fd2d12ad1bca5fc8e46a9fbafc36b59a9955": "0x5"
69+
"0xf99e7cdfbcce0bf14ce17e4c57fd2d12ad1bca5fc8e46a9fbafc36b59a9955": "0xc"
7570
},
7671
"old_declared_contracts": [],
7772
"replaced_classes": [],
7873
"storage_diffs": {
79-
"0x4021329459ab2dacdd89c397996da9214211fa2abf2cda1bfb8f4cffe6db51f": [
80-
{
81-
"key": "0x1275130f95dda36bcbb6e9d28796c1d7e10b6e9fd5ed083e0ede4b12f613528",
82-
"value": "0x2"
83-
}
84-
],
8574
"0x6bd1d71a2fb67a567618584ca31da288dbc2e1a8421e4045e05f52c19bfab83": [
8675
{
8776
"key": "0x6fba6554adab51d0272b896b6f41768bd0491e5ad59c39fab38e65767974793",
88-
"value": "0xffffffffffffffffffffffff92bbce2b"
77+
"value": "0xffffffffffffffffffffffff924412b1"
8978
},
9079
{
9180
"key": "0x723973208639b7839ce298f7ffea61e3f9533872defd7abdb91023db4658812",
92-
"value": "0x6d4431d4"
81+
"value": "0x6dbbed4e"
9382
}
9483
]
9584
}
@@ -100,18 +89,14 @@
10089
"account_deployment_data": [],
10190
"calldata": [
10291
"0x1",
103-
"0xf99e7cdfbcce0bf14ce17e4c57fd2d12ad1bca5fc8e46a9fbafc36b59a9955",
104-
"0x2730079d734ee55315f4f141eaed376bddd8c2133523d223a344c5604e0f7f8",
105-
"0x6",
106-
"0x4b0dc3014cc21eeeeba97610d8fb3eaf61c428c513a2e9bfcf1b7beb9cb99c0",
107-
"0x0",
92+
"0x3d275d3e01ff9dca442ca4aa77b00d6581ad890e3df054932a6851a5166e94d",
93+
"0x4ea6d2b84c4aea3baab8c031143fcd1fdf95debad5f888784f8db17e1c17f4",
10894
"0x2",
109-
"0x1",
110-
"0x1",
111-
"0x0"
95+
"0x4021329459ab2dacdd89c397996da9214211fa2abf2cda1bfb8f4cffe6db51f",
96+
"0x2000"
11297
],
11398
"fee_data_availability_mode": 0,
114-
"nonce": "0x4",
99+
"nonce": "0xb",
115100
"nonce_data_availability_mode": 0,
116101
"paymaster_data": [],
117102
"proof_facts": [],
@@ -131,11 +116,11 @@
131116
},
132117
"sender_address": "0xf99e7cdfbcce0bf14ce17e4c57fd2d12ad1bca5fc8e46a9fbafc36b59a9955",
133118
"signature": [
134-
"0x24b3b8fc254a82c56f7c592ebaf989fb2551228ac0f8d7fa2b0cb43ea94dc2a",
135-
"0x70feac66dc56daf6857c6a34a4b547ca653a96fb3d674b180ce403684e8dbba"
119+
"0x47fc4402ccfebfe5e1a8af95ee4de99932534b43d9161e7024847382c022926",
120+
"0x71c9ccc594f6d54d88b649a51dc167c3df0423d4a3f95a0e1b85f2560e78588"
136121
],
137122
"tip": "0x0",
138-
"transaction_hash": "0x69baeec4f5fd1665ef711e66f55b891ea8c8427d2cacb2eb39e3b66d320ae0d",
123+
"transaction_hash": "0x4acc6e7cb93683ae3a42ed499788f2d0143e8c3357315e1ecaad4e65f6dd479",
139124
"type": "INVOKE_FUNCTION",
140125
"version": "0x3"
141126
}

crates/central_systest_blobs/src/cende_blob_regression_test.rs

Lines changed: 68 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ use google_cloud_storage::http::objects::get::GetObjectRequest;
4444
use google_cloud_storage::http::objects::upload::{Media, UploadObjectRequest, UploadType};
4545
use google_cloud_storage::http::Error as GcsError;
4646
use mockall::predicate::eq;
47+
use starknet_api::abi::abi_utils::selector_from_name;
4748
use starknet_api::block::{BlockHash, BlockHashAndNumber, BlockInfo, BlockNumber, BlockTimestamp};
4849
use starknet_api::block_hash::block_hash_calculator::{
4950
calculate_block_commitments,
@@ -858,19 +859,9 @@ async fn test_make_data() {
858859
let mut blob_factory = BlobFactory::new();
859860
let chain_info = OsChainInfo::from(&blob_factory.chain_info).to_hex_map();
860861

861-
// Create the list of transactions to be included in the blobs:
862-
// 1. bootstrap declare of an ERC20 contract.
863-
// 2. bootstrap declare of an account with real validate.
864-
// 3. deploy account (with zero fees).
865-
// 4. deploy ERC20 contract from the account (with zero fees), while minting some tokens to the
866-
// sender account.
867-
// (from this point - all txs include non-zero fees, and no more bootstrap declares)
868-
// 5. declare the test contract.
869-
// 6. deploy the test contract.
870-
// 7. deploy another instance of the test contract.
871-
// TODO(Dori): the rest of the txs.
872-
// 8. invoke the test contract: something with a state change.
873-
// 9. invoke the test contract: test syscalls.
862+
// Create the list of transactions to be included in the blobs.
863+
// Block closing point is arbitrary, although it is preferable not to close after the last tx
864+
// (to ensure the preconfirmed block is not empty).
874865
let erc20_contract = FeatureContract::ERC20(CairoVersion::Cairo1(RunnableCairo1::Casm));
875866
let account_with_real_validate = FeatureContract::AccountWithRealValidate(RunnableCairo1::Casm);
876867
let test_contract = FeatureContract::TestContract(CairoVersion::Cairo1(RunnableCairo1::Casm));
@@ -900,17 +891,79 @@ async fn test_make_data() {
900891
blob_factory.close_block().await;
901892
blob_factory.make_declare_tx(test_contract, Some(*OPERATOR_ADDRESS));
902893
blob_factory.close_block().await;
903-
let _test_contract_address_0 = blob_factory.make_operator_deploy_tx(
894+
let test_contract_address_0 = blob_factory.make_operator_deploy_tx(
904895
test_contract,
905896
calldata![Felt::ZERO, Felt::ZERO],
906897
true, // charge fee
907898
);
908899
blob_factory.close_block().await;
909-
let _test_contract_address_1 = blob_factory.make_operator_deploy_tx(
900+
let test_contract_address_1 = blob_factory.make_operator_deploy_tx(
910901
test_contract,
911902
calldata![Felt::ONE, Felt::ONE],
912903
true, // charge fee
913904
);
905+
blob_factory.close_block().await;
906+
blob_factory.make_operator_invoke_tx(
907+
test_contract_address_0,
908+
"test_increment",
909+
&[Felt::ZERO; 3],
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_read_write",
917+
&[Felt::ONE, Felt::TWO],
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_1,
924+
"test_storage_write",
925+
&[Felt::THREE, Felt::ONE],
926+
true, // charge fee
927+
false, // should not revert
928+
);
929+
blob_factory.close_block().await;
930+
blob_factory.make_operator_invoke_tx(
931+
test_contract_address_0,
932+
"write_and_revert",
933+
&[Felt::from(7u8), Felt::ONE],
934+
true, // charge fee
935+
true, // should revert
936+
);
937+
blob_factory.close_block().await;
938+
blob_factory.make_operator_invoke_tx(
939+
test_contract_address_1,
940+
"test_call_contract",
941+
&[
942+
**test_contract_address_0,
943+
selector_from_name("test_storage_read_write").0,
944+
Felt::TWO,
945+
Felt::from(0x1000),
946+
Felt::from(0x1000),
947+
],
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_1,
954+
"write_1",
955+
&[Felt::TWO],
956+
true, // charge fee
957+
false, // should not revert
958+
);
959+
blob_factory.close_block().await;
960+
blob_factory.make_operator_invoke_tx(
961+
test_contract_address_0,
962+
"catch_write_revert_panic",
963+
&[**test_contract_address_1, Felt::from(0x2000)],
964+
true, // charge fee
965+
false, // should not revert (inner error is caught)
966+
);
914967

915968
let (blobs, preconfirmed_block) = blob_factory.finalize().await;
916969
expect_file![CHAIN_INFO_PATH].assert_eq(&serde_json::to_string_pretty(&chain_info).unwrap());

0 commit comments

Comments
 (0)