Skip to content

Commit

Permalink
Runtimes & Identifier updates
Browse files Browse the repository at this point in the history
Signed-off-by: Shreevatsa N <[email protected]>
  • Loading branch information
vatsa287 committed Aug 23, 2024
1 parent aa242e5 commit ece3f53
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
8 changes: 8 additions & 0 deletions primitives/identifier/src/curi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub enum IdentifierType {
Asset,
AssetInstance,
Rating,
DeDir,
}

impl IdentifierType {
Expand All @@ -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 {
Expand All @@ -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<Self> {
Expand All @@ -80,6 +83,7 @@ impl IdentifierType {
2348 => Some(IdentifierType::Asset),
6077 => Some(IdentifierType::AssetInstance),
11380 => Some(IdentifierType::Rating),
9274 => Some(IdentifierType::DeDir),
_ => None,
}
}
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions runtimes/braid/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions runtimes/braid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions runtimes/loom/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions runtimes/loom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions runtimes/weave/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -196,6 +197,7 @@ std = [
"frame-try-runtime?/std",
"primitive-types/std",
"sp-io/std",
"pallet-dedir/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions runtimes/weave/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ece3f53

Please sign in to comment.