@@ -64,11 +64,11 @@ use starknet_api::{
6464} ;
6565use starknet_types_core:: felt:: Felt ;
6666
67- use crate :: check_tx_execution_error_for_invalid_scenario;
6867use crate :: context:: { BlockContext , TransactionContext } ;
6968use crate :: execution:: call_info:: CallInfo ;
7069use crate :: execution:: contract_class:: TrackedResource ;
7170use crate :: execution:: entry_point:: { EntryPointExecutionContext , SierraGasRevertTracker } ;
71+ use crate :: execution:: syscalls:: hint_processor:: ENTRYPOINT_NOT_FOUND_ERROR ;
7272use crate :: execution:: syscalls:: SyscallSelector ;
7373use crate :: fee:: fee_utils:: {
7474 get_fee_by_gas_vector,
@@ -96,6 +96,7 @@ use crate::transaction::account_transaction::{
9696 AccountTransaction ,
9797 ExecutionFlags as AccountExecutionFlags ,
9898} ;
99+ use crate :: transaction:: errors:: TransactionExecutionError ;
99100use crate :: transaction:: objects:: { HasRelatedFeeType , TransactionInfoCreator } ;
100101use crate :: transaction:: test_utils:: {
101102 all_resource_bounds,
@@ -119,6 +120,7 @@ use crate::transaction::test_utils::{
119120use crate :: transaction:: transaction_types:: TransactionType ;
120121use crate :: transaction:: transactions:: ExecutableTransaction ;
121122use crate :: utils:: u64_from_usize;
123+ use crate :: { check_tx_execution_error_for_invalid_scenario, retdata} ;
122124
123125#[ rstest]
124126#[ case:: cairo1( CairoVersion :: Cairo1 ( RunnableCairo1 :: Casm ) ) ]
@@ -2020,3 +2022,30 @@ fn test_call_contract_that_panics(
20202022 }
20212023 }
20222024}
2025+
2026+ #[ rstest]
2027+ fn test_missing_validate_entrypoint_rejects (
2028+ block_context : BlockContext ,
2029+ default_all_resource_bounds : ValidResourceBounds ,
2030+ ) {
2031+ let chain_info = & block_context. chain_info ;
2032+ let account = FeatureContract :: AccountWithoutValidations ( CairoVersion :: Cairo0 ) ;
2033+ let test_contract = FeatureContract :: TestContract ( CairoVersion :: Cairo0 ) ;
2034+ let mut state = test_state ( chain_info, BALANCE , & [ ( account, 1u16 ) , ( test_contract, 1u16 ) ] ) ;
2035+ let test_contract_address = test_contract. get_instance_address ( 0_u16 ) ;
2036+ // Fund the test contract.
2037+ fund_account ( chain_info, test_contract_address, BALANCE , & mut state. state ) ;
2038+ // Send an invoke transaction with the test contract as the sender.
2039+ let tx_args = invoke_tx_args ! {
2040+ sender_address: test_contract_address,
2041+ resource_bounds: default_all_resource_bounds
2042+ } ;
2043+ let result = run_invoke_tx ( & mut state, & block_context, tx_args) ;
2044+ assert ! ( result. is_err( ) ) ;
2045+ let error = result. unwrap_err ( ) ;
2046+ assert_matches ! (
2047+ error,
2048+ TransactionExecutionError :: ValidateCairo0Error ( ret)
2049+ if ret == retdata![ Felt :: from_hex( ENTRYPOINT_NOT_FOUND_ERROR ) . unwrap( ) ]
2050+ ) ;
2051+ }
0 commit comments