Extract well known keys into a single place (#764)

* Extract well known keys into a single place

* Fixes.
This commit is contained in:
Sergey Pepyakin
2018-09-18 17:20:36 +03:00
committed by Gav Wood
parent 7fa337afbc
commit e7d1933d25
13 changed files with 89 additions and 49 deletions
+2 -1
View File
@@ -26,6 +26,7 @@ use runtime_primitives::BuildStorage;
use substrate_metadata::JsonMetadataDecodable;
use primitives::{Blake2Hasher, RlpCodec, H256};
use primitives::storage::{StorageKey, StorageData};
use primitives::storage::well_known_keys;
use codec::{Encode, Decode};
use state_machine::{
Backend as StateBackend, CodeExecutor,
@@ -228,7 +229,7 @@ impl<B, E, Block> Client<B, E, Block> where
/// Get the code at a given block.
pub fn code_at(&self, id: &BlockId<Block>) -> error::Result<Vec<u8>> {
Ok(self.storage(id, &StorageKey(b":code".to_vec()))?
Ok(self.storage(id, &StorageKey(well_known_keys::CODE.to_vec()))?
.expect("None is returned if there's no value stored for the given key; ':code' key is always defined; qed").0)
}