Fix warnings and make CI working again (#4469)

* Fix warnings and make CI working again

* Fix test
This commit is contained in:
Bastian Köcher
2019-12-20 14:47:19 +01:00
committed by Arkadiy Paronyan
parent 7d4c6354df
commit bfad5f3ffc
9 changed files with 48 additions and 47 deletions
+3 -3
View File
@@ -4121,13 +4121,13 @@ dependencies = [
"arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bitvec 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)", "bitvec 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
"byte-slice-cast 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "byte-slice-cast 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-scale-codec-derive 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec-derive 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "parity-scale-codec-derive" name = "parity-scale-codec-derive"
version = "1.1.0" version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -8381,7 +8381,7 @@ dependencies = [
"checksum parity-multihash 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df3a17dc27848fd99e4f87eb0f8c9baba6ede0a6d555400c850ca45254ef4ce3" "checksum parity-multihash 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df3a17dc27848fd99e4f87eb0f8c9baba6ede0a6d555400c850ca45254ef4ce3"
"checksum parity-multihash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c70cad855872dd51ce6679e823efb6434061a2c1782a1686438aabf506392cdd" "checksum parity-multihash 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c70cad855872dd51ce6679e823efb6434061a2c1782a1686438aabf506392cdd"
"checksum parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f9f9d99dae413590a5f37e43cd99b94d4e62a244160562899126913ea7108673" "checksum parity-scale-codec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f9f9d99dae413590a5f37e43cd99b94d4e62a244160562899126913ea7108673"
"checksum parity-scale-codec-derive 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "492ac3aa93d6caa5d20e4e3e0b75d08e2dcd9dd8a50d19529548b6fe11b3f295" "checksum parity-scale-codec-derive 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34e513ff3e406f3ede6796dcdc83d0b32ffb86668cea1ccf7363118abeb00476"
"checksum parity-send-wrapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" "checksum parity-send-wrapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f"
"checksum parity-util-mem 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "570093f39f786beea92dcc09e45d8aae7841516ac19a50431953ac82a0e8f85c" "checksum parity-util-mem 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "570093f39f786beea92dcc09e45d8aae7841516ac19a50431953ac82a0e8f85c"
"checksum parity-wasm 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" "checksum parity-wasm 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac"
@@ -693,7 +693,7 @@ mod tests {
&self, &self,
_: &BlockId<Block>, _: &BlockId<Block>,
_: ExecutionContext, _: ExecutionContext,
_: Option<(Block)>, _: Option<Block>,
_: Vec<u8>, _: Vec<u8>,
) -> std::result::Result<NativeOrEncoded<()>, sp_blockchain::Error> { ) -> std::result::Result<NativeOrEncoded<()>, sp_blockchain::Error> {
unimplemented!("Not required for testing!") unimplemented!("Not required for testing!")
@@ -225,7 +225,7 @@ impl Core<Block> for RuntimeApi {
&self, &self,
_: &BlockId<Block>, _: &BlockId<Block>,
_: ExecutionContext, _: ExecutionContext,
_: Option<(Block)>, _: Option<Block>,
_: Vec<u8>, _: Vec<u8>,
) -> Result<NativeOrEncoded<()>> { ) -> Result<NativeOrEncoded<()>> {
unimplemented!("Not required for testing!") unimplemented!("Not required for testing!")
+1 -1
View File
@@ -62,7 +62,7 @@ pub struct ImportOperation<Block: BlockT, S, H: Hasher> {
finalized_blocks: Vec<BlockId<Block>>, finalized_blocks: Vec<BlockId<Block>>,
set_head: Option<BlockId<Block>>, set_head: Option<BlockId<Block>>,
storage_update: Option<InMemoryState<H>>, storage_update: Option<InMemoryState<H>>,
_phantom: ::std::marker::PhantomData<(S)>, _phantom: ::std::marker::PhantomData<S>,
} }
/// Either in-memory genesis state, or locally-unavailable state. /// Either in-memory genesis state, or locally-unavailable state.
+3 -3
View File
@@ -1186,7 +1186,7 @@ macro_rules! decl_module {
{ {
#[doc(hidden)] #[doc(hidden)]
#[codec(skip)] #[codec(skip)]
__PhantomItem($crate::sp_std::marker::PhantomData<($trait_instance $(, $instance)?)>, $crate::dispatch::Never), __PhantomItem($crate::sp_std::marker::PhantomData<($trait_instance, $($instance)?)>, $crate::dispatch::Never),
$( $generated_variants )* $( $generated_variants )*
} }
}; };
@@ -1224,7 +1224,7 @@ macro_rules! decl_module {
pub struct $mod_type< pub struct $mod_type<
$trait_instance: $trait_name $trait_instance: $trait_name
$(<I>, $instance: $instantiable $( = $module_default_instance)?)? $(<I>, $instance: $instantiable $( = $module_default_instance)?)?
>($crate::sp_std::marker::PhantomData<($trait_instance $(, $instance)?)>) where >($crate::sp_std::marker::PhantomData<($trait_instance, $( $instance)?)>) where
$( $other_where_bounds )*; $( $other_where_bounds )*;
$crate::decl_module! { $crate::decl_module! {
@@ -1671,7 +1671,7 @@ macro_rules! __impl_module_constants_metadata {
<I>, $const_instance: $const_instantiable <I>, $const_instance: $const_instantiable
)? )?
>($crate::dispatch::marker::PhantomData< >($crate::dispatch::marker::PhantomData<
($const_trait_instance $(, $const_instance)?) ($const_trait_instance, $( $const_instance)?)
>); >);
impl<$const_trait_instance: 'static + $const_trait_name $( impl<$const_trait_instance: 'static + $const_trait_name $(
<I>, $const_instance: $const_instantiable)? <I>, $const_instance: $const_instantiable)?
+1 -1
View File
@@ -86,7 +86,7 @@ macro_rules! decl_error {
pub enum $error<$generic: $trait $(, $inst_generic: $instance)?> { pub enum $error<$generic: $trait $(, $inst_generic: $instance)?> {
#[doc(hidden)] #[doc(hidden)]
__Ignore( __Ignore(
$crate::sp_std::marker::PhantomData<($generic $(, $inst_generic)?)>, $crate::sp_std::marker::PhantomData<($generic, $( $inst_generic)?)>,
$crate::dispatch::Never, $crate::dispatch::Never,
), ),
$( $(
@@ -79,7 +79,7 @@ mod tests {
COMPLEXTYPE1: ::std::vec::Vec<<T as Trait>::Origin>; COMPLEXTYPE1: ::std::vec::Vec<<T as Trait>::Origin>;
COMPLEXTYPE2: (Vec<Vec<(u16,Box<( )>)>>, u32); COMPLEXTYPE2: (Vec<Vec<(u16,Box<( )>)>>, u32);
COMPLEXTYPE3: ([u32;25]); COMPLEXTYPE3: [u32;25];
} }
add_extra_genesis { add_extra_genesis {
build(|_| {}); build(|_| {});
@@ -430,7 +430,7 @@ mod tests {
StorageEntryMetadata { StorageEntryMetadata {
name: DecodeDifferent::Encode("COMPLEXTYPE3"), name: DecodeDifferent::Encode("COMPLEXTYPE3"),
modifier: StorageEntryModifier::Default, modifier: StorageEntryModifier::Default,
ty: StorageEntryType::Plain(DecodeDifferent::Encode("([u32; 25])")), ty: StorageEntryType::Plain(DecodeDifferent::Encode("[u32; 25]")),
default: DecodeDifferent::Encode( default: DecodeDifferent::Encode(
DefaultByteGetter(&__GetByteStructCOMPLEXTYPE3(PhantomData::<TraitImpl>)) DefaultByteGetter(&__GetByteStructCOMPLEXTYPE3(PhantomData::<TraitImpl>))
), ),
@@ -15,6 +15,7 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>. // along with Substrate. If not, see <http://www.gnu.org/licenses/>.
//! Integration tests for runtime interface primitives //! Integration tests for runtime interface primitives
#![cfg(test)]
use sp_runtime_interface::*; use sp_runtime_interface::*;
use sp_runtime_interface_test_wasm::{WASM_BINARY, test_api::HostFunctions}; use sp_runtime_interface_test_wasm::{WASM_BINARY, test_api::HostFunctions};
@@ -23,85 +24,85 @@ use sp_wasm_interface::HostFunctions as HostFunctionsT;
type TestExternalities = sp_state_machine::TestExternalities<sp_core::Blake2Hasher, u64>; type TestExternalities = sp_state_machine::TestExternalities<sp_core::Blake2Hasher, u64>;
fn call_wasm_method<HF: HostFunctionsT>(method: &str) -> TestExternalities { fn call_wasm_method<HF: HostFunctionsT>(method: &str) -> TestExternalities {
let mut ext = TestExternalities::default(); let mut ext = TestExternalities::default();
let mut ext_ext = ext.ext(); let mut ext_ext = ext.ext();
sc_executor::call_in_wasm::< sc_executor::call_in_wasm::<
_, _,
( (
HF, HF,
sp_io::SubstrateHostFunctions, sp_io::SubstrateHostFunctions,
sc_executor::deprecated_host_interface::SubstrateExternals sc_executor::deprecated_host_interface::SubstrateExternals
) )
>( >(
method, method,
&[], &[],
sc_executor::WasmExecutionMethod::Interpreted, sc_executor::WasmExecutionMethod::Interpreted,
&mut ext_ext, &mut ext_ext,
&WASM_BINARY[..], &WASM_BINARY[..],
8, 8,
).expect(&format!("Executes `{}`", method)); ).expect(&format!("Executes `{}`", method));
ext ext
} }
#[test] #[test]
fn test_return_data() { fn test_return_data() {
call_wasm_method::<HostFunctions>("test_return_data"); call_wasm_method::<HostFunctions>("test_return_data");
} }
#[test] #[test]
fn test_return_option_data() { fn test_return_option_data() {
call_wasm_method::<HostFunctions>("test_return_option_data"); call_wasm_method::<HostFunctions>("test_return_option_data");
} }
#[test] #[test]
fn test_set_storage() { fn test_set_storage() {
let mut ext = call_wasm_method::<HostFunctions>("test_set_storage"); let mut ext = call_wasm_method::<HostFunctions>("test_set_storage");
let expected = "world"; let expected = "world";
assert_eq!(expected.as_bytes(), &ext.ext().storage("hello".as_bytes()).unwrap()[..]); assert_eq!(expected.as_bytes(), &ext.ext().storage("hello".as_bytes()).unwrap()[..]);
} }
#[test] #[test]
fn test_return_value_into_mutable_reference() { fn test_return_value_into_mutable_reference() {
call_wasm_method::<HostFunctions>("test_return_value_into_mutable_reference"); call_wasm_method::<HostFunctions>("test_return_value_into_mutable_reference");
} }
#[test] #[test]
fn test_get_and_return_array() { fn test_get_and_return_array() {
call_wasm_method::<HostFunctions>("test_get_and_return_array"); call_wasm_method::<HostFunctions>("test_get_and_return_array");
} }
#[test] #[test]
fn test_array_as_mutable_reference() { fn test_array_as_mutable_reference() {
call_wasm_method::<HostFunctions>("test_array_as_mutable_reference"); call_wasm_method::<HostFunctions>("test_array_as_mutable_reference");
} }
#[test] #[test]
fn test_return_input_public_key() { fn test_return_input_public_key() {
call_wasm_method::<HostFunctions>("test_return_input_public_key"); call_wasm_method::<HostFunctions>("test_return_input_public_key");
} }
#[test] #[test]
#[should_panic( #[should_panic(
expected = "Other(\"Instantiation: Export ext_test_api_return_input_version_1 not found\")" expected = "Other(\"Instantiation: Export ext_test_api_return_input_version_1 not found\")"
)] )]
fn host_function_not_found() { fn host_function_not_found() {
call_wasm_method::<()>("test_return_data"); call_wasm_method::<()>("test_return_data");
} }
#[test] #[test]
#[should_panic( #[should_panic(
expected = expected =
"FunctionExecution(\"ext_test_api_invalid_utf8_data_version_1\", \ "FunctionExecution(\"ext_test_api_invalid_utf8_data_version_1\", \
\"Invalid utf8 data provided\")" \"Invalid utf8 data provided\")"
)] )]
fn test_invalid_utf8_data_should_return_an_error() { fn test_invalid_utf8_data_should_return_an_error() {
call_wasm_method::<HostFunctions>("test_invalid_utf8_data_should_return_an_error"); call_wasm_method::<HostFunctions>("test_invalid_utf8_data_should_return_an_error");
} }
#[test] #[test]
fn test_overwrite_native_function_implementation() { fn test_overwrite_native_function_implementation() {
call_wasm_method::<HostFunctions>("test_overwrite_native_function_implementation"); call_wasm_method::<HostFunctions>("test_overwrite_native_function_implementation");
} }
+1 -1
View File
@@ -6,7 +6,7 @@ edition = "2018"
[dependencies] [dependencies]
serde = { version = "1.0.101", optional = true, features = ["derive"] } serde = { version = "1.0.101", optional = true, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false, features = ["derive"] }
sp-core = { version = "2.0.0", default-features = false, path = "../core" } sp-core = { version = "2.0.0", default-features = false, path = "../core" }
sp-application-crypto = { version = "2.0.0", default-features = false, path = "../application-crypto" } sp-application-crypto = { version = "2.0.0", default-features = false, path = "../application-crypto" }
sp-arithmetic = { version = "2.0.0", default-features = false, path = "../arithmetic" } sp-arithmetic = { version = "2.0.0", default-features = false, path = "../arithmetic" }