From d15f1846e62ad8e2e91b0ecc5aa32782a0bf4506 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Fri, 17 Nov 2023 13:50:07 +0100 Subject: [PATCH] Remove print_debug flag --- packages/vm/benches/main.rs | 4 ---- packages/vm/examples/multi_threaded_cache.rs | 1 - packages/vm/src/cache.rs | 8 +------ packages/vm/src/instance.rs | 24 ++------------------ packages/vm/src/testing/instance.rs | 5 ---- 5 files changed, 3 insertions(+), 39 deletions(-) diff --git a/packages/vm/benches/main.rs b/packages/vm/benches/main.rs index 7bdd75ad51..f171c7bec5 100644 --- a/packages/vm/benches/main.rs +++ b/packages/vm/benches/main.rs @@ -20,7 +20,6 @@ const DEFAULT_MEMORY_LIMIT: Size = Size::mebi(64); const DEFAULT_GAS_LIMIT: u64 = 1_000_000_000; // ~1ms const DEFAULT_INSTANCE_OPTIONS: InstanceOptions = InstanceOptions { gas_limit: DEFAULT_GAS_LIMIT, - print_debug: false, }; const HIGH_GAS_LIMIT: u64 = 20_000_000_000_000; // ~20s, allows many calls on one instance @@ -50,7 +49,6 @@ fn bench_instance(c: &mut Criterion) { let backend = mock_backend(&[]); let much_gas: InstanceOptions = InstanceOptions { gas_limit: HIGH_GAS_LIMIT, - ..DEFAULT_INSTANCE_OPTIONS }; let mut instance = Instance::from_code(CONTRACT, backend, much_gas, Some(DEFAULT_MEMORY_LIMIT)).unwrap(); @@ -68,7 +66,6 @@ fn bench_instance(c: &mut Criterion) { let backend = mock_backend(&[]); let much_gas: InstanceOptions = InstanceOptions { gas_limit: HIGH_GAS_LIMIT, - ..DEFAULT_INSTANCE_OPTIONS }; let mut instance = Instance::from_code(CONTRACT, backend, much_gas, Some(DEFAULT_MEMORY_LIMIT)).unwrap(); @@ -92,7 +89,6 @@ fn bench_instance(c: &mut Criterion) { let backend = mock_backend(&[]); let much_gas: InstanceOptions = InstanceOptions { gas_limit: HIGH_GAS_LIMIT, - ..DEFAULT_INSTANCE_OPTIONS }; let mut instance = Instance::from_code(CYBERPUNK, backend, much_gas, Some(DEFAULT_MEMORY_LIMIT)).unwrap(); diff --git a/packages/vm/examples/multi_threaded_cache.rs b/packages/vm/examples/multi_threaded_cache.rs index 1cc5b98131..f0926d489d 100644 --- a/packages/vm/examples/multi_threaded_cache.rs +++ b/packages/vm/examples/multi_threaded_cache.rs @@ -14,7 +14,6 @@ const DEFAULT_MEMORY_LIMIT: Size = Size::mebi(64); const DEFAULT_GAS_LIMIT: u64 = 400_000 * 150; const DEFAULT_INSTANCE_OPTIONS: InstanceOptions = InstanceOptions { gas_limit: DEFAULT_GAS_LIMIT, - print_debug: false, }; // Cache const MEMORY_CACHE_SIZE: Size = Size::mebi(200); diff --git a/packages/vm/src/cache.rs b/packages/vm/src/cache.rs index b4d1d9ea8e..b764ab6acb 100644 --- a/packages/vm/src/cache.rs +++ b/packages/vm/src/cache.rs @@ -357,7 +357,6 @@ where &cached.module, backend, options.gas_limit, - options.print_debug, None, Some(&self.instantiation_lock), )?; @@ -532,7 +531,6 @@ mod tests { const TESTING_MEMORY_LIMIT: Size = Size::mebi(16); const TESTING_OPTIONS: InstanceOptions = InstanceOptions { gas_limit: TESTING_GAS_LIMIT, - print_debug: false, }; const TESTING_MEMORY_CACHE_SIZE: Size = Size::mebi(200); @@ -1180,10 +1178,7 @@ mod tests { let backend2 = mock_backend(&[]); // Init from module cache - let options = InstanceOptions { - gas_limit: 10, - print_debug: false, - }; + let options = InstanceOptions { gas_limit: 10 }; let mut instance1 = cache.get_instance(&checksum, backend1, options).unwrap(); assert_eq!(cache.stats().hits_fs_cache, 1); assert_eq!(cache.stats().misses, 0); @@ -1202,7 +1197,6 @@ mod tests { // Init from memory cache let options = InstanceOptions { gas_limit: TESTING_GAS_LIMIT, - print_debug: false, }; let mut instance2 = cache.get_instance(&checksum, backend2, options).unwrap(); assert_eq!(cache.stats().hits_pinned_memory_cache, 0); diff --git a/packages/vm/src/instance.rs b/packages/vm/src/instance.rs index 9939541a27..617d2aa4a1 100644 --- a/packages/vm/src/instance.rs +++ b/packages/vm/src/instance.rs @@ -43,7 +43,6 @@ pub struct GasReport { pub struct InstanceOptions { /// Gas limit measured in [CosmWasm gas](https://github.com/CosmWasm/cosmwasm/blob/main/docs/GAS.md). pub gas_limit: u64, - pub print_debug: bool, } pub struct Instance { @@ -74,15 +73,7 @@ where let engine = make_compiling_engine(memory_limit); let module = compile(&engine, code)?; let store = Store::new(engine); - Instance::from_module( - store, - &module, - backend, - options.gas_limit, - options.print_debug, - None, - None, - ) + Instance::from_module(store, &module, backend, options.gas_limit, None, None) } #[allow(clippy::too_many_arguments)] @@ -91,7 +82,6 @@ where module: &Module, backend: Backend, gas_limit: u64, - print_debug: bool, extra_imports: Option>, instantiation_lock: Option<&Mutex<()>>, ) -> VmResult { @@ -470,7 +460,6 @@ pub fn instance_from_module( module: &Module, backend: Backend, gas_limit: u64, - print_debug: bool, extra_imports: Option>, ) -> VmResult> where @@ -478,15 +467,7 @@ where S: Storage + 'static, // 'static is needed here to allow using this in an Environment that is cloned into closures Q: Querier + 'static, { - Instance::from_module( - store, - module, - backend, - gas_limit, - print_debug, - extra_imports, - None, - ) + Instance::from_module(store, module, backend, gas_limit, extra_imports, None) } #[cfg(test)] @@ -645,7 +626,6 @@ mod tests { &module, backend, instance_options.gas_limit, - false, Some(extra_imports), None, ) diff --git a/packages/vm/src/testing/instance.rs b/packages/vm/src/testing/instance.rs index bf5c200a95..c89e4e237f 100644 --- a/packages/vm/src/testing/instance.rs +++ b/packages/vm/src/testing/instance.rs @@ -19,7 +19,6 @@ use super::storage::MockStorage; /// higher than the limit for a single execution that we have in the production setup. const DEFAULT_GAS_LIMIT: u64 = 500_000_000; // ~0.5ms const DEFAULT_MEMORY_LIMIT: Option = Some(Size::mebi(16)); -const DEFAULT_PRINT_DEBUG: bool = true; pub fn mock_instance( wasm: &[u8], @@ -90,7 +89,6 @@ pub struct MockInstanceOptions<'a> { pub available_capabilities: HashSet, /// Gas limit measured in [CosmWasm gas](https://github.com/CosmWasm/cosmwasm/blob/main/docs/GAS.md). pub gas_limit: u64, - pub print_debug: bool, /// Memory limit in bytes. Use a value that is divisible by the Wasm page size 65536, e.g. full MiBs. pub memory_limit: Option, } @@ -118,7 +116,6 @@ impl Default for MockInstanceOptions<'_> { // instance available_capabilities: Self::default_capabilities(), gas_limit: DEFAULT_GAS_LIMIT, - print_debug: DEFAULT_PRINT_DEBUG, memory_limit: DEFAULT_MEMORY_LIMIT, } } @@ -155,7 +152,6 @@ pub fn mock_instance_with_options( let memory_limit = options.memory_limit; let options = InstanceOptions { gas_limit: options.gas_limit, - print_debug: options.print_debug, }; Instance::from_code(wasm, backend, options, memory_limit).unwrap() } @@ -165,7 +161,6 @@ pub fn mock_instance_options() -> (InstanceOptions, Option) { ( InstanceOptions { gas_limit: DEFAULT_GAS_LIMIT, - print_debug: DEFAULT_PRINT_DEBUG, }, DEFAULT_MEMORY_LIMIT, )