Skip to content
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

pallet-revive: Trade code size for call stack depth #6264

Merged
merged 3 commits into from
Oct 28, 2024
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
12 changes: 12 additions & 0 deletions prdoc/pr_6264.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title: 'pallet-revive: Trade code size for call stack depth'
doc:
- audience: Runtime Dev
description: This will reduce the call stack depth in order to raise the allowed
code size. Should allow around 100KB of instructions. This is necessary to stay
within the memory envelope. More code size is more appropriate for testing right
now. We will re-evaluate parameters once we have 64bit support.
crates:
- name: pallet-revive-fixtures
bump: major
- name: pallet-revive
bump: major
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern crate common;

use uapi::{HostFn, HostFnImpl as api, ReturnFlags};

static mut BUFFER: [u8; 1025 * 1024] = [0; 1025 * 1024];
static mut BUFFER: [u8; 2 * 1025 * 1024] = [0; 2 * 1025 * 1024];

#[no_mangle]
#[polkavm_derive::polkavm_export]
Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/revive/src/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
///
/// A 0 means that no callings of other contracts are possible. In other words only the origin
/// called "root contract" is allowed to execute then.
pub const CALL_STACK_DEPTH: u32 = 10;
pub const CALL_STACK_DEPTH: u32 = 5;

/// The maximum number of topics a call to [`crate::SyscallDoc::deposit_event`] can emit.
///
Expand Down Expand Up @@ -97,7 +97,7 @@ pub mod code {
/// for more code or more data. However, since code will decompress
/// into a bigger representation on compilation it will only increase
/// the allowed code size by [`BYTE_PER_INSTRUCTION`].
pub const STATIC_MEMORY_BYTES: u32 = 1024 * 1024;
pub const STATIC_MEMORY_BYTES: u32 = 2 * 1024 * 1024;

/// How much memory each instruction will take in-memory after compilation.
///
Expand Down
Loading