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
+1 -1
View File
@@ -23,7 +23,7 @@ sr-version = { path = "../sr-version" }
primitives = { package = "substrate-primitives", path = "../primitives" }
criterion = "0.2"
consensus_common = { package = "substrate-consensus-common", path = "../consensus/common" }
codec = { package = "parity-codec", version = "4.1.1" }
codec = { package = "parity-scale-codec", version = "1.0.0" }
trybuild = "1.0"
[[bench]]
@@ -192,7 +192,7 @@ fn generate_native_call_generators(decl: &ItemTrait) -> Result<TokenStream> {
{
<R as #crate_::runtime_api::Decode>::decode(
&mut &#crate_::runtime_api::Encode::encode(input)[..]
).ok_or_else(|| error_desc)
).map_err(|_| error_desc)
}
));
@@ -682,9 +682,9 @@ impl<'a> ToClientSideDecl<'a> {
},
#crate_::runtime_api::NativeOrEncoded::Encoded(r) => {
<#ret_type as #crate_::runtime_api::Decode>::decode(&mut &r[..])
.ok_or_else(||
.map_err(|err|
#crate_::error::Error::CallResultDecode(
#function_name
#function_name, err
).into()
)
}
@@ -77,8 +77,8 @@ fn generate_impl_call(
quote!(
#(
let #pnames : #ptypes = match #c_iter::runtime_api::Decode::decode(&mut #input) {
Some(input) => input,
None => panic!("Bad input data provided to {}", #fn_name_str),
Ok(input) => input,
Err(e) => panic!("Bad input data provided to {}: {}", #fn_name_str, e.what()),
};
)*