feat: initialize Kurdistan SDK - independent fork of Polkadot SDK

This commit is contained in:
2025-12-13 15:44:15 +03:00
commit e4778b4576
6838 changed files with 1847450 additions and 0 deletions
@@ -0,0 +1,29 @@
// 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.
mod test {
#![allow(unexpected_cfgs)]
use sp_runtime_interface::runtime_interface;
#[runtime_interface]
trait Test {
fn test(&self, a: Option<u8>) -> Option<u8> {}
}
}
fn main() {}
@@ -0,0 +1,154 @@
error[E0277]: the trait bound `Option<u8>: RIType` is not satisfied
--> tests/ui/improperly_wrapped_ri_type.rs:23:2
|
23 | #[runtime_interface]
| ^^^^^^^^^^^^^^^^^^^^ the trait `RIType` is not implemented for `Option<u8>`
|
= help: the following other types implement trait `RIType`:
AllocateAndReturnByCodec<T>
AllocateAndReturnFatPointer<T>
AllocateAndReturnPointer<T, N>
PassAs<T, U>
PassFatPointerAndDecode<T>
PassFatPointerAndDecodeSlice<T>
PassFatPointerAndRead<T>
PassFatPointerAndReadWrite<T>
and $N others
= note: this error originates in the attribute macro `runtime_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Option<u8>: RIType` is not satisfied
--> tests/ui/improperly_wrapped_ri_type.rs:23:2
|
23 | #[runtime_interface]
| ^^^^^^^^^^^^^^^^^^^^ the trait `RIType` is not implemented for `Option<u8>`
|
= help: the following other types implement trait `RIType`:
AllocateAndReturnByCodec<T>
AllocateAndReturnFatPointer<T>
AllocateAndReturnPointer<T, N>
PassAs<T, U>
PassFatPointerAndDecode<T>
PassFatPointerAndDecodeSlice<T>
PassFatPointerAndRead<T>
PassFatPointerAndReadWrite<T>
and $N others
error[E0277]: the trait bound `Option<u8>: RIType` is not satisfied
--> tests/ui/improperly_wrapped_ri_type.rs:25:24
|
25 | fn test(&self, a: Option<u8>) -> Option<u8> {}
| ^ the trait `RIType` is not implemented for `Option<u8>`
|
= help: the following other types implement trait `RIType`:
AllocateAndReturnByCodec<T>
AllocateAndReturnFatPointer<T>
AllocateAndReturnPointer<T, N>
PassAs<T, U>
PassFatPointerAndDecode<T>
PassFatPointerAndDecodeSlice<T>
PassFatPointerAndRead<T>
PassFatPointerAndReadWrite<T>
and $N others
error[E0277]: the trait bound `Option<u8>: FromFFIValue<'_>` is not satisfied
--> tests/ui/improperly_wrapped_ri_type.rs:25:27
|
25 | fn test(&self, a: Option<u8>) -> Option<u8> {}
| ^^^^^^^^^^ the trait `FromFFIValue<'_>` is not implemented for `Option<u8>`
|
= help: the following other types implement trait `FromFFIValue<'a>`:
PassAs<T, U>
PassFatPointerAndDecode<T>
PassFatPointerAndDecodeSlice<&'a [T]>
PassFatPointerAndRead<&'a [u8]>
PassFatPointerAndRead<&'a str>
PassFatPointerAndRead<Vec<u8>>
PassFatPointerAndReadWrite<&'a mut [u8]>
PassPointerAndRead<&'a T, N>
and $N others
error[E0277]: the trait bound `Option<u8>: IntoFFIValue` is not satisfied
--> tests/ui/improperly_wrapped_ri_type.rs:25:42
|
25 | fn test(&self, a: Option<u8>) -> Option<u8> {}
| ^^^^^^^^^^ the trait `IntoFFIValue` is not implemented for `Option<u8>`
|
= help: the following other types implement trait `IntoFFIValue`:
AllocateAndReturnByCodec<T>
AllocateAndReturnFatPointer<T>
AllocateAndReturnPointer<T, N>
ReturnAs<T, U>
bool
i16
i32
i64
and $N others
error[E0277]: the trait bound `Option<u8>: FromFFIValue<'_>` is not satisfied
--> tests/ui/improperly_wrapped_ri_type.rs:25:24
|
25 | fn test(&self, a: Option<u8>) -> Option<u8> {}
| ^ the trait `FromFFIValue<'_>` is not implemented for `Option<u8>`
|
= help: the following other types implement trait `FromFFIValue<'a>`:
PassAs<T, U>
PassFatPointerAndDecode<T>
PassFatPointerAndDecodeSlice<&'a [T]>
PassFatPointerAndRead<&'a [u8]>
PassFatPointerAndRead<&'a str>
PassFatPointerAndRead<Vec<u8>>
PassFatPointerAndReadWrite<&'a mut [u8]>
PassPointerAndRead<&'a T, N>
and $N others
error[E0277]: the trait bound `Option<u8>: FromFFIValue<'_>` is not satisfied
--> tests/ui/improperly_wrapped_ri_type.rs:23:2
|
23 | #[runtime_interface]
| ^^^^^^^^^^^^^^^^^^^^ the trait `FromFFIValue<'_>` is not implemented for `Option<u8>`
|
= help: the following other types implement trait `FromFFIValue<'a>`:
PassAs<T, U>
PassFatPointerAndDecode<T>
PassFatPointerAndDecodeSlice<&'a [T]>
PassFatPointerAndRead<&'a [u8]>
PassFatPointerAndRead<&'a str>
PassFatPointerAndRead<Vec<u8>>
PassFatPointerAndReadWrite<&'a mut [u8]>
PassPointerAndRead<&'a T, N>
and $N others
= note: this error originates in the attribute macro `runtime_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Option<u8>: RIType` is not satisfied
--> tests/ui/improperly_wrapped_ri_type.rs:25:27
|
25 | fn test(&self, a: Option<u8>) -> Option<u8> {}
| ^^^^^^^^^^ the trait `RIType` is not implemented for `Option<u8>`
|
= help: the following other types implement trait `RIType`:
AllocateAndReturnByCodec<T>
AllocateAndReturnFatPointer<T>
AllocateAndReturnPointer<T, N>
PassAs<T, U>
PassFatPointerAndDecode<T>
PassFatPointerAndDecodeSlice<T>
PassFatPointerAndRead<T>
PassFatPointerAndReadWrite<T>
and $N others
error[E0277]: the trait bound `Option<u8>: RIType` is not satisfied
--> tests/ui/improperly_wrapped_ri_type.rs:25:42
|
25 | fn test(&self, a: Option<u8>) -> Option<u8> {}
| ^^^^^^^^^^ the trait `RIType` is not implemented for `Option<u8>`
|
= help: the following other types implement trait `RIType`:
AllocateAndReturnByCodec<T>
AllocateAndReturnFatPointer<T>
AllocateAndReturnPointer<T, N>
PassAs<T, U>
PassFatPointerAndDecode<T>
PassFatPointerAndDecodeSlice<T>
PassFatPointerAndRead<T>
PassFatPointerAndReadWrite<T>
and $N others
@@ -0,0 +1,28 @@
// 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_interface::runtime_interface;
#[runtime_interface]
trait Test {
#[version(2)]
fn test() { }
#[version(2)]
fn test() { }
}
fn main() {}
@@ -0,0 +1,11 @@
error: Duplicated version attribute
--> tests/ui/no_duplicate_versions.rs:24:2
|
24 | #[version(2)]
| ^
error: Previous version with the same number defined here
--> tests/ui/no_duplicate_versions.rs:22:2
|
22 | #[version(2)]
| ^
@@ -0,0 +1,39 @@
// 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.
// Due to https://github.com/dtolnay/trybuild/issues/302, the `substrate_runtime`
// cfg is also unexpected. This is a `trybuild` bug, and this part of error is not
// exposed to a real developer.
use sp_runtime_interface::runtime_interface;
#[runtime_interface]
trait Test {
fn foo() {}
#[cfg(feature = "bar-feature")]
fn bar() {}
#[cfg(not(feature = "bar-feature"))]
fn qux() {}
}
fn main() {
test::foo();
test::bar();
test::qux();
}
@@ -0,0 +1,100 @@
error[E0425]: cannot find function `bar` in module `test`
--> tests/ui/no_feature_gated_method.rs:37:8
|
37 | test::bar();
| ^^^ not found in `test`
|
note: found an item that was configured out
--> tests/ui/no_feature_gated_method.rs:29:5
|
29 | fn bar() {}
| ^^^
note: the item is gated behind the `bar-feature` feature
--> tests/ui/no_feature_gated_method.rs:28:8
|
28 | #[cfg(feature = "bar-feature")]
| ^^^^^^^^^^^^^^^^^^^^^^^
note: found an item that was configured out
--> tests/ui/no_feature_gated_method.rs:29:5
|
29 | fn bar() {}
| ^^^
note: the item is gated here
--> tests/ui/no_feature_gated_method.rs:24:1
|
24 | #[runtime_interface]
| ^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `runtime_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition name: `substrate_runtime`
--> tests/ui/no_feature_gated_method.rs:28:2
|
28 | #[cfg(feature = "bar-feature")]
| ^
|
= help: expected names are: `docsrs`, `feature`, and `test` and 31 more
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(substrate_runtime)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(substrate_runtime)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value: `bar-feature`
--> tests/ui/no_feature_gated_method.rs:28:8
|
28 | #[cfg(feature = "bar-feature")]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `disable_target_static_assertions`, and `std`
= help: consider adding `bar-feature` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `substrate_runtime`
--> tests/ui/no_feature_gated_method.rs:24:1
|
24 | #[runtime_interface]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: using a cfg inside a attribute macro will use the cfgs from the destination crate and not the ones from the defining crate
= help: try referring to `runtime_interface` crate for guidance on how handle this unexpected cfg
= help: the attribute macro `runtime_interface` may come from an old version of the `sp_runtime_interface_proc_macro` crate, try updating your dependency with `cargo update -p sp_runtime_interface_proc_macro`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the attribute macro `runtime_interface` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition name: `substrate_runtime`
--> tests/ui/no_feature_gated_method.rs:26:2
|
26 | fn foo() {}
| ^^
|
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(substrate_runtime)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(substrate_runtime)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `substrate_runtime`
--> tests/ui/no_feature_gated_method.rs:31:2
|
31 | #[cfg(not(feature = "bar-feature"))]
| ^
|
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(substrate_runtime)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(substrate_runtime)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition value: `bar-feature`
--> tests/ui/no_feature_gated_method.rs:31:12
|
31 | #[cfg(not(feature = "bar-feature"))]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: `default`, `disable_target_static_assertions`, and `std`
= help: consider adding `bar-feature` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
@@ -0,0 +1,34 @@
// 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_interface::runtime_interface;
#[runtime_interface]
trait Test {
#[version(1)]
fn test2() {}
#[version(2)]
fn test2() {}
#[version(3)]
fn test2() {}
fn test() { }
#[version(3)]
fn test() { }
}
fn main() {}
@@ -0,0 +1,5 @@
error: Unexpected version attribute: missing version '2' for this function
--> tests/ui/no_gaps_in_versions.rs:30:2
|
30 | #[version(3)]
| ^
@@ -0,0 +1,25 @@
// 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_interface::runtime_interface;
#[runtime_interface]
trait Test {
fn test<T>() {}
}
fn main() {}
@@ -0,0 +1,5 @@
error: Generic parameters not supported.
--> tests/ui/no_generic_parameters_method.rs:22:10
|
22 | fn test<T>() {}
| ^
@@ -0,0 +1,25 @@
// 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_interface::runtime_interface;
#[runtime_interface]
trait Test<T> {
fn test() {}
}
fn main() {}
@@ -0,0 +1,5 @@
error: Generic parameters not supported.
--> tests/ui/no_generic_parameters_trait.rs:21:12
|
21 | trait Test<T> {
| ^
@@ -0,0 +1,25 @@
// 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_interface::runtime_interface;
#[runtime_interface]
trait Test {
fn test();
}
fn main() {}
@@ -0,0 +1,5 @@
error: Methods need to have an implementation.
--> tests/ui/no_method_implementation.rs:22:2
|
22 | fn test();
| ^^
@@ -0,0 +1,29 @@
// 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_interface::runtime_interface;
#[runtime_interface]
trait Test {
fn foo() {}
#[version(2)]
#[cfg(feature = "foo-feature")]
fn foo() {}
}
fn main() {}
@@ -0,0 +1,5 @@
error: Conditional compilation is not supported for versioned functions
--> tests/ui/no_versioned_conditional_build.rs:24:2
|
24 | #[version(2)]
| ^
@@ -0,0 +1,25 @@
// 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_interface::runtime_interface;
#[runtime_interface]
trait Test {
fn test(self) {}
}
fn main() {}
@@ -0,0 +1,5 @@
error: Taking `Self` by value is not allowed.
--> tests/ui/take_self_by_value.rs:22:10
|
22 | fn test(self) {}
| ^^^^