Skip to content

Commit

Permalink
piecrust: increase max memory size to 4TiB
Browse files Browse the repository at this point in the history
Resolves #159
  • Loading branch information
Eduardo Leegwater Simões committed Oct 24, 2023
1 parent 8129ff7 commit d38d4c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions piecrust/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion piecrust/src/store/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions piecrust/src/store/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Hash, P_HEIGHT, P_ARITY>;

Expand Down

0 comments on commit d38d4c4

Please sign in to comment.