Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Add get block hash scenario to constractor test. (#1287)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware authored Dec 26, 2023
1 parent ad4f627 commit ce28997
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions crates/blockifier/src/transaction/transactions_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,25 @@ fn test_constructor_on_deploy_account_runs_in_validate_mode(
"Unauthorized syscall call_contract in execution mode Validate.",
ContractConstructorExecutionFailed,
);

if let CairoVersion::Cairo1 = cairo_version {
// Verify that the contract does not use the syscall get_block_hash in the constructor of
// deploy account.
let account_tx = create_account_tx_for_validate_test(
&mut NonceManager::default(),
FaultyAccountTxCreatorArgs {
scenario: GET_BLOCK_HASH,
contract_address_salt: salt_manager.next_salt(),
..default_args
},
);
let error = account_tx.execute(state, block_context, true, true).unwrap_err();
check_transaction_execution_error_for_custom_hint!(
&error,
"Unauthorized syscall get_block_hash in execution mode Validate.",
ContractConstructorExecutionFailed,
);
}
}

// Test that we exclude the fee token contract modification and adds the account’s balance change
Expand Down

0 comments on commit ce28997

Please sign in to comment.