git.delta.rocks / unique-network / refs/commits / 11819bef1c7a

difftreelog

feat sapphire runtime

Alexander Saft2022-11-22parent: #df29d0d.patch.diff
in: master

5 files changed

modifiednode/cli/Cargo.tomldiffbeforeafterboth
--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -335,3 +335,7 @@
     'quartz-runtime?/try-runtime',
     'opal-runtime?/try-runtime',
 ]
+sapphire-runtime = [
+    'opal-runtime',
+    'opal-runtime/become-sapphire',
+]
modifiednode/cli/src/chain_spec.rsdiffbeforeafterboth
--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -66,7 +66,7 @@
 }
 
 #[cfg(not(feature = "unique-runtime"))]
-/// PARA_ID for Opal/Quartz
+/// PARA_ID for Opal/Sapphire/Quartz
 const PARA_ID: u32 = 2095;
 
 #[cfg(feature = "unique-runtime")]
@@ -89,7 +89,11 @@
 			return RuntimeId::Quartz;
 		}
 
-		if self.id().starts_with("opal") || self.id() == "dev" || self.id() == "local_testnet" {
+		if self.id().starts_with("opal")
+			|| self.id().starts_with("sapphire")
+			|| self.id() == "dev"
+			|| self.id() == "local_testnet"
+		{
 			return RuntimeId::Opal;
 		}
 
modifiednode/cli/src/cli.rsdiffbeforeafterboth
101 "Unique"101 "Unique"
102 } else if cfg!(feature = "quartz-runtime") {102 } else if cfg!(feature = "quartz-runtime") {
103 "Quartz"103 "Quartz"
104 } else {104 } else if cfg!(feature = "sapphire-runtime") {
105 "Sapphire"
106 } else {
105 "Opal"107 "Opal"
106 }108 }
107 }109 }
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -181,6 +181,7 @@
     'foreign-assets',
     'pallet-test-utils',
 ]
+become-sapphire = []
 
 refungible = []
 scheduler = []
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -42,7 +42,14 @@
 
 pub use runtime_common::*;
 
+#[cfg(feature = "become-sapphire")]
+pub const RUNTIME_NAME: &str = "sapphire";
+#[cfg(feature = "become-sapphire")]
+pub const TOKEN_SYMBOL: &str = "QTZ";
+
+#[cfg(not(feature = "become-sapphire"))]
 pub const RUNTIME_NAME: &str = "opal";
+#[cfg(not(feature = "become-sapphire"))]
 pub const TOKEN_SYMBOL: &str = "OPL";
 
 /// This runtime version.
@@ -59,7 +66,16 @@
 
 parameter_types! {
 	pub const Version: RuntimeVersion = VERSION;
-	pub const SS58Prefix: u8 = 42;
+}
+#[cfg(feature = "become-sapphire")]
+parameter_types! {
+	pub const SS58Prefix: u16 = 8883;
+	pub const ChainId: u64 = 8883;
+}
+
+#[cfg(not(feature = "become-sapphire"))]
+parameter_types! {
+	pub const SS58Prefix: u16 = 42;
 	pub const ChainId: u64 = 8882;
 }