mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 01:07:57 +00:00
Restore wasmtime's default stack size limit to 1MB (#11993)
* Restore `wasmtime`'s default stack size limit to 1MB * Add extra comments * Enforce different maximum call depth in release mode * Split the call depth limit in two
This commit is contained in:
@@ -324,13 +324,19 @@ fn common_config(semantics: &Semantics) -> std::result::Result<wasmtime::Config,
|
||||
.profiler(profiler)
|
||||
.map_err(|e| WasmError::Instantiation(format!("fail to set profiler: {:#}", e)))?;
|
||||
|
||||
if let Some(DeterministicStackLimit { native_stack_max, .. }) =
|
||||
semantics.deterministic_stack_limit
|
||||
{
|
||||
config
|
||||
.max_wasm_stack(native_stack_max as usize)
|
||||
.map_err(|e| WasmError::Other(format!("cannot set max wasm stack: {:#}", e)))?;
|
||||
}
|
||||
let native_stack_max = match semantics.deterministic_stack_limit {
|
||||
Some(DeterministicStackLimit { native_stack_max, .. }) => native_stack_max,
|
||||
|
||||
// In `wasmtime` 0.35 the default stack size limit was changed from 1MB to 512KB.
|
||||
//
|
||||
// This broke at least one parachain which depended on the original 1MB limit,
|
||||
// so here we restore it to what it was originally.
|
||||
None => 1024 * 1024,
|
||||
};
|
||||
|
||||
config
|
||||
.max_wasm_stack(native_stack_max as usize)
|
||||
.map_err(|e| WasmError::Other(format!("cannot set max wasm stack: {:#}", e)))?;
|
||||
|
||||
config.parallel_compilation(semantics.parallel_compilation);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user