Skip to content

Commit f952c1a

Browse files
committed
replace deprecated method
1 parent 0102946 commit f952c1a

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

packages/vm/benches/main.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ fn bench_instance(c: &mut Criterion) {
139139
fn bench_cache(c: &mut Criterion) {
140140
let mut group = c.benchmark_group("Cache");
141141

142+
let temp_dir = TempDir::new().unwrap();
142143
let options = CacheOptions::new(
143-
TempDir::new().unwrap().into_path(),
144+
temp_dir.path().to_path_buf(),
144145
capabilities_from_csv(DEFAULT_CAPABILITIES),
145146
MEMORY_CACHE_SIZE,
146147
DEFAULT_MEMORY_LIMIT,
@@ -194,9 +195,10 @@ fn bench_cache(c: &mut Criterion) {
194195
});
195196
}
196197

198+
let temp_dir = TempDir::new().unwrap();
197199
group.bench_function("instantiate from fs", |b| {
198200
let non_memcache = CacheOptions::new(
199-
TempDir::new().unwrap().into_path(),
201+
temp_dir.path().to_path_buf(),
200202
capabilities_from_csv(DEFAULT_CAPABILITIES),
201203
Size::new(0),
202204
DEFAULT_MEMORY_LIMIT,
@@ -216,9 +218,10 @@ fn bench_cache(c: &mut Criterion) {
216218
});
217219
});
218220

221+
let temp_dir = TempDir::new().unwrap();
219222
group.bench_function("instantiate from fs unchecked", |b| {
220223
let non_memcache = CacheOptions::new(
221-
TempDir::new().unwrap().into_path(),
224+
temp_dir.path().to_path_buf(),
222225
capabilities_from_csv(DEFAULT_CAPABILITIES),
223226
Size::new(0),
224227
DEFAULT_MEMORY_LIMIT,
@@ -283,9 +286,10 @@ fn bench_cache(c: &mut Criterion) {
283286
}
284287

285288
fn bench_instance_threads(c: &mut Criterion) {
289+
let temp_dir = TempDir::new().unwrap();
286290
c.bench_function("multi-threaded get_instance", |b| {
287291
let options = CacheOptions::new(
288-
TempDir::new().unwrap().into_path(),
292+
temp_dir.path().to_path_buf(),
289293
capabilities_from_csv(DEFAULT_CAPABILITIES),
290294
MEMORY_CACHE_SIZE,
291295
DEFAULT_MEMORY_LIMIT,
@@ -370,8 +374,9 @@ fn bench_instance_threads(c: &mut Criterion) {
370374
fn bench_combined(c: &mut Criterion) {
371375
let mut group = c.benchmark_group("Combined");
372376

377+
let temp_dir = TempDir::new().unwrap();
373378
let options = CacheOptions::new(
374-
TempDir::new().unwrap().into_path(),
379+
temp_dir.path().to_path_buf(),
375380
capabilities_from_csv("cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,iterator,staking"),
376381
MEMORY_CACHE_SIZE,
377382
DEFAULT_MEMORY_LIMIT,

packages/vm/examples/heap_profiling.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ fn contracts() -> Vec<Contract> {
104104
fn app(runtime: u64) {
105105
let start_time = SystemTime::now();
106106

107+
let temp_dir = TempDir::new().unwrap();
107108
let options = CacheOptions::new(
108-
TempDir::new().unwrap().into_path(),
109+
temp_dir.path().to_path_buf(),
109110
capabilities_from_csv("iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0,cosmwasm_2_1"),
110111
MEMORY_CACHE_SIZE,
111112
DEFAULT_MEMORY_LIMIT,

packages/vm/examples/multi_threaded_cache.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ const INSTANTIATION_THREADS: usize = 2048;
2525
const THREADS: usize = STORE_CODE_THREADS + INSTANTIATION_THREADS;
2626

2727
pub fn main() {
28+
let temp_dir = TempDir::new().unwrap();
2829
let options = CacheOptions::new(
29-
TempDir::new().unwrap().into_path(),
30+
temp_dir.path().to_path_buf(),
3031
capabilities_from_csv("iterator,staking"),
3132
MEMORY_CACHE_SIZE,
3233
DEFAULT_MEMORY_LIMIT,

packages/vm/src/cache.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,9 @@ mod tests {
639639
}
640640

641641
fn make_testing_options() -> CacheOptions {
642+
let temp_dir = TempDir::new().unwrap();
642643
CacheOptions {
643-
base_dir: TempDir::new().unwrap().into_path(),
644+
base_dir: temp_dir.path().to_path_buf(),
644645
available_capabilities: default_capabilities(),
645646
memory_cache_size_bytes: TESTING_MEMORY_CACHE_SIZE,
646647
instance_memory_limit_bytes: TESTING_MEMORY_LIMIT,
@@ -650,8 +651,9 @@ mod tests {
650651
fn make_stargate_testing_options() -> CacheOptions {
651652
let mut capabilities = default_capabilities();
652653
capabilities.insert("stargate".into());
654+
let temp_dir = TempDir::new().unwrap();
653655
CacheOptions {
654-
base_dir: TempDir::new().unwrap().into_path(),
656+
base_dir: temp_dir.path().to_path_buf(),
655657
available_capabilities: capabilities,
656658
memory_cache_size_bytes: TESTING_MEMORY_CACHE_SIZE,
657659
instance_memory_limit_bytes: TESTING_MEMORY_LIMIT,

0 commit comments

Comments
 (0)