srml-contract: Sandbox mem IO according to COMPLEXITY.md (#939)

* Sandbox mem IO according to COMPLEXITY.md

* Fix tests.

* Update root hash for deploying contract test.
This commit is contained in:
Sergey Pepyakin
2018-11-05 19:23:16 +01:00
committed by Gav Wood
parent fcae7ac582
commit 9072fce658
6 changed files with 140 additions and 70 deletions
+10 -2
View File
@@ -164,6 +164,12 @@ pub struct Config<T: Trait> {
/// Gas cost per one byte returned.
return_data_per_byte_cost: T::Gas,
/// Gas cost per one byte read from the sandbox memory.
sandbox_data_read_cost: T::Gas,
/// Gas cost per one byte written to the sandbox memory.
sandbox_data_write_cost: T::Gas,
/// How tall the stack is allowed to grow?
///
/// See https://wiki.parity.io/WebAssembly-StackHeight to find out
@@ -181,6 +187,8 @@ impl<T: Trait> Default for Config<T> {
grow_mem_cost: T::Gas::sa(1),
regular_op_cost: T::Gas::sa(1),
return_data_per_byte_cost: T::Gas::sa(1),
sandbox_data_read_cost: T::Gas::sa(1),
sandbox_data_write_cost: T::Gas::sa(1),
max_stack_height: 64 * 1024,
max_memory_pages: 16,
}
@@ -322,7 +330,7 @@ mod tests {
data: vec![
1, 2, 3, 4,
],
gas_left: 49990,
gas_left: 49970,
}]
);
}
@@ -385,7 +393,7 @@ mod tests {
data: vec![
1, 2, 3, 4,
],
gas_left: 49990,
gas_left: 49970,
}]
);
}