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,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.
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::pallet_macros::*;
#[pallet_section]
mod storages {
#[pallet::storage]
pub type MyStorageMap<T: Config> = StorageMap<_, _, u32, u64>;
}
#[import_section(storages)]
pub mod pallet {
}
fn main() {
}
@@ -0,0 +1,5 @@
error: `#[import_section]` can only be applied to a valid pallet module
--> tests/split_ui/import_without_pallet.rs:29:9
|
29 | pub mod pallet {
| ^^^^^^
@@ -0,0 +1,46 @@
// 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.
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::pallet_macros::*;
pub use pallet::*;
#[import_section(storages_dev)]
#[frame_support::pallet(dev_mode)]
pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config {}
#[pallet::call]
impl<T: Config> Pallet<T> {
pub fn my_call(_origin: OriginFor<T>) -> DispatchResult {
MyStorageMap::<T>::insert(1, 2);
Ok(())
}
}
}
fn main() {
}
@@ -0,0 +1,13 @@
error[E0432]: unresolved import `pallet`
--> tests/split_ui/no_section_found.rs:22:9
|
22 | pub use pallet::*;
| ^^^^^^ help: a similar path exists: `test_pallet::pallet`
error: cannot find macro `__export_tokens_tt_storages_dev` in this scope
--> tests/split_ui/no_section_found.rs:24:1
|
24 | #[import_section(storages_dev)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `frame_support::macro_magic::forward_tokens` (in Nightly builds, run with -Z macro-backtrace for more info)
@@ -0,0 +1,70 @@
// 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 frame_support::pallet_macros::pallet_section;
#[pallet_section]
mod call {
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
pub fn noop0(origin: OriginFor<T>) -> DispatchResult {
ensure_signed(origin)?;
Ok(())
}
#[pallet::call_index(1)]
pub fn noop1(origin: OriginFor<T>, _x: u64) -> DispatchResult {
ensure_signed(origin)?;
Ok(())
}
#[pallet::call_index(2)]
pub fn noop2(origin: OriginFor<T>, _x: u64, _y: u64) -> DispatchResult {
ensure_signed(origin)?;
Ok(())
}
#[pallet::call_index(3)]
#[pallet::feeless_if(|_origin: &OriginFor<T>| -> bool { true })]
pub fn noop_feeless0(origin: OriginFor<T>) -> DispatchResult {
ensure_signed(origin)?;
Ok(())
}
#[pallet::call_index(4)]
#[pallet::feeless_if(|_origin: &OriginFor<T>, x: &u64| -> bool { *x == 1 })]
pub fn noop_feeless1(origin: OriginFor<T>, _x: u64) -> DispatchResult {
ensure_signed(origin)?;
Ok(())
}
#[pallet::call_index(5)]
#[pallet::feeless_if(|_origin: &OriginFor<T>, x: &u64, y: &u64| -> bool { *x == *y })]
pub fn noop_feeless2(origin: OriginFor<T>, _x: u64, _y: u64) -> DispatchResult {
ensure_signed(origin)?;
Ok(())
}
#[pallet::call_index(6)]
#[pallet::authorize(|_source, _x, _y| Ok(Default::default()))]
pub fn noop_authorize(origin: OriginFor<T>, _x: u64, _y: u64) -> DispatchResult {
ensure_authorized(origin)?;
Ok(())
}
}
}
@@ -0,0 +1,36 @@
// 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 frame_support::pallet_macros::import_section;
mod call;
#[import_section(call::call)]
#[frame_support::pallet(dev_mode)]
pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config {}
}
fn main() {
}
@@ -0,0 +1,49 @@
// 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 frame_support::pallet_macros::import_section;
mod storage;
#[import_section(storage::storage)]
#[frame_support::pallet(dev_mode)]
pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
const STORAGE_VERSION: StorageVersion = StorageVersion::new(8);
#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config {}
#[pallet::call]
impl<T: Config> Pallet<T> {
pub fn increment_value(_origin: OriginFor<T>) -> DispatchResult {
Value::<T>::mutate(|v| {
v.saturating_add(1)
});
Ok(())
}
}
}
fn main() {
}
@@ -0,0 +1,57 @@
// 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.
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::pallet_macros::*;
pub use pallet::*;
#[pallet_section]
mod events {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
SomethingDone,
}
}
#[import_section(events)]
#[frame_support::pallet(dev_mode)]
pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
}
#[pallet::call]
impl<T: Config> Pallet<T> {
pub fn my_call(_origin: OriginFor<T>) -> DispatchResult {
Self::deposit_event(Event::SomethingDone);
Ok(())
}
}
}
fn main() {}
@@ -0,0 +1,78 @@
// 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.
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::pallet_macros::*;
pub use pallet::*;
mod first {
use super::*;
#[pallet_section]
mod section {
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
SomethingDone,
}
}
}
mod second {
use super::*;
#[pallet_section(section2)]
mod section {
#[pallet::error]
pub enum Error<T> {
NoneValue,
}
}
}
#[import_section(first::section)]
#[import_section(second::section2)]
#[frame_support::pallet(dev_mode)]
pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config {
#[allow(deprecated)]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
}
#[pallet::call]
impl<T: Config> Pallet<T> {
pub fn my_call(_origin: OriginFor<T>) -> DispatchResult {
Self::deposit_event(Event::SomethingDone);
Ok(())
}
pub fn my_call_2(_origin: OriginFor<T>) -> DispatchResult {
return Err(Error::<T>::NoneValue.into())
}
}
}
fn main() {}
@@ -0,0 +1,27 @@
// 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 frame_support::pallet_macros::pallet_section;
#[pallet_section]
mod storage {
#[pallet::storage]
pub type Value<T> = StorageValue<_, u32, ValueQuery>;
#[pallet::storage]
pub type Map<T> = StorageMap<_, _, u32, u32, ValueQuery>;
}
@@ -0,0 +1,51 @@
// 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.
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::pallet_macros::*;
pub use pallet::*;
#[pallet_section]
mod storages {
#[pallet::storage]
pub type MyStorageMap<T: Config> = StorageMap<_, _, u32, u64>;
}
#[frame_support::pallet(dev_mode)]
pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pallet::config]
pub trait Config: frame_system::Config {}
#[pallet::call]
impl<T: Config> Pallet<T> {
pub fn my_call(_origin: OriginFor<T>) -> DispatchResult {
MyStorageMap::<T>::insert(1, 2);
Ok(())
}
}
}
fn main() {
}
@@ -0,0 +1,8 @@
error[E0433]: failed to resolve: use of undeclared type `MyStorageMap`
--> tests/split_ui/section_not_imported.rs:44:4
|
44 | MyStorageMap::<T>::insert(1, 2);
| ^^^^^^^^^^^^
| |
| use of undeclared type `MyStorageMap`
| help: a struct with a similar name exists: `StorageMap`