@@ -626,10 +626,10 @@ mod tests {
626626 } ;
627627 const TESTING_MEMORY_CACHE_SIZE : Size = Size :: mebi ( 200 ) ;
628628
629- static CONTRACT : & [ u8 ] = include_bytes ! ( "../testdata/hackatom.wasm" ) ;
630- static IBC_CONTRACT : & [ u8 ] = include_bytes ! ( "../testdata/ibc_reflect.wasm" ) ;
631- static IBC2_CONTRACT : & [ u8 ] = include_bytes ! ( "../testdata/ibc2.wasm" ) ;
632- static EMPTY_CONTRACT : & [ u8 ] = include_bytes ! ( "../testdata/empty.wasm" ) ;
629+ static HACKATOM : & [ u8 ] = include_bytes ! ( "../testdata/hackatom.wasm" ) ;
630+ static IBC_REFLECT : & [ u8 ] = include_bytes ! ( "../testdata/ibc_reflect.wasm" ) ;
631+ static IBC2 : & [ u8 ] = include_bytes ! ( "../testdata/ibc2.wasm" ) ;
632+ static EMPTY : & [ u8 ] = include_bytes ! ( "../testdata/empty.wasm" ) ;
633633 // Invalid because it doesn't contain required memory and exports
634634 static INVALID_CONTRACT_WAT : & str = r#"(module
635635 (type $t0 (func (param i32) (result i32)))
@@ -719,14 +719,14 @@ mod tests {
719719 fn store_code_checked_works ( ) {
720720 let cache: Cache < MockApi , MockStorage , MockQuerier > =
721721 unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
722- cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
722+ cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
723723 }
724724
725725 #[ test]
726726 fn store_code_without_persist_works ( ) {
727727 let cache: Cache < MockApi , MockStorage , MockQuerier > =
728728 unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
729- let checksum = cache. store_code ( CONTRACT , true , false ) . unwrap ( ) ;
729+ let checksum = cache. store_code ( HACKATOM , true , false ) . unwrap ( ) ;
730730
731731 assert ! (
732732 cache. load_wasm( & checksum) . is_err( ) ,
@@ -739,8 +739,8 @@ mod tests {
739739 fn store_code_allows_saving_multiple_times ( ) {
740740 let cache: Cache < MockApi , MockStorage , MockQuerier > =
741741 unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
742- cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
743- cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
742+ cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
743+ cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
744744 }
745745
746746 #[ test]
@@ -764,7 +764,7 @@ mod tests {
764764 // memory cache before the init call.
765765
766766 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
767- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
767+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
768768
769769 let backend = mock_backend ( & [ ] ) ;
770770 let _ = cache
@@ -780,7 +780,7 @@ mod tests {
780780 fn store_code_unchecked_works ( ) {
781781 let cache: Cache < MockApi , MockStorage , MockQuerier > =
782782 unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
783- cache. store_code ( CONTRACT , false , true ) . unwrap ( ) ;
783+ cache. store_code ( HACKATOM , false , true ) . unwrap ( ) ;
784784 }
785785
786786 #[ test]
@@ -796,10 +796,10 @@ mod tests {
796796 fn load_wasm_works ( ) {
797797 let cache: Cache < MockApi , MockStorage , MockQuerier > =
798798 unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
799- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
799+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
800800
801801 let restored = cache. load_wasm ( & checksum) . unwrap ( ) ;
802- assert_eq ! ( restored, CONTRACT ) ;
802+ assert_eq ! ( restored, HACKATOM ) ;
803803 }
804804
805805 #[ test]
@@ -816,7 +816,7 @@ mod tests {
816816 } ;
817817 let cache1: Cache < MockApi , MockStorage , MockQuerier > =
818818 unsafe { Cache :: new ( options1) . unwrap ( ) } ;
819- id = cache1. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
819+ id = cache1. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
820820 }
821821
822822 {
@@ -829,7 +829,7 @@ mod tests {
829829 let cache2: Cache < MockApi , MockStorage , MockQuerier > =
830830 unsafe { Cache :: new ( options2) . unwrap ( ) } ;
831831 let restored = cache2. load_wasm ( & id) . unwrap ( ) ;
832- assert_eq ! ( restored, CONTRACT ) ;
832+ assert_eq ! ( restored, HACKATOM ) ;
833833 }
834834 }
835835
@@ -861,7 +861,7 @@ mod tests {
861861 } ;
862862 let cache: Cache < MockApi , MockStorage , MockQuerier > =
863863 unsafe { Cache :: new ( options) . unwrap ( ) } ;
864- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
864+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
865865
866866 // Corrupt cache file
867867 let filepath = tmp_dir
@@ -887,7 +887,7 @@ mod tests {
887887 unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
888888
889889 // Store
890- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
890+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
891891
892892 // Exists
893893 cache. load_wasm ( & checksum) . unwrap ( ) ;
@@ -915,7 +915,7 @@ mod tests {
915915 #[ test]
916916 fn get_instance_finds_cached_module ( ) {
917917 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
918- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
918+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
919919 let backend = mock_backend ( & [ ] ) ;
920920 let _instance = cache
921921 . get_instance ( & checksum, backend, TESTING_OPTIONS )
@@ -929,7 +929,7 @@ mod tests {
929929 #[ test]
930930 fn get_instance_finds_cached_modules_and_stores_to_memory ( ) {
931931 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
932- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
932+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
933933 let backend1 = mock_backend ( & [ ] ) ;
934934 let backend2 = mock_backend ( & [ ] ) ;
935935 let backend3 = mock_backend ( & [ ] ) ;
@@ -993,7 +993,7 @@ mod tests {
993993 fn get_instance_recompiles_module ( ) {
994994 let options = make_testing_options ( ) ;
995995 let cache = unsafe { Cache :: new ( options. clone ( ) ) . unwrap ( ) } ;
996- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
996+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
997997
998998 // Remove compiled module from disk
999999 remove_dir_all ( options. base_dir . join ( CACHE_DIR ) . join ( MODULES_DIR ) ) . unwrap ( ) ;
@@ -1022,7 +1022,7 @@ mod tests {
10221022 #[ test]
10231023 fn call_instantiate_on_cached_contract ( ) {
10241024 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
1025- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1025+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
10261026
10271027 // from file system
10281028 {
@@ -1108,7 +1108,7 @@ mod tests {
11081108 #[ test]
11091109 fn call_execute_on_cached_contract ( ) {
11101110 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
1111- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1111+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
11121112
11131113 // from file system
11141114 {
@@ -1219,7 +1219,7 @@ mod tests {
12191219 fn call_execute_on_recompiled_contract ( ) {
12201220 let options = make_testing_options ( ) ;
12211221 let cache = unsafe { Cache :: new ( options. clone ( ) ) . unwrap ( ) } ;
1222- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1222+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
12231223
12241224 // Remove compiled module from disk
12251225 remove_dir_all ( options. base_dir . join ( CACHE_DIR ) . join ( MODULES_DIR ) ) . unwrap ( ) ;
@@ -1239,7 +1239,7 @@ mod tests {
12391239 #[ test]
12401240 fn use_multiple_cached_instances_of_same_contract ( ) {
12411241 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
1242- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1242+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
12431243
12441244 // these differentiate the two instances of the same contract
12451245 let backend1 = mock_backend ( & [ ] ) ;
@@ -1299,7 +1299,7 @@ mod tests {
12991299 #[ test]
13001300 fn resets_gas_when_reusing_instance ( ) {
13011301 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
1302- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1302+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
13031303
13041304 let backend1 = mock_backend ( & [ ] ) ;
13051305 let backend2 = mock_backend ( & [ ] ) ;
@@ -1338,7 +1338,7 @@ mod tests {
13381338 #[ test]
13391339 fn recovers_from_out_of_gas ( ) {
13401340 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
1341- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1341+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
13421342
13431343 let backend1 = mock_backend ( & [ ] ) ;
13441344 let backend2 = mock_backend ( & [ ] ) ;
@@ -1454,7 +1454,7 @@ mod tests {
14541454 let cache: Cache < MockApi , MockStorage , MockQuerier > =
14551455 unsafe { Cache :: new ( make_stargate_testing_options ( ) ) . unwrap ( ) } ;
14561456
1457- let checksum1 = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1457+ let checksum1 = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
14581458 let report1 = cache. analyze ( & checksum1) . unwrap ( ) ;
14591459 assert_eq ! (
14601460 report1,
@@ -1473,7 +1473,7 @@ mod tests {
14731473 }
14741474 ) ;
14751475
1476- let checksum2 = cache. store_code ( IBC_CONTRACT , true , true ) . unwrap ( ) ;
1476+ let checksum2 = cache. store_code ( IBC_REFLECT , true , true ) . unwrap ( ) ;
14771477 let report2 = cache. analyze ( & checksum2) . unwrap ( ) ;
14781478 let mut ibc_contract_entrypoints =
14791479 BTreeSet :: from ( [ E :: Instantiate , E :: Migrate , E :: Reply , E :: Query ] ) ;
@@ -1492,7 +1492,7 @@ mod tests {
14921492 }
14931493 ) ;
14941494
1495- let checksum3 = cache. store_code ( EMPTY_CONTRACT , true , true ) . unwrap ( ) ;
1495+ let checksum3 = cache. store_code ( EMPTY , true , true ) . unwrap ( ) ;
14961496 let report3 = cache. analyze ( & checksum3) . unwrap ( ) ;
14971497 assert_eq ! (
14981498 report3,
@@ -1505,7 +1505,7 @@ mod tests {
15051505 }
15061506 ) ;
15071507
1508- let mut wasm_with_version = EMPTY_CONTRACT . to_vec ( ) ;
1508+ let mut wasm_with_version = EMPTY . to_vec ( ) ;
15091509 let custom_section = wasm_encoder:: CustomSection {
15101510 name : Cow :: Borrowed ( "cw_migrate_version" ) ,
15111511 data : Cow :: Borrowed ( b"21" ) ,
@@ -1527,7 +1527,7 @@ mod tests {
15271527
15281528 let cache: Cache < MockApi , MockStorage , MockQuerier > =
15291529 unsafe { Cache :: new ( make_ibc2_testing_options ( ) ) . unwrap ( ) } ;
1530- let checksum5 = cache. store_code ( IBC2_CONTRACT , true , true ) . unwrap ( ) ;
1530+ let checksum5 = cache. store_code ( IBC2 , true , true ) . unwrap ( ) ;
15311531 let report5 = cache. analyze ( & checksum5) . unwrap ( ) ;
15321532 let mut ibc2_contract_entrypoints = BTreeSet :: from ( [ E :: Instantiate , E :: Query ] ) ;
15331533 ibc2_contract_entrypoints. extend ( [ REQUIRED_IBC2_EXPORT ] ) ;
@@ -1549,7 +1549,7 @@ mod tests {
15491549 #[ test]
15501550 fn pinned_metrics_works ( ) {
15511551 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
1552- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1552+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
15531553
15541554 cache. pin ( & checksum) . unwrap ( ) ;
15551555
@@ -1568,7 +1568,7 @@ mod tests {
15681568 assert_eq ! ( pinned_metrics. per_module[ 0 ] . 0 , checksum) ;
15691569 assert_eq ! ( pinned_metrics. per_module[ 0 ] . 1 . hits, 1 ) ;
15701570
1571- let empty_checksum = cache. store_code ( EMPTY_CONTRACT , true , true ) . unwrap ( ) ;
1571+ let empty_checksum = cache. store_code ( EMPTY , true , true ) . unwrap ( ) ;
15721572 cache. pin ( & empty_checksum) . unwrap ( ) ;
15731573
15741574 let pinned_metrics = cache. pinned_metrics ( ) ;
@@ -1591,7 +1591,7 @@ mod tests {
15911591 #[ test]
15921592 fn pin_unpin_works ( ) {
15931593 let cache = unsafe { Cache :: new ( make_testing_options ( ) ) . unwrap ( ) } ;
1594- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1594+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
15951595
15961596 // check not pinned
15971597 let backend = mock_backend ( & [ ] ) ;
@@ -1656,7 +1656,7 @@ mod tests {
16561656 let options = make_testing_options ( ) ;
16571657 let cache: Cache < MockApi , MockStorage , MockQuerier > =
16581658 unsafe { Cache :: new ( options. clone ( ) ) . unwrap ( ) } ;
1659- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1659+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
16601660
16611661 // Remove compiled module from disk
16621662 remove_dir_all ( options. base_dir . join ( CACHE_DIR ) . join ( MODULES_DIR ) ) . unwrap ( ) ;
@@ -1691,7 +1691,7 @@ mod tests {
16911691 } ;
16921692 let cache: Cache < MockApi , MockStorage , MockQuerier > =
16931693 unsafe { Cache :: new ( options) . unwrap ( ) } ;
1694- let checksum = cache. store_code ( CONTRACT , true , true ) . unwrap ( ) ;
1694+ let checksum = cache. store_code ( HACKATOM , true , true ) . unwrap ( ) ;
16951695
16961696 // Move the saved wasm to the old path (without extension)
16971697 let old_path = tmp_dir
@@ -1704,7 +1704,7 @@ mod tests {
17041704
17051705 // loading wasm from before the wasm extension was added should still work
17061706 let restored = cache. load_wasm ( & checksum) . unwrap ( ) ;
1707- assert_eq ! ( restored, CONTRACT ) ;
1707+ assert_eq ! ( restored, HACKATOM ) ;
17081708 }
17091709
17101710 #[ test]
@@ -1726,7 +1726,7 @@ mod tests {
17261726
17271727 let cache: Cache < MockApi , MockStorage , MockQuerier > =
17281728 unsafe { Cache :: new_with_config ( config) . unwrap ( ) } ;
1729- let err = cache. store_code ( CONTRACT , true , true ) . unwrap_err ( ) ;
1729+ let err = cache. store_code ( HACKATOM , true , true ) . unwrap_err ( ) ;
17301730 assert ! ( matches!( err, VmError :: StaticValidationErr { .. } ) ) ;
17311731 }
17321732}
0 commit comments