From cad28aa283894e08db48df8067534ee1661bf17a Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin <s.pepyakin@gmail.com> Date: Sun, 30 Sep 2018 13:16:31 +0100 Subject: [PATCH] metadata returns Bytes (#846) --- substrate/core/rpc/src/state/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/substrate/core/rpc/src/state/mod.rs b/substrate/core/rpc/src/state/mod.rs index ff5404460d5..47b6647bd26 100644 --- a/substrate/core/rpc/src/state/mod.rs +++ b/substrate/core/rpc/src/state/mod.rs @@ -63,9 +63,9 @@ build_rpc_trait! { #[rpc(name = "state_getStorageSize", alias = ["state_getStorageSizeAt", ])] fn storage_size(&self, StorageKey, Trailing<Hash>) -> Result<Option<u64>>; - /// Returns the runtime metadata as JSON. + /// Returns the runtime metadata as an opaque blob. #[rpc(name = "state_getMetadata")] - fn metadata(&self, Trailing<Hash>) -> Result<Vec<u8>>; + fn metadata(&self, Trailing<Hash>) -> Result<Bytes>; /// Query historical storage entries (by key) starting from a block given as the second parameter. /// @@ -149,9 +149,9 @@ impl<B, E, Block> StateApi<Block::Hash> for State<B, E, Block> where Ok(self.storage(key, block)?.map(|x| x.0.len() as u64)) } - fn metadata(&self, block: Trailing<Block::Hash>) -> Result<Vec<u8>> { + fn metadata(&self, block: Trailing<Block::Hash>) -> Result<Bytes> { let block = self.unwrap_or_best(block)?; - self.client.metadata(&BlockId::Hash(block)).map_err(Into::into) + self.client.metadata(&BlockId::Hash(block)).map(Bytes).map_err(Into::into) } fn query_storage(&self, keys: Vec<StorageKey>, from: Block::Hash, to: Trailing<Block::Hash>) -> Result<Vec<StorageChangeSet<Block::Hash>>> { -- GitLab