difftreelog
Add RuntimeInstance trait
in: master
5 files changed
runtime/common/Cargo.tomldiffbeforeafterboth--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -16,6 +16,9 @@
'codec/std',
'frame-support/std',
'frame-system/std',
+ 'sp-consensus-aura/std',
+ 'pallet-common/std',
+ 'fp-rpc/std',
]
runtime-benchmarks = [
'sp-runtime/runtime-benchmarks',
@@ -53,3 +56,17 @@
default-features = false
git = 'https://github.com/paritytech/substrate.git'
branch = 'polkadot-v0.9.17'
+
+[dependencies.pallet-common]
+default-features = false
+path = "../../pallets/common"
+
+[dependencies.sp-consensus-aura]
+default-features = false
+git = 'https://github.com/paritytech/substrate.git'
+branch = 'polkadot-v0.9.17'
+
+[dependencies.fp-rpc]
+default-features = false
+git = "https://github.com/uniquenetwork/frontier.git"
+branch = "unique-polkadot-v0.9.17"
runtime/common/src/types.rsdiffbeforeafterboth--- a/runtime/common/src/types.rs
+++ b/runtime/common/src/types.rs
@@ -38,3 +38,15 @@
/// Digest item type.
pub type DigestItem = generic::DigestItem;
+
+pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
+
+pub trait RuntimeInstance {
+ type CrossAccountId: pallet_common::account::CrossAccountId<sp_runtime::AccountId32>
+ + Send + Sync + 'static;
+
+ type TransactionConverter: fp_rpc::ConvertTransaction<UncheckedExtrinsic>
+ + Send + Sync + 'static;
+
+ fn get_transaction_converter() -> Self::TransactionConverter;
+}
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -116,8 +116,18 @@
pub const RUNTIME_NAME: &str = "Opal";
-pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+
+impl RuntimeInstance for Runtime {
+ type CrossAccountId = self::CrossAccountId;
+
+ type TransactionConverter = self::TransactionConverter;
+ fn get_transaction_converter() -> TransactionConverter {
+ TransactionConverter
+ }
+}
+
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
@@ -128,7 +138,6 @@
use super::Aura;
pub use unique_runtime_common::types::*;
- pub use super::CrossAccountId;
impl_opaque_keys! {
pub struct SessionKeys {
runtime/quartz/src/lib.rsdiffbeforeafterboth116116117pub const RUNTIME_NAME: &str = "Quartz";117pub const RUNTIME_NAME: &str = "Quartz";118118119pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;119type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;120121impl RuntimeInstance for Runtime {122 type CrossAccountId = self::CrossAccountId;123124 type TransactionConverter = self::TransactionConverter;125126 fn get_transaction_converter() -> TransactionConverter {127 TransactionConverter128 }129}120130121/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know131/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know122/// the specifics of the runtime. They can then be made to be agnostic over specific formats132/// the specifics of the runtime. They can then be made to be agnostic over specific formats128 use super::Aura;138 use super::Aura;129139130 pub use unique_runtime_common::types::*;140 pub use unique_runtime_common::types::*;131 pub use super::CrossAccountId;132141133 impl_opaque_keys! {142 impl_opaque_keys! {134 pub struct SessionKeys {143 pub struct SessionKeys {runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -85,7 +85,6 @@
};
// pub use pallet_timestamp::Call as TimestampCall;
-pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
// Polkadot imports
use pallet_xcm::XcmPassthrough;
@@ -116,7 +115,17 @@
pub const RUNTIME_NAME: &str = "Unique";
-pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+
+impl RuntimeInstance for Runtime {
+ type CrossAccountId = self::CrossAccountId;
+
+ type TransactionConverter = self::TransactionConverter;
+
+ fn get_transaction_converter() -> TransactionConverter {
+ TransactionConverter
+ }
+}
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
@@ -128,7 +137,6 @@
use super::Aura;
pub use unique_runtime_common::types::*;
- pub use super::CrossAccountId;
impl_opaque_keys! {
pub struct SessionKeys {
@@ -207,7 +215,7 @@
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
.build_or_panic();
pub const Version: RuntimeVersion = VERSION;
- pub const SS58Prefix: u8 = 7391;
+ pub const SS58Prefix: u16 = 7391;
}
parameter_types! {