@@ -22,6 +22,7 @@ use stacks_common::types::StacksEpochId;
22
22
use crate :: vm:: ast:: errors:: ParseErrors ;
23
23
use crate :: vm:: ast:: ASTRules ;
24
24
use crate :: vm:: contexts:: Environment ;
25
+ use crate :: vm:: database:: MemoryBackingStore ;
25
26
use crate :: vm:: errors:: { CheckErrors , Error , RuntimeErrorType } ;
26
27
use crate :: vm:: tests:: {
27
28
env_factory, execute, is_committed, is_err_code_i128 as is_err_code, symbols_from_values,
@@ -1146,15 +1147,16 @@ fn test_cc_stack_depth(
1146
1147
) ;
1147
1148
}
1148
1149
1149
- // Test not valid for clarity-wasm runtime
1150
- // Contracts would error in the static analysis pass.
1151
- #[ cfg( not( feature = "clarity-wasm" ) ) ]
1152
1150
#[ apply( test_clarity_versions) ]
1153
1151
fn test_cc_trait_stack_depth (
1154
1152
version : ClarityVersion ,
1155
1153
epoch : StacksEpochId ,
1156
1154
mut env_factory : MemoryEnvironmentGenerator ,
1157
1155
) {
1156
+ // Test is not valid for ClarityV1.
1157
+ if cfg ! ( feature = "clarity-wasm" ) && version == ClarityVersion :: Clarity1 {
1158
+ return ;
1159
+ }
1158
1160
let mut owned_env = env_factory. get_env ( epoch) ;
1159
1161
1160
1162
let contract_one = "(define-public (foo)
@@ -1176,16 +1178,31 @@ fn test_cc_trait_stack_depth(
1176
1178
1177
1179
let mut placeholder_context =
1178
1180
ContractContext :: new ( QualifiedContractIdentifier :: transient ( ) , version) ;
1181
+
1182
+ let mut store = MemoryBackingStore :: new ( ) ;
1183
+ let mut analysis_db = store. as_analysis_db ( ) ;
1184
+ analysis_db. begin ( ) ;
1185
+
1179
1186
let mut env = owned_env. get_exec_environment ( None , None , & mut placeholder_context) ;
1180
1187
1181
1188
let contract_identifier = QualifiedContractIdentifier :: local ( "c-foo" ) . unwrap ( ) ;
1182
- env. initialize_contract ( contract_identifier, contract_one, ASTRules :: PrecheckSize )
1183
- . unwrap ( ) ;
1189
+ env. initialize_contract_with_db (
1190
+ contract_identifier,
1191
+ contract_one,
1192
+ ASTRules :: PrecheckSize ,
1193
+ & mut analysis_db,
1194
+ )
1195
+ . unwrap ( ) ;
1184
1196
1185
1197
let contract_identifier = QualifiedContractIdentifier :: local ( "c-bar" ) . unwrap ( ) ;
1186
1198
assert_eq ! (
1187
- env. initialize_contract( contract_identifier, contract_two, ASTRules :: PrecheckSize )
1188
- . unwrap_err( ) ,
1199
+ env. initialize_contract_with_db(
1200
+ contract_identifier,
1201
+ contract_two,
1202
+ ASTRules :: PrecheckSize ,
1203
+ & mut analysis_db
1204
+ )
1205
+ . unwrap_err( ) ,
1189
1206
RuntimeErrorType :: MaxStackDepthReached . into( )
1190
1207
) ;
1191
1208
}
0 commit comments