Skip to content

Commit 9257a8e

Browse files
committed
Remove print_debug flag
1 parent e09ae4a commit 9257a8e

File tree

5 files changed

+3
-39
lines changed

5 files changed

+3
-39
lines changed

packages/vm/benches/main.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const DEFAULT_MEMORY_LIMIT: Size = Size::mebi(64);
2020
const DEFAULT_GAS_LIMIT: u64 = 1_000_000_000; // ~1ms
2121
const DEFAULT_INSTANCE_OPTIONS: InstanceOptions = InstanceOptions {
2222
gas_limit: DEFAULT_GAS_LIMIT,
23-
print_debug: false,
2423
};
2524
const HIGH_GAS_LIMIT: u64 = 20_000_000_000_000; // ~20s, allows many calls on one instance
2625

@@ -50,7 +49,6 @@ fn bench_instance(c: &mut Criterion) {
5049
let backend = mock_backend(&[]);
5150
let much_gas: InstanceOptions = InstanceOptions {
5251
gas_limit: HIGH_GAS_LIMIT,
53-
..DEFAULT_INSTANCE_OPTIONS
5452
};
5553
let mut instance =
5654
Instance::from_code(CONTRACT, backend, much_gas, Some(DEFAULT_MEMORY_LIMIT)).unwrap();
@@ -68,7 +66,6 @@ fn bench_instance(c: &mut Criterion) {
6866
let backend = mock_backend(&[]);
6967
let much_gas: InstanceOptions = InstanceOptions {
7068
gas_limit: HIGH_GAS_LIMIT,
71-
..DEFAULT_INSTANCE_OPTIONS
7269
};
7370
let mut instance =
7471
Instance::from_code(CONTRACT, backend, much_gas, Some(DEFAULT_MEMORY_LIMIT)).unwrap();
@@ -92,7 +89,6 @@ fn bench_instance(c: &mut Criterion) {
9289
let backend = mock_backend(&[]);
9390
let much_gas: InstanceOptions = InstanceOptions {
9491
gas_limit: HIGH_GAS_LIMIT,
95-
..DEFAULT_INSTANCE_OPTIONS
9692
};
9793
let mut instance =
9894
Instance::from_code(CYBERPUNK, backend, much_gas, Some(DEFAULT_MEMORY_LIMIT)).unwrap();

packages/vm/examples/multi_threaded_cache.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const DEFAULT_MEMORY_LIMIT: Size = Size::mebi(64);
1414
const DEFAULT_GAS_LIMIT: u64 = 400_000 * 150;
1515
const DEFAULT_INSTANCE_OPTIONS: InstanceOptions = InstanceOptions {
1616
gas_limit: DEFAULT_GAS_LIMIT,
17-
print_debug: false,
1817
};
1918
// Cache
2019
const MEMORY_CACHE_SIZE: Size = Size::mebi(200);

packages/vm/src/cache.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ where
357357
&cached.module,
358358
backend,
359359
options.gas_limit,
360-
options.print_debug,
361360
None,
362361
Some(&self.instantiation_lock),
363362
)?;
@@ -532,7 +531,6 @@ mod tests {
532531
const TESTING_MEMORY_LIMIT: Size = Size::mebi(16);
533532
const TESTING_OPTIONS: InstanceOptions = InstanceOptions {
534533
gas_limit: TESTING_GAS_LIMIT,
535-
print_debug: false,
536534
};
537535
const TESTING_MEMORY_CACHE_SIZE: Size = Size::mebi(200);
538536

@@ -1180,10 +1178,7 @@ mod tests {
11801178
let backend2 = mock_backend(&[]);
11811179

11821180
// Init from module cache
1183-
let options = InstanceOptions {
1184-
gas_limit: 10,
1185-
print_debug: false,
1186-
};
1181+
let options = InstanceOptions { gas_limit: 10 };
11871182
let mut instance1 = cache.get_instance(&checksum, backend1, options).unwrap();
11881183
assert_eq!(cache.stats().hits_fs_cache, 1);
11891184
assert_eq!(cache.stats().misses, 0);
@@ -1202,7 +1197,6 @@ mod tests {
12021197
// Init from memory cache
12031198
let options = InstanceOptions {
12041199
gas_limit: TESTING_GAS_LIMIT,
1205-
print_debug: false,
12061200
};
12071201
let mut instance2 = cache.get_instance(&checksum, backend2, options).unwrap();
12081202
assert_eq!(cache.stats().hits_pinned_memory_cache, 0);

packages/vm/src/instance.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ pub struct GasReport {
4343
pub struct InstanceOptions {
4444
/// Gas limit measured in [CosmWasm gas](https://github.com/CosmWasm/cosmwasm/blob/main/docs/GAS.md).
4545
pub gas_limit: u64,
46-
pub print_debug: bool,
4746
}
4847

4948
pub struct Instance<A: BackendApi, S: Storage, Q: Querier> {
@@ -74,15 +73,7 @@ where
7473
let engine = make_compiling_engine(memory_limit);
7574
let module = compile(&engine, code)?;
7675
let store = Store::new(engine);
77-
Instance::from_module(
78-
store,
79-
&module,
80-
backend,
81-
options.gas_limit,
82-
options.print_debug,
83-
None,
84-
None,
85-
)
76+
Instance::from_module(store, &module, backend, options.gas_limit, None, None)
8677
}
8778

8879
#[allow(clippy::too_many_arguments)]
@@ -91,7 +82,6 @@ where
9182
module: &Module,
9283
backend: Backend<A, S, Q>,
9384
gas_limit: u64,
94-
print_debug: bool,
9585
extra_imports: Option<HashMap<&str, Exports>>,
9686
instantiation_lock: Option<&Mutex<()>>,
9787
) -> VmResult<Self> {
@@ -470,23 +460,14 @@ pub fn instance_from_module<A, S, Q>(
470460
module: &Module,
471461
backend: Backend<A, S, Q>,
472462
gas_limit: u64,
473-
print_debug: bool,
474463
extra_imports: Option<HashMap<&str, Exports>>,
475464
) -> VmResult<Instance<A, S, Q>>
476465
where
477466
A: BackendApi + 'static, // 'static is needed here to allow copying API instances into closures
478467
S: Storage + 'static, // 'static is needed here to allow using this in an Environment that is cloned into closures
479468
Q: Querier + 'static,
480469
{
481-
Instance::from_module(
482-
store,
483-
module,
484-
backend,
485-
gas_limit,
486-
print_debug,
487-
extra_imports,
488-
None,
489-
)
470+
Instance::from_module(store, module, backend, gas_limit, extra_imports, None)
490471
}
491472

492473
#[cfg(test)]
@@ -645,7 +626,6 @@ mod tests {
645626
&module,
646627
backend,
647628
instance_options.gas_limit,
648-
false,
649629
Some(extra_imports),
650630
None,
651631
)

packages/vm/src/testing/instance.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use super::storage::MockStorage;
1919
/// higher than the limit for a single execution that we have in the production setup.
2020
const DEFAULT_GAS_LIMIT: u64 = 500_000_000; // ~0.5ms
2121
const DEFAULT_MEMORY_LIMIT: Option<Size> = Some(Size::mebi(16));
22-
const DEFAULT_PRINT_DEBUG: bool = true;
2322

2423
pub fn mock_instance(
2524
wasm: &[u8],
@@ -90,7 +89,6 @@ pub struct MockInstanceOptions<'a> {
9089
pub available_capabilities: HashSet<String>,
9190
/// Gas limit measured in [CosmWasm gas](https://github.com/CosmWasm/cosmwasm/blob/main/docs/GAS.md).
9291
pub gas_limit: u64,
93-
pub print_debug: bool,
9492
/// Memory limit in bytes. Use a value that is divisible by the Wasm page size 65536, e.g. full MiBs.
9593
pub memory_limit: Option<Size>,
9694
}
@@ -118,7 +116,6 @@ impl Default for MockInstanceOptions<'_> {
118116
// instance
119117
available_capabilities: Self::default_capabilities(),
120118
gas_limit: DEFAULT_GAS_LIMIT,
121-
print_debug: DEFAULT_PRINT_DEBUG,
122119
memory_limit: DEFAULT_MEMORY_LIMIT,
123120
}
124121
}
@@ -155,7 +152,6 @@ pub fn mock_instance_with_options(
155152
let memory_limit = options.memory_limit;
156153
let options = InstanceOptions {
157154
gas_limit: options.gas_limit,
158-
print_debug: options.print_debug,
159155
};
160156
Instance::from_code(wasm, backend, options, memory_limit).unwrap()
161157
}
@@ -165,7 +161,6 @@ pub fn mock_instance_options() -> (InstanceOptions, Option<Size>) {
165161
(
166162
InstanceOptions {
167163
gas_limit: DEFAULT_GAS_LIMIT,
168-
print_debug: DEFAULT_PRINT_DEBUG,
169164
},
170165
DEFAULT_MEMORY_LIMIT,
171166
)

0 commit comments

Comments
 (0)