Skip to content

Reduce limits for various WASM compilation parameters #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target
Cargo.lock
rusty-tags.*
tags
30 changes: 15 additions & 15 deletions src/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
* limitations under the License.
*/

// The following limits are imposed by wasmparser on WebAssembly modules.
// The limits are agreed upon with other engines for consistency.
pub const MAX_WASM_TYPES: usize = 1_000_000;
pub const MAX_WASM_FUNCTIONS: usize = 1_000_000;
pub const _MAX_WASM_IMPORTS: usize = 100_000;
pub const _MAX_WASM_EXPORTS: usize = 100_000;
pub const MAX_WASM_GLOBALS: usize = 1_000_000;
pub const _MAX_WASM_DATA_SEGMENTS: usize = 100_000;
pub const MAX_WASM_MEMORY_PAGES: usize = 65536;
// The following limits are updated to fit the restrictions of a WASM smart
// contract, which should be much lower than for the usual WASM use-case.
pub const MAX_WASM_TYPES: usize = 10_000;
pub const MAX_WASM_FUNCTIONS: usize = 10_000;
pub const _MAX_WASM_IMPORTS: usize = 1000;
pub const _MAX_WASM_EXPORTS: usize = 1000;
pub const MAX_WASM_GLOBALS: usize = 4000; // max 32K
pub const _MAX_WASM_DATA_SEGMENTS: usize = 10_000;
pub const MAX_WASM_MEMORY_PAGES: usize = 1000; // max 64M memory
pub const MAX_WASM_STRING_SIZE: usize = 100_000;
pub const _MAX_WASM_MODULE_SIZE: usize = 1024 * 1024 * 1024; //= 1 GiB
pub const _MAX_WASM_MODULE_SIZE: usize = 1024 * 1024 * 32; // 32M
pub const MAX_WASM_FUNCTION_SIZE: usize = 128 * 1024;
pub const MAX_WASM_FUNCTION_LOCALS: usize = 50000;
pub const MAX_WASM_FUNCTION_PARAMS: usize = 1000;
pub const MAX_WASM_FUNCTION_RETURNS: usize = 1000;
pub const _MAX_WASM_TABLE_SIZE: usize = 10_000_000;
pub const MAX_WASM_TABLE_ENTRIES: usize = 10_000_000;
pub const MAX_WASM_FUNCTION_LOCALS: usize = 4000;
pub const MAX_WASM_FUNCTION_PARAMS: usize = 100;
pub const MAX_WASM_FUNCTION_RETURNS: usize = 100;
pub const _MAX_WASM_TABLE_SIZE: usize = 10_000;
pub const MAX_WASM_TABLE_ENTRIES: usize = 10_000;
pub const MAX_WASM_TABLES: usize = 1;
pub const MAX_WASM_MEMORIES: usize = 1;