mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 14:58:03 +00:00
Fix warnings and make CI working again (#4469)
* Fix warnings and make CI working again * Fix test
This commit is contained in:
committed by
Arkadiy Paronyan
parent
7d4c6354df
commit
bfad5f3ffc
Generated
+3
-3
@@ -4121,13 +4121,13 @@ dependencies = [
|
||||
"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)",
|
||||
"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)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parity-scale-codec-derive"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"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.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-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-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"
|
||||
|
||||
@@ -693,7 +693,7 @@ mod tests {
|
||||
&self,
|
||||
_: &BlockId<Block>,
|
||||
_: ExecutionContext,
|
||||
_: Option<(Block)>,
|
||||
_: Option<Block>,
|
||||
_: Vec<u8>,
|
||||
) -> std::result::Result<NativeOrEncoded<()>, sp_blockchain::Error> {
|
||||
unimplemented!("Not required for testing!")
|
||||
|
||||
@@ -225,7 +225,7 @@ impl Core<Block> for RuntimeApi {
|
||||
&self,
|
||||
_: &BlockId<Block>,
|
||||
_: ExecutionContext,
|
||||
_: Option<(Block)>,
|
||||
_: Option<Block>,
|
||||
_: Vec<u8>,
|
||||
) -> Result<NativeOrEncoded<()>> {
|
||||
unimplemented!("Not required for testing!")
|
||||
|
||||
@@ -62,7 +62,7 @@ pub struct ImportOperation<Block: BlockT, S, H: Hasher> {
|
||||
finalized_blocks: Vec<BlockId<Block>>,
|
||||
set_head: Option<BlockId<Block>>,
|
||||
storage_update: Option<InMemoryState<H>>,
|
||||
_phantom: ::std::marker::PhantomData<(S)>,
|
||||
_phantom: ::std::marker::PhantomData<S>,
|
||||
}
|
||||
|
||||
/// Either in-memory genesis state, or locally-unavailable state.
|
||||
|
||||
@@ -1186,7 +1186,7 @@ macro_rules! decl_module {
|
||||
{
|
||||
#[doc(hidden)]
|
||||
#[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 )*
|
||||
}
|
||||
};
|
||||
@@ -1224,7 +1224,7 @@ macro_rules! decl_module {
|
||||
pub struct $mod_type<
|
||||
$trait_instance: $trait_name
|
||||
$(<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 )*;
|
||||
|
||||
$crate::decl_module! {
|
||||
@@ -1671,7 +1671,7 @@ macro_rules! __impl_module_constants_metadata {
|
||||
<I>, $const_instance: $const_instantiable
|
||||
)?
|
||||
>($crate::dispatch::marker::PhantomData<
|
||||
($const_trait_instance $(, $const_instance)?)
|
||||
($const_trait_instance, $( $const_instance)?)
|
||||
>);
|
||||
impl<$const_trait_instance: 'static + $const_trait_name $(
|
||||
<I>, $const_instance: $const_instantiable)?
|
||||
|
||||
@@ -86,7 +86,7 @@ macro_rules! decl_error {
|
||||
pub enum $error<$generic: $trait $(, $inst_generic: $instance)?> {
|
||||
#[doc(hidden)]
|
||||
__Ignore(
|
||||
$crate::sp_std::marker::PhantomData<($generic $(, $inst_generic)?)>,
|
||||
$crate::sp_std::marker::PhantomData<($generic, $( $inst_generic)?)>,
|
||||
$crate::dispatch::Never,
|
||||
),
|
||||
$(
|
||||
|
||||
@@ -79,7 +79,7 @@ mod tests {
|
||||
|
||||
COMPLEXTYPE1: ::std::vec::Vec<<T as Trait>::Origin>;
|
||||
COMPLEXTYPE2: (Vec<Vec<(u16,Box<( )>)>>, u32);
|
||||
COMPLEXTYPE3: ([u32;25]);
|
||||
COMPLEXTYPE3: [u32;25];
|
||||
}
|
||||
add_extra_genesis {
|
||||
build(|_| {});
|
||||
@@ -430,7 +430,7 @@ mod tests {
|
||||
StorageEntryMetadata {
|
||||
name: DecodeDifferent::Encode("COMPLEXTYPE3"),
|
||||
modifier: StorageEntryModifier::Default,
|
||||
ty: StorageEntryType::Plain(DecodeDifferent::Encode("([u32; 25])")),
|
||||
ty: StorageEntryType::Plain(DecodeDifferent::Encode("[u32; 25]")),
|
||||
default: DecodeDifferent::Encode(
|
||||
DefaultByteGetter(&__GetByteStructCOMPLEXTYPE3(PhantomData::<TraitImpl>))
|
||||
),
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Integration tests for runtime interface primitives
|
||||
#![cfg(test)]
|
||||
|
||||
use sp_runtime_interface::*;
|
||||
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>;
|
||||
|
||||
fn call_wasm_method<HF: HostFunctionsT>(method: &str) -> TestExternalities {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext_ext = ext.ext();
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext_ext = ext.ext();
|
||||
|
||||
sc_executor::call_in_wasm::<
|
||||
_,
|
||||
(
|
||||
HF,
|
||||
sp_io::SubstrateHostFunctions,
|
||||
sc_executor::deprecated_host_interface::SubstrateExternals
|
||||
)
|
||||
>(
|
||||
method,
|
||||
&[],
|
||||
sc_executor::WasmExecutionMethod::Interpreted,
|
||||
&mut ext_ext,
|
||||
&WASM_BINARY[..],
|
||||
8,
|
||||
).expect(&format!("Executes `{}`", method));
|
||||
sc_executor::call_in_wasm::<
|
||||
_,
|
||||
(
|
||||
HF,
|
||||
sp_io::SubstrateHostFunctions,
|
||||
sc_executor::deprecated_host_interface::SubstrateExternals
|
||||
)
|
||||
>(
|
||||
method,
|
||||
&[],
|
||||
sc_executor::WasmExecutionMethod::Interpreted,
|
||||
&mut ext_ext,
|
||||
&WASM_BINARY[..],
|
||||
8,
|
||||
).expect(&format!("Executes `{}`", method));
|
||||
|
||||
ext
|
||||
ext
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_return_data() {
|
||||
call_wasm_method::<HostFunctions>("test_return_data");
|
||||
call_wasm_method::<HostFunctions>("test_return_data");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_return_option_data() {
|
||||
call_wasm_method::<HostFunctions>("test_return_option_data");
|
||||
call_wasm_method::<HostFunctions>("test_return_option_data");
|
||||
}
|
||||
|
||||
#[test]
|
||||
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";
|
||||
assert_eq!(expected.as_bytes(), &ext.ext().storage("hello".as_bytes()).unwrap()[..]);
|
||||
let expected = "world";
|
||||
assert_eq!(expected.as_bytes(), &ext.ext().storage("hello".as_bytes()).unwrap()[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
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]
|
||||
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]
|
||||
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]
|
||||
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]
|
||||
#[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() {
|
||||
call_wasm_method::<()>("test_return_data");
|
||||
call_wasm_method::<()>("test_return_data");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(
|
||||
expected =
|
||||
"FunctionExecution(\"ext_test_api_invalid_utf8_data_version_1\", \
|
||||
\"Invalid utf8 data provided\")"
|
||||
expected =
|
||||
"FunctionExecution(\"ext_test_api_invalid_utf8_data_version_1\", \
|
||||
\"Invalid utf8 data provided\")"
|
||||
)]
|
||||
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]
|
||||
fn test_overwrite_native_function_implementation() {
|
||||
call_wasm_method::<HostFunctions>("test_overwrite_native_function_implementation");
|
||||
call_wasm_method::<HostFunctions>("test_overwrite_native_function_implementation");
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
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-application-crypto = { version = "2.0.0", default-features = false, path = "../application-crypto" }
|
||||
sp-arithmetic = { version = "2.0.0", default-features = false, path = "../arithmetic" }
|
||||
|
||||
Reference in New Issue
Block a user