From ece3f538997528a3778622091b72f811bc54ee24 Mon Sep 17 00:00:00 2001 From: Shreevatsa N Date: Fri, 23 Aug 2024 18:35:14 +0530 Subject: [PATCH] Runtimes & Identifier updates Signed-off-by: Shreevatsa N --- Cargo.toml | 1 + primitives/identifier/src/curi.rs | 8 ++++++++ runtimes/braid/Cargo.toml | 3 +++ runtimes/braid/src/lib.rs | 3 +++ runtimes/loom/Cargo.toml | 3 +++ runtimes/loom/src/lib.rs | 3 +++ runtimes/weave/Cargo.toml | 3 +++ runtimes/weave/src/lib.rs | 3 +++ 8 files changed, 27 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 6fc8de1d..4c4828d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -151,6 +151,7 @@ pallet-session-benchmarking = { path = 'pallets/session-benchmarking', default-f pallet-assets-runtime-api = { path = "runtimes/common/api/assets", default-features = false } pallet-did-runtime-api = { path = "runtimes/common/api/did", default-features = false } pallet-transaction-weight-runtime-api = { path = "runtimes/common/api/weight", default-features = false } +pallet-dedir = { path = "pallets/dedir", default-features = false } # substrate dependencies frame-benchmarking = { git = "https://github.com/dhiway/substrate-sdk", default-features = false, branch = "release-v1.13.0" } diff --git a/primitives/identifier/src/curi.rs b/primitives/identifier/src/curi.rs index 6d61daac..b999db63 100644 --- a/primitives/identifier/src/curi.rs +++ b/primitives/identifier/src/curi.rs @@ -43,6 +43,7 @@ pub enum IdentifierType { Asset, AssetInstance, Rating, + DeDir, } impl IdentifierType { @@ -55,6 +56,7 @@ impl IdentifierType { const IDENT_ASSET: u16 = 2348; const IDENT_RATING: u16 = 6077; const IDENT_ASSET_INSTANCE: u16 = 11380; + const IDENT_DEDIR: u16 = 9274; fn ident_value(&self) -> u16 { match self { @@ -67,6 +69,7 @@ impl IdentifierType { IdentifierType::Asset => Self::IDENT_ASSET, IdentifierType::AssetInstance => Self::IDENT_ASSET_INSTANCE, IdentifierType::Rating => Self::IDENT_RATING, + IdentifierType::DeDir => Self::IDENT_DEDIR, } } fn from_u16(value: u16) -> Option { @@ -80,6 +83,7 @@ impl IdentifierType { 2348 => Some(IdentifierType::Asset), 6077 => Some(IdentifierType::AssetInstance), 11380 => Some(IdentifierType::Rating), + 9274 => Some(IdentifierType::DeDir), _ => None, } } @@ -148,6 +152,10 @@ impl CordIdentifierType for Ss58Identifier { } impl Ss58Identifier { + pub fn as_bytes(&self) -> &[u8] { + &self.0 + } + /// Generate Blake2b Hash pub fn ss58hash(data: &[u8]) -> Blake2bResult { let mut context = Blake2b::new(64); diff --git a/runtimes/braid/Cargo.toml b/runtimes/braid/Cargo.toml index 7ad2d94f..bf8222eb 100644 --- a/runtimes/braid/Cargo.toml +++ b/runtimes/braid/Cargo.toml @@ -51,6 +51,7 @@ pallet-offences = { workspace = true } pallet-node-authorization = { workspace = true } pallet-network-score = { workspace = true } pallet-session-benchmarking = { workspace = true } +pallet-dedir = { workspace = true } # Internal runtime API (with default disabled) pallet-did-runtime-api = { workspace = true } @@ -165,6 +166,7 @@ std = [ "pallet-schema/std", "pallet-chain-space/std", "pallet-statement/std", + "pallet-dedir/std", "pallet-network-score/std", "pallet-network-membership/std", "pallet-runtime-upgrade/std", @@ -263,6 +265,7 @@ try-runtime = [ "pallet-network-membership/try-runtime", "pallet-runtime-upgrade/try-runtime", "pallet-remark/try-runtime", + "pallet-dedir/try-runtime", "cord-runtime-common/try-runtime", "authority-membership/try-runtime", "identifier/try-runtime", diff --git a/runtimes/braid/src/lib.rs b/runtimes/braid/src/lib.rs index 11b42270..8bfd3308 100644 --- a/runtimes/braid/src/lib.rs +++ b/runtimes/braid/src/lib.rs @@ -971,6 +971,9 @@ mod runtime { #[runtime::pallet_index(60)] pub type NetworkParameters = pallet_config; + #[runtime::pallet_index(61)] + pub type DeDir = pallet_dedir; + #[runtime::pallet_index(255)] pub type Sudo = pallet_sudo; } diff --git a/runtimes/loom/Cargo.toml b/runtimes/loom/Cargo.toml index 9a6a4141..4845d9bd 100644 --- a/runtimes/loom/Cargo.toml +++ b/runtimes/loom/Cargo.toml @@ -52,6 +52,7 @@ pallet-offences = { workspace = true } pallet-node-authorization = { workspace = true } pallet-network-score = { workspace = true } pallet-session-benchmarking = { workspace = true } +pallet-dedir = { workspace = true } # Internal runtime API (with default disabled) pallet-did-runtime-api = { workspace = true } @@ -180,6 +181,7 @@ std = [ "pallet-assets-runtime-api/std", "pallet-did-runtime-api/std", "pallet-node-authorization/std", + "pallet-dedir/std", "pallet-transaction-weight-runtime-api/std", "sp-runtime/std", "sp-staking/std", @@ -280,6 +282,7 @@ try-runtime = [ "pallet-network-membership/try-runtime", "pallet-runtime-upgrade/try-runtime", "pallet-remark/try-runtime", + "pallet-dedir/try-runtime", "cord-runtime-common/try-runtime", "authority-membership/try-runtime", "identifier/try-runtime", diff --git a/runtimes/loom/src/lib.rs b/runtimes/loom/src/lib.rs index a57d03a4..8a76ca18 100644 --- a/runtimes/loom/src/lib.rs +++ b/runtimes/loom/src/lib.rs @@ -1135,6 +1135,9 @@ mod runtime { #[runtime::pallet_index(60)] pub type NetworkParameters = pallet_config; + #[runtime::pallet_index(61)] + pub type DeDir = pallet_dedir; + #[runtime::pallet_index(254)] pub type RootTesting = pallet_root_testing; diff --git a/runtimes/weave/Cargo.toml b/runtimes/weave/Cargo.toml index 09414223..bfb6f0a2 100644 --- a/runtimes/weave/Cargo.toml +++ b/runtimes/weave/Cargo.toml @@ -52,6 +52,7 @@ pallet-offences = { workspace = true } pallet-node-authorization = { workspace = true } pallet-network-score = { workspace = true } pallet-session-benchmarking = { workspace = true } +pallet-dedir = { workspace = true } # Internal runtime API (with default disabled) pallet-did-runtime-api = { workspace = true } @@ -196,6 +197,7 @@ std = [ "frame-try-runtime?/std", "primitive-types/std", "sp-io/std", + "pallet-dedir/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -285,6 +287,7 @@ try-runtime = [ "frame-try-runtime/try-runtime", "pallet-config/try-runtime", "sp-runtime/try-runtime", + "pallet-dedir/try-runtime", ] # Set timing constants (e.g. session period) to faster versions to speed up testing. diff --git a/runtimes/weave/src/lib.rs b/runtimes/weave/src/lib.rs index f9ca2f3a..77da76c8 100644 --- a/runtimes/weave/src/lib.rs +++ b/runtimes/weave/src/lib.rs @@ -1132,6 +1132,9 @@ mod runtime { #[runtime::pallet_index(60)] pub type NetworkParameters = pallet_config; + #[runtime::pallet_index(61)] + pub type DeDir = pallet_dedir; + #[runtime::pallet_index(255)] pub type Sudo = pallet_sudo; }