Add missing licenses and tune the scanning workflow (#1288)

* Add missing Cumulus licenses

* Typo

* Add missing Substrate licenses

* Single job checking the sub-repos in steps

* Remove dates

* Remove dates

* Add missing (C)

* Update FRAME UI tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update more UI tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Przemek Rzad
2023-08-30 14:45:49 +02:00
committed by GitHub
parent 7768b77d53
commit bfb241d7f3
1046 changed files with 6695 additions and 1891 deletions
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
sp_api::decl_runtime_apis! {
pub trait Api {
fn test(&self);
@@ -1,5 +1,5 @@
error: `self` as argument not supported.
--> $DIR/adding_self_parameter.rs:3:11
|
3 | fn test(&self);
| ^
--> tests/ui/adding_self_parameter.rs:20:11
|
20 | fn test(&self);
| ^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/// The declaration of the `Runtime` type is done by the `construct_runtime!` macro in a real
/// runtime.
struct Runtime {}
@@ -1,6 +1,6 @@
error: There is no 'default' method with this name (without `changed_in` attribute).
The 'default' method is used to call into the latest implementation.
--> tests/ui/changed_in_no_default_method.rs:9:6
|
9 | fn test(data: u64);
| ^^^^
--> tests/ui/changed_in_no_default_method.rs:26:6
|
26 | fn test(data: u64);
| ^^^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/// The declaration of the `Runtime` type is done by the `construct_runtime!` macro in a real
/// runtime.
struct Runtime {}
@@ -1,5 +1,5 @@
error: `changed_in` version can not be greater than the `api_version`
--> tests/ui/changed_in_unknown_version.rs:8:3
|
8 | fn test(data: u64);
| ^^
--> tests/ui/changed_in_unknown_version.rs:25:3
|
25 | fn test(data: u64);
| ^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
sp_api::decl_runtime_apis! {
pub trait Api<Block: BlockT> {
fn test();
@@ -1,11 +1,11 @@
error: `Block: BlockT` generic parameter will be added automatically by the `decl_runtime_apis!` macro! If you try to use a different trait than the substrate `Block` trait, please rename it locally.
--> $DIR/declaring_old_block.rs:2:23
|
2 | pub trait Api<Block: BlockT> {
| ^^^^^^
--> tests/ui/declaring_old_block.rs:19:23
|
19 | pub trait Api<Block: BlockT> {
| ^^^^^^
error: `Block: BlockT` generic parameter will be added automatically by the `decl_runtime_apis!` macro!
--> $DIR/declaring_old_block.rs:2:16
|
2 | pub trait Api<Block: BlockT> {
| ^^^^^
--> tests/ui/declaring_old_block.rs:19:16
|
19 | pub trait Api<Block: BlockT> {
| ^^^^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
sp_api::decl_runtime_apis! {
pub trait Api<B: BlockT> {
fn test();
@@ -1,5 +1,5 @@
error: `Block: BlockT` generic parameter will be added automatically by the `decl_runtime_apis!` macro! If you try to use a different trait than the substrate `Block` trait, please rename it locally.
--> $DIR/declaring_own_block_with_different_name.rs:2:19
|
2 | pub trait Api<B: BlockT> {
| ^^^^^^
--> tests/ui/declaring_own_block_with_different_name.rs:19:19
|
19 | pub trait Api<B: BlockT> {
| ^^^^^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/// The declaration of the `Runtime` type is done by the `construct_runtime!` macro in a real
/// runtime.
struct Runtime {}
@@ -1,7 +1,7 @@
error: No api implementation given!
--> tests/ui/empty_impl_runtime_apis_call.rs:11:1
--> tests/ui/empty_impl_runtime_apis_call.rs:28:1
|
11 | sp_api::impl_runtime_apis! {}
28 | sp_api::impl_runtime_apis! {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `sp_api::impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use sp_runtime::traits::Block as BlockT;
use substrate_test_runtime_client::runtime::Block;
@@ -1,35 +1,35 @@
error[E0053]: method `test` has an incompatible type for trait
--> tests/ui/impl_incorrect_method_signature.rs:16:17
--> tests/ui/impl_incorrect_method_signature.rs:33:17
|
16 | fn test(data: String) {}
33 | fn test(data: String) {}
| ^^^^^^
| |
| expected `u64`, found `std::string::String`
| help: change the parameter type to match the trait: `u64`
|
note: type in trait
--> tests/ui/impl_incorrect_method_signature.rs:10:17
--> tests/ui/impl_incorrect_method_signature.rs:27:17
|
10 | fn test(data: u64);
27 | fn test(data: u64);
| ^^^
= note: expected signature `fn(u64)`
found signature `fn(std::string::String)`
error[E0308]: mismatched types
--> tests/ui/impl_incorrect_method_signature.rs:16:11
--> tests/ui/impl_incorrect_method_signature.rs:33:11
|
14 | / sp_api::impl_runtime_apis! {
15 | | impl self::Api<Block> for Runtime {
16 | | fn test(data: String) {}
31 | / sp_api::impl_runtime_apis! {
32 | | impl self::Api<Block> for Runtime {
33 | | fn test(data: String) {}
| | ^^^^ expected `u64`, found `String`
17 | | }
34 | | }
... |
29 | | }
30 | | }
46 | | }
47 | | }
| |_- arguments to this function are incorrect
|
note: associated function defined here
--> tests/ui/impl_incorrect_method_signature.rs:10:6
--> tests/ui/impl_incorrect_method_signature.rs:27:6
|
10 | fn test(data: u64);
27 | fn test(data: u64);
| ^^^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use sp_runtime::traits::Block as BlockT;
use substrate_test_runtime_client::runtime::Block;
@@ -1,8 +1,8 @@
error[E0405]: cannot find trait `ApiV4` in module `self::runtime_decl_for_api`
--> tests/ui/impl_missing_version.rs:18:13
--> tests/ui/impl_missing_version.rs:35:13
|
8 | pub trait Api {
25 | pub trait Api {
| ------------- similarly named trait `ApiV2` defined here
...
18 | impl self::Api<Block> for Runtime {
35 | impl self::Api<Block> for Runtime {
| ^^^ help: a trait with a similar name exists: `ApiV2`
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/// The declaration of the `Runtime` type is done by the `construct_runtime!` macro in a real
/// runtime.
struct Runtime {}
@@ -1,5 +1,5 @@
error: Two traits with the same name detected! The trait name is used to generate its ID. Please rename one trait at the declaration!
--> tests/ui/impl_two_traits_with_same_name.rs:24:15
--> tests/ui/impl_two_traits_with_same_name.rs:41:15
|
24 | impl second::Api<Block> for Runtime {
41 | impl second::Api<Block> for Runtime {
| ^^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
sp_api::decl_runtime_apis! {
#[api_version]
pub trait Api {
@@ -1,5 +1,5 @@
error: Unexpected `api_version` attribute. The supported format is `api_version(1)`
--> tests/ui/invalid_api_version_1.rs:2:2
|
2 | #[api_version]
| ^
--> tests/ui/invalid_api_version_1.rs:19:2
|
19 | #[api_version]
| ^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
sp_api::decl_runtime_apis! {
#[api_version("1")]
pub trait Api {
@@ -1,5 +1,5 @@
error: Unexpected `api_version` attribute. The supported format is `api_version(1)`
--> tests/ui/invalid_api_version_2.rs:2:2
|
2 | #[api_version("1")]
| ^
--> tests/ui/invalid_api_version_2.rs:19:2
|
19 | #[api_version("1")]
| ^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
sp_api::decl_runtime_apis! {
#[api_version()]
pub trait Api {
@@ -1,5 +1,5 @@
error: Unexpected `api_version` attribute. The supported format is `api_version(1)`
--> tests/ui/invalid_api_version_3.rs:2:2
|
2 | #[api_version()]
| ^
--> tests/ui/invalid_api_version_3.rs:19:2
|
19 | #[api_version()]
| ^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
sp_api::decl_runtime_apis! {
pub trait Api {
#[api_version("1")]
@@ -1,5 +1,5 @@
error: Unexpected `api_version` attribute. The supported format is `api_version(1)`
--> tests/ui/invalid_api_version_4.rs:3:3
|
3 | #[api_version("1")]
| ^
--> tests/ui/invalid_api_version_4.rs:20:3
|
20 | #[api_version("1")]
| ^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
sp_api::decl_runtime_apis! {
#[api_version(2)]
pub trait Api {
@@ -1,11 +1,11 @@
error: Method version `1` is older than (or equal to) trait version `2`.Methods can't define versions older than the trait version.
--> tests/ui/method_ver_lower_than_trait_ver.rs:4:3
|
4 | #[api_version(1)]
| ^
--> tests/ui/method_ver_lower_than_trait_ver.rs:21:3
|
21 | #[api_version(1)]
| ^
error: Trait version is set here.
--> tests/ui/method_ver_lower_than_trait_ver.rs:2:2
|
2 | #[api_version(2)]
| ^
--> tests/ui/method_ver_lower_than_trait_ver.rs:19:2
|
19 | #[api_version(2)]
| ^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/// The declaration of the `Runtime` type is done by the `construct_runtime!` macro in a real
/// runtime.
struct Runtime {}
@@ -1,5 +1,5 @@
error: Missing `Block` generic parameter.
--> tests/ui/missing_block_generic_parameter.rs:12:13
--> tests/ui/missing_block_generic_parameter.rs:29:13
|
12 | impl self::Api for Runtime {
29 | impl self::Api for Runtime {
| ^^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/// The declaration of the `Runtime` type is done by the `construct_runtime!` macro in a real
/// runtime.
struct Runtime {}
@@ -1,5 +1,5 @@
error: The implemented trait has to be referenced with a path, e.g. `impl client::Core for Runtime`.
--> tests/ui/missing_path_for_trait.rs:12:7
--> tests/ui/missing_path_for_trait.rs:29:7
|
12 | impl Api<Block> for Runtime {
29 | impl Api<Block> for Runtime {
| ^^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use sp_runtime::traits::Block as BlockT;
use substrate_test_runtime_client::runtime::Block;
@@ -1,8 +1,8 @@
error[E0046]: not all trait items implemented, missing: `test3`
--> tests/ui/missing_versioned_method.rs:18:2
--> tests/ui/missing_versioned_method.rs:35:2
|
12 | fn test3();
29 | fn test3();
| ----------- `test3` from trait
...
18 | impl self::Api<Block> for Runtime {
35 | impl self::Api<Block> for Runtime {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `test3` in implementation
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use sp_runtime::traits::Block as BlockT;
use substrate_test_runtime_client::runtime::Block;
@@ -1,8 +1,8 @@
error[E0046]: not all trait items implemented, missing: `test3`
--> tests/ui/missing_versioned_method_multiple_vers.rs:20:2
--> tests/ui/missing_versioned_method_multiple_vers.rs:37:2
|
12 | fn test3();
29 | fn test3();
| ----------- `test3` from trait
...
20 | impl self::Api<Block> for Runtime {
37 | impl self::Api<Block> for Runtime {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `test3` in implementation
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use substrate_test_runtime_client::runtime::Block;
use sp_api::ApiError;
@@ -1,13 +1,13 @@
error: `Hash` needs to be taken by value and not by reference!
--> tests/ui/mock_advanced_hash_by_reference.rs:12:1
--> tests/ui/mock_advanced_hash_by_reference.rs:29:1
|
12 | / sp_api::mock_impl_runtime_apis! {
13 | | impl Api<Block> for MockApi {
14 | | #[advanced]
15 | | fn test(&self, _: &Hash) -> Result<(), ApiError> {
29 | / sp_api::mock_impl_runtime_apis! {
30 | | impl Api<Block> for MockApi {
31 | | #[advanced]
32 | | fn test(&self, _: &Hash) -> Result<(), ApiError> {
... |
18 | | }
19 | | }
35 | | }
36 | | }
| |_^
|
= note: this error originates in the macro `sp_api::mock_impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use substrate_test_runtime_client::runtime::Block;
use sp_api::ApiError;
@@ -1,5 +1,5 @@
error: If using the `advanced` attribute, it is required that the function takes at least one argument, the `Hash`.
--> tests/ui/mock_advanced_missing_hash.rs:15:3
--> tests/ui/mock_advanced_missing_hash.rs:32:3
|
15 | fn test(&self) -> Result<(), ApiError> {
32 | fn test(&self) -> Result<(), ApiError> {
| ^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
struct Block2;
sp_api::decl_runtime_apis! {
@@ -1,11 +1,11 @@
error: Block type should be the same between all runtime apis.
--> $DIR/mock_only_one_block_type.rs:20:12
--> tests/ui/mock_only_one_block_type.rs:37:12
|
20 | impl Api2<Block2> for MockApi {
37 | impl Api2<Block2> for MockApi {
| ^^^^^^
error: First block type found here
--> $DIR/mock_only_one_block_type.rs:16:11
--> tests/ui/mock_only_one_block_type.rs:33:11
|
16 | impl Api<Block> for MockApi {
33 | impl Api<Block> for MockApi {
| ^^^^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
sp_api::decl_runtime_apis! {
pub trait Api {
fn test(data: u64);
@@ -1,11 +1,11 @@
error: Self type should not change between runtime apis
--> $DIR/mock_only_one_self_type.rs:19:23
--> tests/ui/mock_only_one_self_type.rs:36:23
|
19 | impl Api2<Block> for MockApi2 {
36 | impl Api2<Block> for MockApi2 {
| ^^^^^^^^
error: First self type found here
--> $DIR/mock_only_one_self_type.rs:15:22
--> tests/ui/mock_only_one_self_type.rs:32:22
|
15 | impl Api<Block> for MockApi {
32 | impl Api<Block> for MockApi {
| ^^^^^^^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use substrate_test_runtime_client::runtime::Block;
sp_api::decl_runtime_apis! {
@@ -1,50 +1,50 @@
error: Only `&self` is supported!
--> tests/ui/mock_only_self_reference.rs:14:11
--> tests/ui/mock_only_self_reference.rs:31:11
|
14 | fn test(self, data: u64) {}
31 | fn test(self, data: u64) {}
| ^^^^
error: Only `&self` is supported!
--> tests/ui/mock_only_self_reference.rs:16:12
--> tests/ui/mock_only_self_reference.rs:33:12
|
16 | fn test2(&mut self, data: u64) {}
33 | fn test2(&mut self, data: u64) {}
| ^
error[E0050]: method `test` has 2 parameters but the declaration in trait `Api::test` has 3
--> tests/ui/mock_only_self_reference.rs:12:1
--> tests/ui/mock_only_self_reference.rs:29:1
|
3 | / sp_api::decl_runtime_apis! {
4 | | pub trait Api {
5 | | fn test(data: u64);
20 | / sp_api::decl_runtime_apis! {
21 | | pub trait Api {
22 | | fn test(data: u64);
| |_________________________- trait requires 3 parameters
...
12 | / sp_api::mock_impl_runtime_apis! {
13 | | impl Api<Block> for MockApi {
14 | | fn test(self, data: u64) {}
15 | |
16 | | fn test2(&mut self, data: u64) {}
17 | | }
18 | | }
29 | / sp_api::mock_impl_runtime_apis! {
30 | | impl Api<Block> for MockApi {
31 | | fn test(self, data: u64) {}
32 | |
33 | | fn test2(&mut self, data: u64) {}
34 | | }
35 | | }
| |_^ expected 3 parameters, found 2
|
= note: this error originates in the macro `sp_api::mock_impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0050]: method `test2` has 2 parameters but the declaration in trait `Api::test2` has 3
--> tests/ui/mock_only_self_reference.rs:12:1
--> tests/ui/mock_only_self_reference.rs:29:1
|
3 | / sp_api::decl_runtime_apis! {
4 | | pub trait Api {
5 | | fn test(data: u64);
6 | | fn test2(data: u64);
20 | / sp_api::decl_runtime_apis! {
21 | | pub trait Api {
22 | | fn test(data: u64);
23 | | fn test2(data: u64);
| |__________________________- trait requires 3 parameters
...
12 | / sp_api::mock_impl_runtime_apis! {
13 | | impl Api<Block> for MockApi {
14 | | fn test(self, data: u64) {}
15 | |
16 | | fn test2(&mut self, data: u64) {}
17 | | }
18 | | }
29 | / sp_api::mock_impl_runtime_apis! {
30 | | impl Api<Block> for MockApi {
31 | | fn test(self, data: u64) {}
32 | |
33 | | fn test2(&mut self, data: u64) {}
34 | | }
35 | | }
| |_^ expected 3 parameters, found 2
|
= note: this error originates in the macro `sp_api::mock_impl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
sp_api::decl_runtime_apis! {
pub trait Api {
fn test() {
@@ -1,8 +1,8 @@
error: A runtime API function cannot have a default implementation!
--> $DIR/no_default_implementation.rs:3:13
|
3 | fn test() {
| ___________________^
4 | | println!("Hey, I'm a default implementation!");
5 | | }
| |_________^
--> tests/ui/no_default_implementation.rs:20:13
|
20 | fn test() {
| ___________________^
21 | | println!("Hey, I'm a default implementation!");
22 | | }
| |_________^
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use codec::{Decode, Encode};
use scale_info::TypeInfo;
use sp_runtime::traits::Block as BlockT;
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use sp_runtime::traits::Block as BlockT;
use substrate_test_runtime_client::runtime::Block;
@@ -1,3 +1,20 @@
// This file is part of Substrate.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use sp_runtime::traits::Block as BlockT;
use substrate_test_runtime_client::runtime::Block;
@@ -1,39 +1,39 @@
error[E0053]: method `test` has an incompatible type for trait
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:16:17
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:33:17
|
16 | fn test(data: &u64) {
33 | fn test(data: &u64) {
| ^^^^
| |
| expected `u64`, found `&u64`
| help: change the parameter type to match the trait: `u64`
|
note: type in trait
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:10:17
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:27:17
|
10 | fn test(data: u64);
27 | fn test(data: u64);
| ^^^
= note: expected signature `fn(u64)`
found signature `fn(&u64)`
error[E0308]: mismatched types
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:16:11
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:33:11
|
14 | / sp_api::impl_runtime_apis! {
15 | | impl self::Api<Block> for Runtime {
16 | | fn test(data: &u64) {
31 | / sp_api::impl_runtime_apis! {
32 | | impl self::Api<Block> for Runtime {
33 | | fn test(data: &u64) {
| | ^^^^^^^ expected `u64`, found `&u64`
17 | | unimplemented!()
34 | | unimplemented!()
... |
31 | | }
32 | | }
48 | | }
49 | | }
| |_- arguments to this function are incorrect
|
note: associated function defined here
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:10:6
--> tests/ui/type_reference_in_impl_runtime_apis_call.rs:27:6
|
10 | fn test(data: u64);
27 | fn test(data: u64);
| ^^^^
help: consider removing the borrow
|
16 | fn test(data: &u64) {
33 | fn test(data: &u64) {
|