Skip to content

Commit 0e2b36b

Browse files
starknet_os_flow_tests: migrate test_deploy_no_ctor_contract scenario (#10777)
* starknet_os_flow_tests: migrate test_deprecated_send_to_l1 scenario * starknet_os_flow_tests: migrate test_replace_class scenario * starknet_os_flow_tests: migrate test_ec_op scenario * starknet_os_flow_tests: migrate test_deploy_no_ctor_contract scenario
1 parent f259a2a commit 0e2b36b

File tree

1 file changed

+31
-0
lines changed
  • crates/starknet_os_flow_tests/src

1 file changed

+31
-0
lines changed

crates/starknet_os_flow_tests/src/tests.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2994,3 +2994,34 @@ async fn test_empty_multi_block() {
29942994
);
29952995
test_output.expect_hint_coverage("test_empty_multi_block");
29962996
}
2997+
2998+
/// Tests deploying a contract with no constructor.
2999+
/// The OS returns (retdata_size=0, retdata=0) from the deploy_contract function (in
3000+
/// deprecated_execute_syscalls.cairo, used both by Cairo0 and 1 contracts). This means retdata is
3001+
/// not relocatable in the VM as in all other cases. This test verifies our support for this case.
3002+
#[rstest]
3003+
#[tokio::test]
3004+
async fn test_deploy_no_ctor_contract() {
3005+
let empty_contract_cairo0 = FeatureContract::Empty(CairoVersion::Cairo0);
3006+
let (mut test_manager, _) = TestManager::<DictStateReader>::new_with_default_initial_state([(
3007+
empty_contract_cairo0,
3008+
calldata![],
3009+
)])
3010+
.await;
3011+
let class_hash = get_class_hash_of_feature_contract(empty_contract_cairo0);
3012+
3013+
// Deploy the empty contract using the deploy syscall.
3014+
let (deploy_tx, _address) = get_deploy_contract_tx_and_address_with_salt(
3015+
class_hash,
3016+
calldata![],
3017+
test_manager.next_nonce(*FUNDED_ACCOUNT_ADDRESS),
3018+
*NON_TRIVIAL_RESOURCE_BOUNDS,
3019+
ContractAddressSalt(Felt::ZERO),
3020+
);
3021+
test_manager.add_invoke_tx(deploy_tx, None);
3022+
3023+
// Run the test.
3024+
let test_output =
3025+
test_manager.execute_test_with_default_block_contexts(&TestParameters::default()).await;
3026+
test_output.perform_default_validations();
3027+
}

0 commit comments

Comments
 (0)