git.delta.rocks / unique-network / refs/commits / b8430d488c9f

difftreelog

Add RuntimeInstance trait

Daniel Shiposha2022-03-11parent: #ddce88d.patch.diff
in: master

5 files changed

modifiedruntime/common/Cargo.tomldiffbeforeafterboth
16 'codec/std',16 'codec/std',
17 'frame-support/std',17 'frame-support/std',
18 'frame-system/std',18 'frame-system/std',
19 'sp-consensus-aura/std',
20 'pallet-common/std',
21 'fp-rpc/std',
19]22]
20runtime-benchmarks = [23runtime-benchmarks = [
21 'sp-runtime/runtime-benchmarks',24 'sp-runtime/runtime-benchmarks',
54git = 'https://github.com/paritytech/substrate.git'57git = 'https://github.com/paritytech/substrate.git'
55branch = 'polkadot-v0.9.17'58branch = 'polkadot-v0.9.17'
59
60[dependencies.pallet-common]
61default-features = false
62path = "../../pallets/common"
63
64[dependencies.sp-consensus-aura]
65default-features = false
66git = 'https://github.com/paritytech/substrate.git'
67branch = 'polkadot-v0.9.17'
68
69[dependencies.fp-rpc]
70default-features = false
71git = "https://github.com/uniquenetwork/frontier.git"
72branch = "unique-polkadot-v0.9.17"
5673
modifiedruntime/common/src/types.rsdiffbeforeafterboth
39/// Digest item type.39/// Digest item type.
40pub type DigestItem = generic::DigestItem;40pub type DigestItem = generic::DigestItem;
41
42pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
43
44pub trait RuntimeInstance {
45 type CrossAccountId: pallet_common::account::CrossAccountId<sp_runtime::AccountId32>
46 + Send + Sync + 'static;
47
48 type TransactionConverter: fp_rpc::ConvertTransaction<UncheckedExtrinsic>
49 + Send + Sync + 'static;
50
51 fn get_transaction_converter() -> Self::TransactionConverter;
52}
4153
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
116116
117pub const RUNTIME_NAME: &str = "Opal";117pub const RUNTIME_NAME: &str = "Opal";
118118
119pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;119type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
120
121impl RuntimeInstance for Runtime {
122 type CrossAccountId = self::CrossAccountId;
123
124 type TransactionConverter = self::TransactionConverter;
125
126 fn get_transaction_converter() -> TransactionConverter {
127 TransactionConverter
128 }
129}
120130
121/// 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 know
122/// 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 formats
128 use super::Aura;138 use super::Aura;
129139
130 pub use unique_runtime_common::types::*;140 pub use unique_runtime_common::types::*;
131 pub use super::CrossAccountId;
132141
133 impl_opaque_keys! {142 impl_opaque_keys! {
134 pub struct SessionKeys {143 pub struct SessionKeys {
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
116116
117pub const RUNTIME_NAME: &str = "Quartz";117pub const RUNTIME_NAME: &str = "Quartz";
118118
119pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;119type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
120
121impl RuntimeInstance for Runtime {
122 type CrossAccountId = self::CrossAccountId;
123
124 type TransactionConverter = self::TransactionConverter;
125
126 fn get_transaction_converter() -> TransactionConverter {
127 TransactionConverter
128 }
129}
120130
121/// 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 know
122/// 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 formats
128 use super::Aura;138 use super::Aura;
129139
130 pub use unique_runtime_common::types::*;140 pub use unique_runtime_common::types::*;
131 pub use super::CrossAccountId;
132141
133 impl_opaque_keys! {142 impl_opaque_keys! {
134 pub struct SessionKeys {143 pub struct SessionKeys {
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
85};85};
8686
87// pub use pallet_timestamp::Call as TimestampCall;87// pub use pallet_timestamp::Call as TimestampCall;
88pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
8988
90// Polkadot imports89// Polkadot imports
91use pallet_xcm::XcmPassthrough;90use pallet_xcm::XcmPassthrough;
116115
117pub const RUNTIME_NAME: &str = "Unique";116pub const RUNTIME_NAME: &str = "Unique";
118117
119pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;118type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
119
120impl RuntimeInstance for Runtime {
121 type CrossAccountId = self::CrossAccountId;
122
123 type TransactionConverter = self::TransactionConverter;
124
125 fn get_transaction_converter() -> TransactionConverter {
126 TransactionConverter
127 }
128}
120129
121/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know130/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
122/// the specifics of the runtime. They can then be made to be agnostic over specific formats131/// the specifics of the runtime. They can then be made to be agnostic over specific formats
128 use super::Aura;137 use super::Aura;
129138
130 pub use unique_runtime_common::types::*;139 pub use unique_runtime_common::types::*;
131 pub use super::CrossAccountId;
132140
133 impl_opaque_keys! {141 impl_opaque_keys! {
134 pub struct SessionKeys {142 pub struct SessionKeys {
207 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)215 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
208 .build_or_panic();216 .build_or_panic();
209 pub const Version: RuntimeVersion = VERSION;217 pub const Version: RuntimeVersion = VERSION;
210 pub const SS58Prefix: u8 = 7391;218 pub const SS58Prefix: u16 = 7391;
211}219}
212220
213parameter_types! {221parameter_types! {