From d38d4c425de22aeea167f5b4a45aff96a717f582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Leegwater=20Sim=C3=B5es?= Date: Tue, 24 Oct 2023 16:38:13 +0200 Subject: [PATCH] piecrust: increase max memory size to 4TiB Resolves #159 --- piecrust/CHANGELOG.md | 3 +++ piecrust/src/store/memory.rs | 2 +- piecrust/src/store/tree.rs | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/piecrust/CHANGELOG.md b/piecrust/CHANGELOG.md index d9e397f5..331b9ecf 100644 --- a/piecrust/CHANGELOG.md +++ b/piecrust/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Changed +- Change contract tree to be arity 4 and height 17 [#159] +- Maximum contract size is now 4TiB [#159] - Change `Error::RuntimeError` variant to contain `dusk_wasmtime::Error`, and changed `From` implementation - Switch runtime from `wasmer` to `wasmtime` @@ -303,6 +305,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#167]: https://github.com/dusk-network/piecrust/issues/167 [#166]: https://github.com/dusk-network/piecrust/issues/166 [#162]: https://github.com/dusk-network/piecrust/issues/162 +[#159]: https://github.com/dusk-network/piecrust/issues/159 [#158]: https://github.com/dusk-network/piecrust/issues/158 [#136]: https://github.com/dusk-network/piecrust/issues/136 [#93]: https://github.com/dusk-network/piecrust/issues/93 diff --git a/piecrust/src/store/memory.rs b/piecrust/src/store/memory.rs index 1f45e500..ce549a49 100644 --- a/piecrust/src/store/memory.rs +++ b/piecrust/src/store/memory.rs @@ -16,7 +16,7 @@ use crumbles::{LocateFile, Mmap}; use dusk_wasmtime::LinearMemory; pub const PAGE_SIZE: usize = 0x10000; -const WASM_MAX_PAGES: u32 = 0x10000; +const WASM_MAX_PAGES: u32 = 0x4000000; const MIN_PAGES: usize = 4; const MIN_MEM_SIZE: usize = MIN_PAGES * PAGE_SIZE; diff --git a/piecrust/src/store/tree.rs b/piecrust/src/store/tree.rs index 48f63b2c..f42a12d7 100644 --- a/piecrust/src/store/tree.rs +++ b/piecrust/src/store/tree.rs @@ -12,9 +12,9 @@ use rkyv::{Archive, Deserialize, Serialize}; use crate::store::memory::Memory; -// There are `2^16` pages in a memory -const P_HEIGHT: usize = 16; -const P_ARITY: usize = 2; +// There are max `2^26` pages in a memory +const P_HEIGHT: usize = 13; +const P_ARITY: usize = 4; pub type PageTree = dusk_merkle::Tree;