mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 03:01:07 +00:00
Update initialize tests for latest rust stable (#5971)
* Update initialize tests for latest rust stable * Update more tests * AHHH * Fix `runtime-interface` test * ------------------------______________---------------------- * ...
This commit is contained in:
@@ -2,38 +2,38 @@ error: Invalid call fn name: `on_finalize`, name is reserved and doesn't match e
|
||||
--> $DIR/on_initialize.rs:31:1
|
||||
|
|
||||
31 | reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: Invalid call fn name: `on_initialize`, name is reserved and doesn't match expected signature, please refer to `decl_module!` documentation to see the appropriate usage, or rename it to an unreserved keyword.
|
||||
--> $DIR/on_initialize.rs:31:1
|
||||
|
|
||||
31 | reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: Invalid call fn name: `on_runtime_upgrade`, name is reserved and doesn't match expected signature, please refer to `decl_module!` documentation to see the appropriate usage, or rename it to an unreserved keyword.
|
||||
--> $DIR/on_initialize.rs:31:1
|
||||
|
|
||||
31 | reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: Invalid call fn name: `offchain_worker`, name is reserved and doesn't match expected signature, please refer to `decl_module!` documentation to see the appropriate usage, or rename it to an unreserved keyword.
|
||||
--> $DIR/on_initialize.rs:31:1
|
||||
|
|
||||
31 | reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: Invalid call fn name: `deposit_event`, name is reserved and doesn't match expected signature, please refer to `decl_module!` documentation to see the appropriate usage, or rename it to an unreserved keyword.
|
||||
--> $DIR/on_initialize.rs:31:1
|
||||
|
|
||||
31 | reserved!(on_finalize on_initialize on_runtime_upgrade offchain_worker deposit_event);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -2,4 +2,6 @@ error: No api implementation given!
|
||||
--> $DIR/empty_impl_runtime_apis_call.rs:17:1
|
||||
|
|
||||
17 | sp_api::impl_runtime_apis! {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -21,20 +21,11 @@ error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for tr
|
||||
| |_- type in trait
|
||||
16 |
|
||||
17 | sp_api::impl_runtime_apis! {
|
||||
| -^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| _expected `u64`, found struct `std::string::String`
|
||||
| |
|
||||
18 | | impl self::Api<Block> for Runtime {
|
||||
19 | | fn test(data: String) {}
|
||||
20 | | }
|
||||
... |
|
||||
32 | | }
|
||||
33 | | }
|
||||
| |_- in this macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found struct `std::string::String`
|
||||
|
|
||||
= note: expected fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::BlockId<__SR_API_BLOCK__>, sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::ExecutionContext, std::option::Option<u64>, std::vec::Vec<_>) -> std::result::Result<_, _>`
|
||||
found fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::BlockId<__SR_API_BLOCK__>, sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::ExecutionContext, std::option::Option<std::string::String>, std::vec::Vec<_>) -> std::result::Result<_, _>`
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/impl_incorrect_method_signature.rs:17:1
|
||||
@@ -46,10 +37,9 @@ error[E0308]: mismatched types
|
||||
... |
|
||||
32 | | }
|
||||
33 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `u64`, found struct `std::string::String`
|
||||
| in this macro invocation
|
||||
| |_^ expected `u64`, found struct `std::string::String`
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/impl_incorrect_method_signature.rs:19:11
|
||||
|
||||
@@ -14,10 +14,7 @@ error[E0277]: the trait bound `u32: std::convert::From<std::string::String>` is
|
||||
... |
|
||||
26 | | }
|
||||
27 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_the trait `std::convert::From<std::string::String>` is not implemented for `u32`
|
||||
| in this macro invocation
|
||||
| |_^ the trait `std::convert::From<std::string::String>` is not implemented for `u32`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<u32 as std::convert::From<bool>>
|
||||
@@ -25,3 +22,4 @@ error[E0277]: the trait bound `u32: std::convert::From<std::string::String>` is
|
||||
<u32 as std::convert::From<h2::frame::reason::Reason>>
|
||||
<u32 as std::convert::From<h2::frame::reason::Reason>>
|
||||
and 18 others
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -22,20 +22,11 @@ error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for tr
|
||||
| |_- type in trait
|
||||
...
|
||||
12 | sp_api::mock_impl_runtime_apis! {
|
||||
| -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| _expected `u64`, found `()`
|
||||
| |
|
||||
13 | | impl Api<Block> for MockApi {
|
||||
14 | | fn test(self, data: u64) {}
|
||||
15 | |
|
||||
16 | | fn test2(&mut self, data: u64) {}
|
||||
17 | | }
|
||||
18 | | }
|
||||
| |_- in this macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `()`
|
||||
|
|
||||
= note: expected fn pointer `fn(&MockApi, &sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, substrate_test_runtime::Extrinsic>>, sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::ExecutionContext, std::option::Option<u64>, std::vec::Vec<_>) -> std::result::Result<_, _>`
|
||||
found fn pointer `fn(&MockApi, &sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, substrate_test_runtime::Extrinsic>>, sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::ExecutionContext, std::option::Option<()>, std::vec::Vec<_>) -> std::result::Result<_, _>`
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0053]: method `Api_test2_runtime_api_impl` has an incompatible type for trait
|
||||
--> $DIR/mock_only_self_reference.rs:12:1
|
||||
@@ -49,17 +40,8 @@ error[E0053]: method `Api_test2_runtime_api_impl` has an incompatible type for t
|
||||
| |_- type in trait
|
||||
...
|
||||
12 | sp_api::mock_impl_runtime_apis! {
|
||||
| -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| _expected `u64`, found `()`
|
||||
| |
|
||||
13 | | impl Api<Block> for MockApi {
|
||||
14 | | fn test(self, data: u64) {}
|
||||
15 | |
|
||||
16 | | fn test2(&mut self, data: u64) {}
|
||||
17 | | }
|
||||
18 | | }
|
||||
| |_- in this macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `()`
|
||||
|
|
||||
= note: expected fn pointer `fn(&MockApi, &sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, substrate_test_runtime::Extrinsic>>, sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::ExecutionContext, std::option::Option<u64>, std::vec::Vec<_>) -> std::result::Result<_, _>`
|
||||
found fn pointer `fn(&MockApi, &sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, substrate_test_runtime::Extrinsic>>, sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::ExecutionContext, std::option::Option<()>, std::vec::Vec<_>) -> std::result::Result<_, _>`
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
+5
-15
@@ -21,20 +21,11 @@ error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for tr
|
||||
| |_- type in trait
|
||||
16 |
|
||||
17 | sp_api::impl_runtime_apis! {
|
||||
| -^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| _expected `u64`, found `&u64`
|
||||
| |
|
||||
18 | | impl self::Api<Block> for Runtime {
|
||||
19 | | fn test(data: &u64) {
|
||||
20 | | unimplemented!()
|
||||
... |
|
||||
34 | | }
|
||||
35 | | }
|
||||
| |_- in this macro invocation
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `&u64`
|
||||
|
|
||||
= note: expected fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::BlockId<__SR_API_BLOCK__>, sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::ExecutionContext, std::option::Option<u64>, std::vec::Vec<_>) -> std::result::Result<_, _>`
|
||||
found fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::BlockId<__SR_API_BLOCK__>, sp_api_hidden_includes_DECL_RUNTIME_APIS::sp_api::ExecutionContext, std::option::Option<&u64>, std::vec::Vec<_>) -> std::result::Result<_, _>`
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/type_reference_in_impl_runtime_apis_call.rs:17:1
|
||||
@@ -46,10 +37,9 @@ error[E0308]: mismatched types
|
||||
... |
|
||||
34 | | }
|
||||
35 | | }
|
||||
| | ^
|
||||
| | |
|
||||
| |_expected `u64`, found `&u64`
|
||||
| in this macro invocation
|
||||
| |_^ expected `u64`, found `&u64`
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/type_reference_in_impl_runtime_apis_call.rs:19:11
|
||||
|
||||
@@ -31,7 +31,10 @@ use std::{collections::HashSet, sync::{Arc, Mutex}};
|
||||
|
||||
type TestExternalities = sp_state_machine::TestExternalities<sp_runtime::traits::BlakeTwo256, u64>;
|
||||
|
||||
fn call_wasm_method<HF: HostFunctionsT>(binary: &[u8], method: &str) -> TestExternalities {
|
||||
fn call_wasm_method_with_result<HF: HostFunctionsT>(
|
||||
binary: &[u8],
|
||||
method: &str,
|
||||
) -> Result<TestExternalities, String> {
|
||||
let mut ext = TestExternalities::default();
|
||||
let mut ext_ext = ext.ext();
|
||||
let mut host_functions = HF::host_functions();
|
||||
@@ -50,9 +53,13 @@ fn call_wasm_method<HF: HostFunctionsT>(binary: &[u8], method: &str) -> TestExte
|
||||
&[],
|
||||
&mut ext_ext,
|
||||
sp_core::traits::MissingHostFunctions::Disallow,
|
||||
).expect(&format!("Executes `{}`", method));
|
||||
).map_err(|e| format!("Failed to execute `{}`: {}", method, e))?;
|
||||
|
||||
ext
|
||||
Ok(ext)
|
||||
}
|
||||
|
||||
fn call_wasm_method<HF: HostFunctionsT>(binary: &[u8], method: &str) -> TestExternalities {
|
||||
call_wasm_method_with_result::<HF>(binary, method).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -94,20 +101,15 @@ fn test_return_input_public_key() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(
|
||||
expected = "Instantiation: Export ext_test_api_return_input_version_1 not found"
|
||||
)]
|
||||
fn host_function_not_found() {
|
||||
call_wasm_method::<()>(&WASM_BINARY[..], "test_return_data");
|
||||
let err = call_wasm_method_with_result::<()>(&WASM_BINARY[..], "test_return_data").unwrap_err();
|
||||
|
||||
assert!(err.contains("Instantiation: Export "));
|
||||
assert!(err.contains(" not found"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(
|
||||
expected =
|
||||
"Executes `test_invalid_utf8_data_should_return_an_error`: \
|
||||
\"Trap: Trap { kind: Host(FunctionExecution(\\\"ext_test_api_invalid_utf8_data_version_1\\\", \
|
||||
\\\"Invalid utf8 data provided\\\")) }\""
|
||||
)]
|
||||
#[should_panic(expected = "Invalid utf8 data provided")]
|
||||
fn test_invalid_utf8_data_should_return_an_error() {
|
||||
call_wasm_method::<HostFunctions>(&WASM_BINARY[..], "test_invalid_utf8_data_should_return_an_error");
|
||||
}
|
||||
|
||||
@@ -3,3 +3,5 @@ error: `PassByEnum` only supports enums as input type.
|
||||
|
|
||||
3 | #[derive(PassByEnum)]
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -3,3 +3,5 @@ error: `PassByEnum` only supports unit variants.
|
||||
|
|
||||
3 | #[derive(PassByEnum)]
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -3,3 +3,5 @@ error: Only newtype/one field structs are supported by `PassByInner`!
|
||||
|
|
||||
3 | #[derive(PassByInner)]
|
||||
| ^^^^^^^^^^^
|
||||
|
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
Reference in New Issue
Block a user