Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
eacb017
added [unstable][seal2] call()
agryaznov Mar 7, 2023
b3c9265
updated test to cover new seal_call proof_limit
agryaznov Mar 7, 2023
e226add
docs updated
agryaznov Mar 7, 2023
aba8782
add [seal2][unstable] instantiate() and test
agryaznov Mar 7, 2023
53d8fde
add [seal2][unstable] weight_to_fee() + docs and test
agryaznov Mar 7, 2023
09d1df6
add [seal2][unstable] gas_left() + docs and test
agryaznov Mar 8, 2023
c644fa1
update benchmarks
agryaznov Mar 8, 2023
2cb30c7
add DefaultDepositLimit to pallet Config
agryaznov Mar 8, 2023
a968b29
specify deposit limit for nested call
agryaznov Mar 9, 2023
45b48c2
specify deposit limit for nested instantiate
agryaznov Mar 13, 2023
ec58346
Merge branch 'master' into ag-proof_limit
agryaznov Mar 14, 2023
edf1aac
update benchmarks
agryaznov Mar 14, 2023
2bfb866
added missing fixtures
agryaznov Mar 16, 2023
1ff3f16
fix benches
agryaznov Mar 16, 2023
b0f3103
pass explicit deposit limit to storage bench
agryaznov Mar 16, 2023
3af8712
explicit deposit limit for another set_storage bench
agryaznov Mar 16, 2023
825a6bc
add more deposit limit for storage benches
agryaznov Mar 16, 2023
8f9ea17
moving to simplified benchmarks
agryaznov Mar 16, 2023
6ac5355
Merge branch 'master' into ag-proof_limit
agryaznov Mar 16, 2023
04ead1b
moved to simplified benchmarks
agryaznov Mar 16, 2023
7d1023d
fix seal_weight_to_fee bench
agryaznov Mar 16, 2023
8e6c6d2
fix seal_instantiate benchmark
agryaznov Mar 16, 2023
d618957
Merge branch 'master' into ag-proof_limit
agryaznov Mar 30, 2023
16f0994
doc typo fix
agryaznov Mar 31, 2023
24dcd0e
default dl for benchmarking
agryaznov Mar 31, 2023
d7eab4a
max_runtime_mem to Schedule limits
agryaznov Apr 3, 2023
91fd102
Merge branch 'master' into ag-proof_limit
agryaznov Apr 3, 2023
af1b353
add default deposit limit fallback check to test
agryaznov Apr 12, 2023
04bea78
weight params renaming
agryaznov Apr 12, 2023
c01f166
Merge branch 'master' into ag-proof_limit
agryaznov Apr 12, 2023
50c96da
fmt
agryaznov Apr 12, 2023
95c83ea
Update frame/contracts/src/benchmarking/mod.rs
agryaznov Apr 25, 2023
22c5794
prettify inputs in tests
agryaznov Apr 25, 2023
418aa50
Merge branch 'ag-proof_limit' of github.com:paritytech/substrate into…
agryaznov Apr 25, 2023
0dac6f6
typestate param refactored
agryaznov Apr 25, 2023
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
Prev Previous commit
Next Next commit
max_runtime_mem to Schedule limits
  • Loading branch information
agryaznov committed Apr 3, 2023
commit d7eab4a8470eaaf67163b4ceeca327305ba896e1
8 changes: 4 additions & 4 deletions frame/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ pub mod pallet {
}

fn integrity_test() {
// Total runtime memory is expected to have 128Mb upper limit
const MAX_RUNTIME_MEM: u32 = 1024 * 1024 * 128;
// Total runtime memory limit
let max_runtime_mem: u32 = T::Schedule::get().limits.runtime_memory;
// Memory limits for a single contract:
// Value stack size: 1Mb per contract, default defined in wasmi
const MAX_STACK_SIZE: u32 = 1024 * 1024;
Expand Down Expand Up @@ -388,10 +388,10 @@ pub mod pallet {
// This gives us the following formula:
//
// `(MaxCodeLen * 18 * 4 + MAX_STACK_SIZE + max_heap_size) * max_call_depth <
// MAX_RUNTIME_MEM/2`
// max_runtime_mem/2`
//
// Hence the upper limit for the `MaxCodeLen` can be defined as follows:
let code_len_limit = MAX_RUNTIME_MEM
let code_len_limit = max_runtime_mem
.saturating_div(2)
.saturating_div(max_call_depth)
.saturating_sub(max_heap_size)
Expand Down
5 changes: 5 additions & 0 deletions frame/contracts/src/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ pub struct Limits {

/// The maximum size of a storage value and event payload in bytes.
pub payload_len: u32,

/// The maximum node runtime memory. This is for integrity checks only and does not affect the
/// real setting.
pub runtime_memory: u32,
}

impl Limits {
Expand Down Expand Up @@ -473,6 +477,7 @@ impl Default for Limits {
br_table_size: 256,
subject_len: 32,
payload_len: 16 * 1024,
runtime_memory: 1024 * 1024 * 128,
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ parameter_types! {
};
pub static DepositPerByte: BalanceOf<Test> = 1;
pub const DepositPerItem: BalanceOf<Test> = 2;
// We set it to maximum for running benchmarks
pub const DefaultDepositLimit: BalanceOf<Test> = Balance::max_value();
// We need this one set high enough for running benchmarks.
pub const DefaultDepositLimit: BalanceOf<Test> = 10_000_000;
}

impl Convert<Weight, BalanceOf<Self>> for Test {
Expand Down Expand Up @@ -4190,7 +4190,7 @@ fn deposit_limit_in_nested_instantiate() {

let callee_info_len = ContractInfoOf::<Test>::get(&addr).unwrap().encoded_size() as u64;

// We don't set a special deposit limit for the netsted instantiation.
// We don't set a special deposit limit for the nested instantiation.
//
// The deposit limit set for the parent is insufficient for the instantiation, which
// requires:
Expand Down