Update to parity-scale-codec (#3232)

* WIP: update codec

* WIP

* compiling

* WIP

* rename parity-scale-codec to codec

* WIP

* fix

* remove old comments

* use published crates

* fix expected error msg

* bump version

* fmt and fix

* remove old comment

* fix wrong decoding impl

* implement encode like for structures

* undo removal of old pending changes

* trailingzeroinput

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* update codec

* fmt

* version is 1.0.0

* show more error

* fmt
This commit is contained in:
thiolliere
2019-08-06 19:36:23 +02:00
committed by Bastian Köcher
parent a0d442333f
commit 4ed67e03a4
211 changed files with 867 additions and 682 deletions
@@ -22,7 +22,7 @@ use std::{
marker::PhantomData, cell::RefCell, rc::Rc,
};
use parity_codec::{Encode, Decode};
use codec::{Encode, Decode};
use primitives::{offchain, H256, Blake2Hasher, convert_hash, NativeOrEncoded};
use sr_primitives::generic::BlockId;
use sr_primitives::traits::{One, Block as BlockT, Header as HeaderT};
@@ -149,7 +149,7 @@ where
fn runtime_version(&self, id: &BlockId<Block>) -> ClientResult<RuntimeVersion> {
let call_result = self.call(id, "Core_version", &[], ExecutionStrategy::NativeElseWasm, NeverOffchainExt::new())?;
RuntimeVersion::decode(&mut call_result.as_slice())
.ok_or_else(|| ClientError::VersionInvalid.into())
.map_err(|_| ClientError::VersionInvalid.into())
}
fn call_at_state<
+3 -3
View File
@@ -22,7 +22,7 @@ use std::marker::PhantomData;
use std::future::Future;
use hash_db::{HashDB, Hasher, EMPTY_PREFIX};
use parity_codec::{Decode, Encode};
use codec::{Decode, Encode};
use primitives::{ChangesTrieConfiguration, convert_hash};
use sr_primitives::traits::{
Block as BlockT, Header as HeaderT, Hash, HashFor, NumberFor,
@@ -486,7 +486,7 @@ impl<'a, H, Number, Hash> ChangesTrieRootsStorage<H, Number> for RootsStorage<'a
pub mod tests {
use futures::future::Ready;
use parking_lot::Mutex;
use parity_codec::Decode;
use codec::Decode;
use crate::client::tests::prepare_client_with_key_changes;
use executor::{self, NativeExecutor};
use crate::error::Error as ClientError;
@@ -566,7 +566,7 @@ pub mod tests {
// 'fetch' read proof from remote node
let heap_pages = remote_client.storage(&remote_block_id, &StorageKey(well_known_keys::HEAP_PAGES.to_vec()))
.unwrap()
.and_then(|v| Decode::decode(&mut &v.0[..])).unwrap();
.and_then(|v| Decode::decode(&mut &v.0[..]).ok()).unwrap();
let remote_read_proof = remote_client.read_proof(&remote_block_id, well_known_keys::HEAP_PAGES).unwrap();
// check remote read proof locally