@@ -31,7 +31,7 @@ const INSTANTIATION_THREADS: usize = 128;
31
31
const CONTRACTS : u64 = 10 ;
32
32
33
33
const DEFAULT_CAPABILITIES : & str = "cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,iterator,staking" ;
34
- static CONTRACT : & [ u8 ] = include_bytes ! ( "../testdata/hackatom.wasm" ) ;
34
+ static HACKATOM : & [ u8 ] = include_bytes ! ( "../testdata/hackatom.wasm" ) ;
35
35
static CYBERPUNK : & [ u8 ] = include_bytes ! ( "../testdata/cyberpunk.wasm" ) ;
36
36
37
37
fn bench_instance ( c : & mut Criterion ) {
@@ -42,7 +42,7 @@ fn bench_instance(c: &mut Criterion) {
42
42
let backend = mock_backend ( & [ ] ) ;
43
43
let ( instance_options, memory_limit) = mock_instance_options ( ) ;
44
44
let _instance =
45
- Instance :: from_code ( CONTRACT , backend, instance_options, memory_limit) . unwrap ( ) ;
45
+ Instance :: from_code ( HACKATOM , backend, instance_options, memory_limit) . unwrap ( ) ;
46
46
} ) ;
47
47
} ) ;
48
48
@@ -52,7 +52,7 @@ fn bench_instance(c: &mut Criterion) {
52
52
gas_limit : HIGH_GAS_LIMIT ,
53
53
} ;
54
54
let mut instance =
55
- Instance :: from_code ( CONTRACT , backend, much_gas, Some ( DEFAULT_MEMORY_LIMIT ) ) . unwrap ( ) ;
55
+ Instance :: from_code ( HACKATOM , backend, much_gas, Some ( DEFAULT_MEMORY_LIMIT ) ) . unwrap ( ) ;
56
56
57
57
b. iter ( || {
58
58
let info = mock_info ( & instance. api ( ) . addr_make ( "creator" ) , & coins ( 1000 , "earth" ) ) ;
@@ -76,7 +76,7 @@ fn bench_instance(c: &mut Criterion) {
76
76
gas_limit : HIGH_GAS_LIMIT ,
77
77
} ;
78
78
let mut instance =
79
- Instance :: from_code ( CONTRACT , backend, much_gas, Some ( DEFAULT_MEMORY_LIMIT ) ) . unwrap ( ) ;
79
+ Instance :: from_code ( HACKATOM , backend, much_gas, Some ( DEFAULT_MEMORY_LIMIT ) ) . unwrap ( ) ;
80
80
81
81
let info = mock_info ( & instance. api ( ) . addr_make ( "creator" ) , & coins ( 1000 , "earth" ) ) ;
82
82
let verifier = instance. api ( ) . addr_make ( "verifies" ) ;
@@ -140,15 +140,15 @@ fn bench_cache(c: &mut Criterion) {
140
140
unsafe { Cache :: new ( options. clone ( ) ) . unwrap ( ) } ;
141
141
142
142
b. iter ( || {
143
- let result = cache. save_wasm ( CONTRACT ) ;
143
+ let result = cache. save_wasm ( HACKATOM ) ;
144
144
assert ! ( result. is_ok( ) ) ;
145
145
} ) ;
146
146
} ) ;
147
147
148
148
group. bench_function ( "load wasm" , |b| {
149
149
let cache: Cache < MockApi , MockStorage , MockQuerier > =
150
150
unsafe { Cache :: new ( options. clone ( ) ) . unwrap ( ) } ;
151
- let checksum = cache. save_wasm ( CONTRACT ) . unwrap ( ) ;
151
+ let checksum = cache. save_wasm ( HACKATOM ) . unwrap ( ) ;
152
152
153
153
b. iter ( || {
154
154
let result = cache. load_wasm ( & checksum) ;
@@ -161,7 +161,7 @@ fn bench_cache(c: &mut Criterion) {
161
161
let mut cache: Cache < MockApi , MockStorage , MockQuerier > =
162
162
unsafe { Cache :: new ( options) . unwrap ( ) } ;
163
163
cache. set_module_unchecked ( true ) ;
164
- let checksum = cache. save_wasm ( CONTRACT ) . unwrap ( ) ;
164
+ let checksum = cache. save_wasm ( HACKATOM ) . unwrap ( ) ;
165
165
166
166
b. iter ( || {
167
167
let result = cache. load_wasm ( & checksum) ;
@@ -172,7 +172,7 @@ fn bench_cache(c: &mut Criterion) {
172
172
group. bench_function ( "analyze" , |b| {
173
173
let cache: Cache < MockApi , MockStorage , MockQuerier > =
174
174
unsafe { Cache :: new ( options. clone ( ) ) . unwrap ( ) } ;
175
- let checksum = cache. save_wasm ( CONTRACT ) . unwrap ( ) ;
175
+ let checksum = cache. save_wasm ( HACKATOM ) . unwrap ( ) ;
176
176
177
177
b. iter ( || {
178
178
let result = cache. analyze ( & checksum) ;
@@ -189,7 +189,7 @@ fn bench_cache(c: &mut Criterion) {
189
189
) ;
190
190
let cache: Cache < MockApi , MockStorage , MockQuerier > =
191
191
unsafe { Cache :: new ( non_memcache) . unwrap ( ) } ;
192
- let checksum = cache. save_wasm ( CONTRACT ) . unwrap ( ) ;
192
+ let checksum = cache. save_wasm ( HACKATOM ) . unwrap ( ) ;
193
193
194
194
b. iter ( || {
195
195
let _ = cache
@@ -212,7 +212,7 @@ fn bench_cache(c: &mut Criterion) {
212
212
let mut cache: Cache < MockApi , MockStorage , MockQuerier > =
213
213
unsafe { Cache :: new ( non_memcache) . unwrap ( ) } ;
214
214
cache. set_module_unchecked ( true ) ;
215
- let checksum = cache. save_wasm ( CONTRACT ) . unwrap ( ) ;
215
+ let checksum = cache. save_wasm ( HACKATOM ) . unwrap ( ) ;
216
216
217
217
b. iter ( || {
218
218
let _ = cache
@@ -226,7 +226,7 @@ fn bench_cache(c: &mut Criterion) {
226
226
} ) ;
227
227
228
228
group. bench_function ( "instantiate from memory" , |b| {
229
- let checksum = Checksum :: generate ( CONTRACT ) ;
229
+ let checksum = Checksum :: generate ( HACKATOM ) ;
230
230
let cache: Cache < MockApi , MockStorage , MockQuerier > =
231
231
unsafe { Cache :: new ( options. clone ( ) ) . unwrap ( ) } ;
232
232
// Load into memory
@@ -247,7 +247,7 @@ fn bench_cache(c: &mut Criterion) {
247
247
} ) ;
248
248
249
249
group. bench_function ( "instantiate from pinned memory" , |b| {
250
- let checksum = Checksum :: generate ( CONTRACT ) ;
250
+ let checksum = Checksum :: generate ( HACKATOM ) ;
251
251
let cache: Cache < MockApi , MockStorage , MockQuerier > =
252
252
unsafe { Cache :: new ( options. clone ( ) ) . unwrap ( ) } ;
253
253
// Load into pinned memory
@@ -291,10 +291,10 @@ fn bench_instance_threads(c: &mut Criterion) {
291
291
// Offset to the i32.const (0x41) 15731626 (0xf00baa) (unsigned leb128 encoded) instruction
292
292
// data we want to replace
293
293
let query_int_data = b"\x41 \xaa \x97 \xc0 \x07 " ;
294
- let offset = find_subsequence ( CONTRACT , query_int_data) . unwrap ( ) + 1 ;
294
+ let offset = find_subsequence ( HACKATOM , query_int_data) . unwrap ( ) + 1 ;
295
295
296
296
let mut leb128_buf = [ 0 ; 4 ] ;
297
- let mut contract = CONTRACT . to_vec ( ) ;
297
+ let mut contract = HACKATOM . to_vec ( ) ;
298
298
299
299
let mut random_checksum = || {
300
300
let mut writable = & mut leb128_buf[ ..] ;
0 commit comments