contracts: Validate code before deployment (#2330)

* Validate module before storing it in code_cache.

* Bump version.
This commit is contained in:
Sergei Pepyakin
2019-04-19 19:35:11 +02:00
committed by DemiMarie-parity
parent 2a463a7b2a
commit 07268022cc
8 changed files with 57 additions and 12 deletions
@@ -72,8 +72,6 @@ pub fn save<T: Trait>(
let prefab_module = prepare::prepare_contract::<T, Env>(&original_code, schedule)?;
let code_hash = T::Hashing::hash(&original_code);
// TODO: #1416 validate the code. If the code is not valid, then don't store it.
<CodeStorage<T>>::insert(code_hash, prefab_module);
<PristineCode<T>>::insert(code_hash, original_code);