Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
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
Fix merge.
  • Loading branch information
gavofyork committed Feb 18, 2018
commit 0a08196c2bd23ddffc19c559532902d7ac85f390
14 changes: 7 additions & 7 deletions substrate/runtime-support/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -44,8 +44,8 @@ pub fn get<T: Slicable + Sized>(key: &[u8]) -> Option<T> {
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
Expand Down Expand Up @@ -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<T: Slicable + Sized>(key: &[u8]) -> Option<T> {
Expand All @@ -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<T: Slicable + Sized + Default>(key: &[u8]) -> T {
Expand Down