From 70db89270f572dfb5f993ab86201df79f9d44ef0 Mon Sep 17 00:00:00 2001 From: Gav Date: Sun, 18 Feb 2018 23:44:29 +0100 Subject: [PATCH] Fix merge. --- substrate/substrate/runtime-support/src/storage.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/substrate/substrate/runtime-support/src/storage.rs b/substrate/substrate/runtime-support/src/storage.rs index 95625bfa18..7dbfd8013b 100644 --- a/substrate/substrate/runtime-support/src/storage.rs +++ b/substrate/substrate/runtime-support/src/storage.rs @@ -18,7 +18,7 @@ use rstd::prelude::*; use runtime_io::{self, twox_128}; -use codec::{Slicable, KeyedVec}; +use codec::{Slicable, KeyedVec, Input}; // TODO: consider using blake256 to avoid possible preimage attack. @@ -44,8 +44,8 @@ pub fn get(key: &[u8]) -> Option { key: &key[..], pos: 0, }; - Slicable::decode(&mut input) - } + Slicable::decode(&mut input).expect("stroage is not null, therefore must be a valid type") + }) } /// Return the value of the item in storage under `key`, or the type's default if there is no @@ -168,7 +168,7 @@ pub trait StorageVec { } pub mod unhashed { - use super::{runtime_io, Slicable, KeyedVec, Vec}; + use super::{runtime_io, Slicable, KeyedVec, Vec, IncrementalInput}; /// Return the value of the item in storage under `key`, or `None` if there is no explicit entry. pub fn get(key: &[u8]) -> Option { @@ -177,10 +177,10 @@ pub mod unhashed { key, pos: 0, }; - Slicable::decode(&mut input) - } + Slicable::decode(&mut input).expect("stroage is not null, therefore must be a valid type") + }) } - + /// Return the value of the item in storage under `key`, or the type's default if there is no /// explicit entry. pub fn get_or_default(key: &[u8]) -> T {