@@ -31,8 +31,7 @@ use crate::chainstate::stacks::boot::test::{
3131 make_signer_key_signature,
3232} ;
3333use crate :: chainstate:: tests:: consensus:: {
34- clarity_versions_for_epoch, contract_call_consensus_test, contract_deploy_consensus_test,
35- ConsensusTest , ConsensusUtils , TestBlock , EPOCHS_TO_TEST , SK_1 ,
34+ contract_call_consensus_test, contract_deploy_consensus_test, ConsensusTest , TestBlock , SK_1 ,
3635} ;
3736use crate :: chainstate:: tests:: parse_tests;
3837use crate :: core:: test_util:: to_addr;
@@ -414,6 +413,8 @@ fn arithmetic_zero_n_log_n() {
414413)" ,
415414 function_name: "trigger" ,
416415 function_args: & [ ] ,
416+ deploy_epochs: & StacksEpochId :: since( StacksEpochId :: Epoch21 ) ,
417+ exclude_clarity_versions: & [ ClarityVersion :: Clarity1 ] ,
417418 ) ;
418419}
419420
@@ -752,64 +753,17 @@ fn pox_already_locked() {
752753/// Outcome: block accepted
753754#[ test]
754755fn block_time_not_available ( ) {
755- let contract_code = "
756- (define-read-only (trigger (height uint))
757- (ok (at-block (unwrap! (get-stacks-block-info? id-header-hash height) (err u100))
758- stacks-block-time
759- ))
760- )" ;
761-
762- let mut nonce = 0 ;
763- let mut contract_names = vec ! [ ] ;
764- let mut epoch_blocks = HashMap :: new ( ) ;
765- for & epoch in & StacksEpochId :: ALL [ 11 ..] {
766- let mut blocks = vec ! [ ] ;
767- // Get all Clarity versions supported in this epoch
768- let clarity_versions = clarity_versions_for_epoch ( epoch) ;
769- // For each clarity version, deploy a contract
770- for & each_clarity_ver in clarity_versions {
771- // Skip Clarity 1/2/3 — they can't compile this code (stacks-block-time doesn't exist)
772- if matches ! (
773- each_clarity_ver,
774- ClarityVersion :: Clarity1 | ClarityVersion :: Clarity2 | ClarityVersion :: Clarity3
775- ) {
776- continue ;
777- } ;
778- let epoch_name = format ! ( "Epoch{}" , epoch. to_string( ) . replace( '.' , "_" ) ) ;
779-
780- let version_tag = each_clarity_ver. to_string ( ) . replace ( ' ' , "" ) ;
781- let contract_name = format ! ( "no-block-time-{epoch_name}-{version_tag}" ) ;
782- // Create the deploy block
783- blocks. push ( TestBlock {
784- transactions : vec ! [ ConsensusUtils :: new_deploy_tx(
785- nonce,
786- & contract_name,
787- contract_code,
788- Some ( each_clarity_ver) ,
789- ) ] ,
790- } ) ;
791- nonce += 1 ;
792- contract_names. push ( contract_name) ;
793-
794- if EPOCHS_TO_TEST . contains ( & epoch) {
795- for contract_name in & contract_names {
796- blocks. push ( TestBlock {
797- transactions : vec ! [ ConsensusUtils :: new_call_tx(
798- nonce,
799- contract_name,
800- "trigger" ,
801- & [ ClarityValue :: UInt ( 1 ) ] ,
802- ) ] ,
803- } ) ;
804- nonce += 1 ;
805- }
806- }
807- }
808- if !blocks. is_empty ( ) {
809- epoch_blocks. insert ( epoch, blocks) ;
810- }
811- }
812-
813- let results = ConsensusTest :: new ( function_name ! ( ) , vec ! [ ] , epoch_blocks) . run ( ) ;
814- insta:: assert_ron_snapshot!( results) ;
756+ contract_call_consensus_test ! (
757+ contract_name: "no-block-time" ,
758+ contract_code: "
759+ (define-read-only (trigger (height uint))
760+ (ok (at-block (unwrap! (get-stacks-block-info? id-header-hash height) (err u100))
761+ stacks-block-time
762+ ))
763+ )" ,
764+ function_name: "trigger" ,
765+ function_args: & [ ClarityValue :: UInt ( 1 ) ] ,
766+ deploy_epochs: & StacksEpochId :: since( StacksEpochId :: Epoch33 ) ,
767+ exclude_clarity_versions: & [ ClarityVersion :: Clarity1 , ClarityVersion :: Clarity2 , ClarityVersion :: Clarity3 ] ,
768+ )
815769}
0 commit comments