Contract storage limit (#3126)

* srml-contracts: Remove hard-coded code hashes from tests.

This makes it easier to update existing and add new test Wasm modules.

* Test maximum contract storage write size.

* Implement storage value limit for contracts.

* Bump node runtime spec version.
This commit is contained in:
Jim Posen
2019-07-16 16:23:06 +02:00
committed by Sergei Pepyakin
parent 95061beb79
commit 768eb1af4d
6 changed files with 203 additions and 55 deletions
+6 -1
View File
@@ -215,8 +215,11 @@ mod tests {
fn get_storage(&self, key: &StorageKey) -> Option<Vec<u8>> {
self.storage.get(key).cloned()
}
fn set_storage(&mut self, key: StorageKey, value: Option<Vec<u8>>) {
fn set_storage(&mut self, key: StorageKey, value: Option<Vec<u8>>)
-> Result<(), &'static str>
{
*self.storage.entry(key).or_insert(Vec::new()) = value.unwrap_or(Vec::new());
Ok(())
}
fn instantiate(
&mut self,
@@ -293,6 +296,8 @@ mod tests {
}
fn block_number(&self) -> u64 { 121 }
fn max_value_size(&self) -> u32 { 16_384 }
}
fn execute<E: Ext>(