difftreelog
refactor add up-common
in: master
28 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1128,18 +1128,6 @@
]
[[package]]
-name = "common-types"
-version = "0.9.24"
-dependencies = [
- "fp-rpc",
- "pallet-evm",
- "sp-consensus-aura",
- "sp-core",
- "sp-runtime",
- "sp-std",
-]
-
-[[package]]
name = "concurrent-queue"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5294,7 +5282,6 @@
name = "opal-runtime"
version = "0.9.24"
dependencies = [
- "common-types",
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
@@ -5366,6 +5353,7 @@
"sp-transaction-pool",
"sp-version",
"substrate-wasm-builder",
+ "up-common",
"up-data-structs",
"up-rpc",
"up-sponsorship",
@@ -8610,7 +8598,6 @@
name = "quartz-runtime"
version = "0.9.24"
dependencies = [
- "common-types",
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
@@ -8682,6 +8669,7 @@
"sp-transaction-pool",
"sp-version",
"substrate-wasm-builder",
+ "up-common",
"up-data-structs",
"up-rpc",
"up-sponsorship",
@@ -11897,7 +11885,6 @@
name = "tests"
version = "0.1.0"
dependencies = [
- "common-types",
"evm-coder",
"fp-evm-mapping",
"frame-support",
@@ -12480,7 +12467,6 @@
version = "0.9.24"
dependencies = [
"clap",
- "common-types",
"cumulus-client-cli",
"cumulus-client-collator",
"cumulus-client-consensus-aura",
@@ -12559,6 +12545,7 @@
"try-runtime-cli",
"unique-rpc",
"unique-runtime",
+ "up-common",
"up-data-structs",
"up-rpc",
]
@@ -12567,7 +12554,6 @@
name = "unique-rpc"
version = "0.1.0"
dependencies = [
- "common-types",
"fc-db",
"fc-mapping-sync",
"fc-rpc",
@@ -12608,6 +12594,7 @@
"substrate-frame-rpc-system",
"tokio 0.2.25",
"uc-rpc",
+ "up-common",
"up-data-structs",
"up-rpc",
]
@@ -12616,7 +12603,6 @@
name = "unique-runtime"
version = "0.9.24"
dependencies = [
- "common-types",
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
@@ -12688,6 +12674,7 @@
"sp-transaction-pool",
"sp-version",
"substrate-wasm-builder",
+ "up-common",
"up-data-structs",
"up-rpc",
"up-sponsorship",
@@ -12725,6 +12712,19 @@
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
+name = "up-common"
+version = "0.9.24"
+dependencies = [
+ "fp-rpc",
+ "frame-support",
+ "pallet-evm",
+ "sp-consensus-aura",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
name = "up-data-structs"
version = "0.2.1"
dependencies = [
common-types/Cargo.tomldiffbeforeafterboth--- a/common-types/Cargo.toml
+++ /dev/null
@@ -1,50 +0,0 @@
-[package]
-authors = ['Unique Network <support@uniquenetwork.io>']
-description = 'Unique Runtime Common'
-edition = '2021'
-homepage = 'https://unique.network'
-license = 'All Rights Reserved'
-name = 'common-types'
-repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = '0.9.24'
-
-[features]
-default = ['std']
-std = [
- 'sp-std/std',
- 'sp-runtime/std',
- 'sp-core/std',
- 'sp-consensus-aura/std',
- 'fp-rpc/std',
- 'pallet-evm/std',
-]
-
-[dependencies.sp-std]
-default-features = false
-git = "https://github.com/paritytech/substrate"
-branch = "polkadot-v0.9.24"
-
-[dependencies.sp-runtime]
-default-features = false
-git = "https://github.com/paritytech/substrate"
-branch = "polkadot-v0.9.24"
-
-[dependencies.sp-core]
-default-features = false
-git = "https://github.com/paritytech/substrate"
-branch = "polkadot-v0.9.24"
-
-[dependencies.sp-consensus-aura]
-default-features = false
-git = "https://github.com/paritytech/substrate"
-branch = "polkadot-v0.9.24"
-
-[dependencies.fp-rpc]
-default-features = false
-git = "https://github.com/uniquenetwork/frontier"
-branch = "unique-polkadot-v0.9.24"
-
-[dependencies.pallet-evm]
-default-features = false
-git = "https://github.com/uniquenetwork/frontier"
-branch = "unique-polkadot-v0.9.24"
common-types/src/lib.rsdiffbeforeafterboth--- a/common-types/src/lib.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-#![cfg_attr(not(feature = "std"), no_std)]
-
-use sp_runtime::{
- generic,
- traits::{Verify, IdentifyAccount},
- MultiSignature,
-};
-
-/// 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
-/// to even the core data structures.
-pub mod opaque {
- pub use sp_runtime::{generic, traits::BlakeTwo256, OpaqueExtrinsic as UncheckedExtrinsic};
-
- pub use super::{BlockNumber, Signature, AccountId, Balance, Index, Hash, AuraId};
-
- /// Opaque block header type.
- pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
-
- /// Opaque block type.
- pub type Block = generic::Block<Header, UncheckedExtrinsic>;
-
- pub trait RuntimeInstance {
- type CrossAccountId: pallet_evm::account::CrossAccountId<sp_runtime::AccountId32>
- + Send
- + Sync
- + 'static;
-
- type TransactionConverter: fp_rpc::ConvertTransaction<UncheckedExtrinsic>
- + Send
- + Sync
- + 'static;
-
- fn get_transaction_converter() -> Self::TransactionConverter;
- }
-}
-
-pub type SessionHandlers = ();
-
-/// An index to a block.
-pub type BlockNumber = u32;
-
-/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
-pub type Signature = MultiSignature;
-
-/// Some way of identifying an account on the chain. We intentionally make it equivalent
-/// to the public key of our transaction signing scheme.
-pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
-
-/// The type for looking up accounts. We don't expect more than 4 billion of them, but you
-/// never know...
-pub type AccountIndex = u32;
-
-/// Balance of an account.
-pub type Balance = u128;
-
-/// Index of a transaction in the chain.
-pub type Index = u32;
-
-/// A hash of some data used by the chain.
-pub type Hash = sp_core::H256;
-
-/// Digest item type.
-pub type DigestItem = generic::DigestItem;
-
-pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
node/cli/Cargo.tomldiffbeforeafterboth--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -253,8 +253,8 @@
################################################################################
# Local dependencies
-[dependencies.common-types]
-path = "../../common-types"
+[dependencies.up-common]
+path = "../../primitives/common"
[dependencies.unique-runtime]
path = '../../runtime/unique'
node/cli/src/chain_spec.rsdiffbeforeafterboth--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -23,7 +23,7 @@
use serde::{Deserialize, Serialize};
use serde_json::map::Map;
-use common_types::opaque::*;
+use up_common::types::opaque::*;
#[cfg(feature = "unique-runtime")]
pub use unique_runtime as default_runtime;
node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -64,7 +64,7 @@
use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
use std::{io::Write, net::SocketAddr, time::Duration};
-use common_types::opaque::Block;
+use up_common::types::opaque::Block;
macro_rules! no_runtime_err {
($chain_name:expr) => {
node/cli/src/service.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// std18use std::sync::Arc;19use std::sync::Mutex;20use std::collections::BTreeMap;21use std::time::Duration;22use std::pin::Pin;23use fc_rpc_core::types::FeeHistoryCache;24use futures::{25 Stream, StreamExt,26 stream::select,27 task::{Context, Poll},28};29use tokio::time::Interval;3031use unique_rpc::overrides_handle;3233use serde::{Serialize, Deserialize};3435// Cumulus Imports36use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};37use cumulus_client_consensus_common::ParachainConsensus;38use cumulus_client_service::{39 prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,40};41use cumulus_client_cli::CollatorOptions;42use cumulus_client_network::BlockAnnounceValidator;43use cumulus_primitives_core::ParaId;44use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;45use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult};46use cumulus_relay_chain_rpc_interface::RelayChainRPCInterface;4748// Substrate Imports49use sc_client_api::ExecutorProvider;50use sc_executor::NativeElseWasmExecutor;51use sc_executor::NativeExecutionDispatch;52use sc_network::NetworkService;53use sc_service::{BasePath, Configuration, PartialComponents, Role, TaskManager};54use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};55use sp_keystore::SyncCryptoStorePtr;56use sp_runtime::traits::BlakeTwo256;57use substrate_prometheus_endpoint::Registry;58use sc_client_api::BlockchainEvents;5960use polkadot_service::CollatorPair;6162// Frontier Imports63use fc_rpc_core::types::FilterPool;64use fc_mapping_sync::{MappingSyncWorker, SyncStrategy};6566use common_types::opaque::{AuraId, RuntimeInstance, AccountId, Balance, Index, Hash, Block};6768// RMRK69use up_data_structs::{70 RmrkCollectionInfo, RmrkInstanceInfo, RmrkResourceInfo, RmrkPropertyInfo, RmrkBaseInfo,71 RmrkPartType, RmrkTheme,72};7374/// Unique native executor instance.75#[cfg(feature = "unique-runtime")]76pub struct UniqueRuntimeExecutor;7778#[cfg(feature = "quartz-runtime")]79/// Quartz native executor instance.80pub struct QuartzRuntimeExecutor;8182/// Opal native executor instance.83pub struct OpalRuntimeExecutor;8485#[cfg(feature = "unique-runtime")]86pub type DefaultRuntimeExecutor = UniqueRuntimeExecutor;8788#[cfg(all(not(feature = "unique-runtime"), feature = "quartz-runtime"))]89pub type DefaultRuntimeExecutor = QuartzRuntimeExecutor;9091#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]92pub type DefaultRuntimeExecutor = OpalRuntimeExecutor;9394#[cfg(feature = "unique-runtime")]95impl NativeExecutionDispatch for UniqueRuntimeExecutor {96 type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;9798 fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {99 unique_runtime::api::dispatch(method, data)100 }101102 fn native_version() -> sc_executor::NativeVersion {103 unique_runtime::native_version()104 }105}106107#[cfg(feature = "quartz-runtime")]108impl NativeExecutionDispatch for QuartzRuntimeExecutor {109 type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;110111 fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {112 quartz_runtime::api::dispatch(method, data)113 }114115 fn native_version() -> sc_executor::NativeVersion {116 quartz_runtime::native_version()117 }118}119120impl NativeExecutionDispatch for OpalRuntimeExecutor {121 type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;122123 fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {124 opal_runtime::api::dispatch(method, data)125 }126127 fn native_version() -> sc_executor::NativeVersion {128 opal_runtime::native_version()129 }130}131132pub struct AutosealInterval {133 interval: Interval,134}135136impl AutosealInterval {137 pub fn new(config: &Configuration, interval: Duration) -> Self {138 let _tokio_runtime = config.tokio_handle.enter();139 let interval = tokio::time::interval(interval);140141 Self { interval }142 }143}144145impl Stream for AutosealInterval {146 type Item = tokio::time::Instant;147148 fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {149 self.interval.poll_tick(cx).map(Some)150 }151}152153pub fn open_frontier_backend(config: &Configuration) -> Result<Arc<fc_db::Backend<Block>>, String> {154 let config_dir = config155 .base_path156 .as_ref()157 .map(|base_path| base_path.config_dir(config.chain_spec.id()))158 .unwrap_or_else(|| {159 BasePath::from_project("", "", "unique").config_dir(config.chain_spec.id())160 });161 let database_dir = config_dir.join("frontier").join("db");162163 Ok(Arc::new(fc_db::Backend::<Block>::new(164 &fc_db::DatabaseSettings {165 source: fc_db::DatabaseSource::RocksDb {166 path: database_dir,167 cache_size: 0,168 },169 },170 )?))171}172173type FullClient<RuntimeApi, ExecutorDispatch> =174 sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;175type FullBackend = sc_service::TFullBackend<Block>;176type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;177178/// Starts a `ServiceBuilder` for a full service.179///180/// Use this macro if you don't actually need the full service, but just the builder in order to181/// be able to perform chain operations.182#[allow(clippy::type_complexity)]183pub fn new_partial<RuntimeApi, ExecutorDispatch, BIQ>(184 config: &Configuration,185 build_import_queue: BIQ,186) -> Result<187 PartialComponents<188 FullClient<RuntimeApi, ExecutorDispatch>,189 FullBackend,190 FullSelectChain,191 sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,192 sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,193 (194 Option<Telemetry>,195 Option<FilterPool>,196 Arc<fc_db::Backend<Block>>,197 Option<TelemetryWorkerHandle>,198 FeeHistoryCache,199 ),200 >,201 sc_service::Error,202>203where204 sc_client_api::StateBackendFor<FullBackend, Block>: sp_api::StateBackend<BlakeTwo256>,205 RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>206 + Send207 + Sync208 + 'static,209 RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>,210 ExecutorDispatch: NativeExecutionDispatch + 'static,211 BIQ: FnOnce(212 Arc<FullClient<RuntimeApi, ExecutorDispatch>>,213 &Configuration,214 Option<TelemetryHandle>,215 &TaskManager,216 ) -> Result<217 sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,218 sc_service::Error,219 >,220{221 let _telemetry = config222 .telemetry_endpoints223 .clone()224 .filter(|x| !x.is_empty())225 .map(|endpoints| -> Result<_, sc_telemetry::Error> {226 let worker = TelemetryWorker::new(16)?;227 let telemetry = worker.handle().new_telemetry(endpoints);228 Ok((worker, telemetry))229 })230 .transpose()?;231232 let telemetry = config233 .telemetry_endpoints234 .clone()235 .filter(|x| !x.is_empty())236 .map(|endpoints| -> Result<_, sc_telemetry::Error> {237 let worker = TelemetryWorker::new(16)?;238 let telemetry = worker.handle().new_telemetry(endpoints);239 Ok((worker, telemetry))240 })241 .transpose()?;242243 let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(244 config.wasm_method,245 config.default_heap_pages,246 config.max_runtime_instances,247 config.runtime_cache_size,248 );249250 let (client, backend, keystore_container, task_manager) =251 sc_service::new_full_parts::<Block, RuntimeApi, _>(252 config,253 telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),254 executor,255 )?;256 let client = Arc::new(client);257258 let telemetry_worker_handle = telemetry.as_ref().map(|(worker, _)| worker.handle());259260 let telemetry = telemetry.map(|(worker, telemetry)| {261 task_manager262 .spawn_handle()263 .spawn("telemetry", None, worker.run());264 telemetry265 });266267 let select_chain = sc_consensus::LongestChain::new(backend.clone());268269 let transaction_pool = sc_transaction_pool::BasicPool::new_full(270 config.transaction_pool.clone(),271 config.role.is_authority().into(),272 config.prometheus_registry(),273 task_manager.spawn_essential_handle(),274 client.clone(),275 );276277 let filter_pool: Option<FilterPool> = Some(Arc::new(Mutex::new(BTreeMap::new())));278279 let frontier_backend = open_frontier_backend(config)?;280281 let import_queue = build_import_queue(282 client.clone(),283 config,284 telemetry.as_ref().map(|telemetry| telemetry.handle()),285 &task_manager,286 )?;287 let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));288289 let params = PartialComponents {290 backend,291 client,292 import_queue,293 keystore_container,294 task_manager,295 transaction_pool,296 select_chain,297 other: (298 telemetry,299 filter_pool,300 frontier_backend,301 telemetry_worker_handle,302 fee_history_cache,303 ),304 };305306 Ok(params)307}308309async fn build_relay_chain_interface(310 polkadot_config: Configuration,311 parachain_config: &Configuration,312 telemetry_worker_handle: Option<TelemetryWorkerHandle>,313 task_manager: &mut TaskManager,314 collator_options: CollatorOptions,315 hwbench: Option<sc_sysinfo::HwBench>,316) -> RelayChainResult<(317 Arc<(dyn RelayChainInterface + 'static)>,318 Option<CollatorPair>,319)> {320 match collator_options.relay_chain_rpc_url {321 Some(relay_chain_url) => Ok((322 Arc::new(RelayChainRPCInterface::new(relay_chain_url).await?) as Arc<_>,323 None,324 )),325 None => build_inprocess_relay_chain(326 polkadot_config,327 parachain_config,328 telemetry_worker_handle,329 task_manager,330 hwbench,331 ),332 }333}334335/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.336///337/// This is the actual implementation that is abstract over the executor and the runtime api.338#[sc_tracing::logging::prefix_logs_with("Parachain")]339async fn start_node_impl<Runtime, RuntimeApi, ExecutorDispatch, BIQ, BIC>(340 parachain_config: Configuration,341 polkadot_config: Configuration,342 collator_options: CollatorOptions,343 id: ParaId,344 build_import_queue: BIQ,345 build_consensus: BIC,346 hwbench: Option<sc_sysinfo::HwBench>,347) -> sc_service::error::Result<(TaskManager, Arc<FullClient<RuntimeApi, ExecutorDispatch>>)>348where349 sc_client_api::StateBackendFor<FullBackend, Block>: sp_api::StateBackend<BlakeTwo256>,350 Runtime: RuntimeInstance + Send + Sync + 'static,351 <Runtime as RuntimeInstance>::CrossAccountId: Serialize,352 for<'de> <Runtime as RuntimeInstance>::CrossAccountId: Deserialize<'de>,353 RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>354 + Send355 + Sync356 + 'static,357 RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>358 + fp_rpc::EthereumRuntimeRPCApi<Block>359 + fp_rpc::ConvertTransactionRuntimeApi<Block>360 + sp_session::SessionKeys<Block>361 + sp_block_builder::BlockBuilder<Block>362 + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>363 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>364 + up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>365 + rmrk_rpc::RmrkApi<366 Block,367 AccountId,368 RmrkCollectionInfo<AccountId>,369 RmrkInstanceInfo<AccountId>,370 RmrkResourceInfo,371 RmrkPropertyInfo,372 RmrkBaseInfo<AccountId>,373 RmrkPartType,374 RmrkTheme,375 > + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>376 + sp_api::Metadata<Block>377 + sp_offchain::OffchainWorkerApi<Block>378 + cumulus_primitives_core::CollectCollationInfo<Block>,379 ExecutorDispatch: NativeExecutionDispatch + 'static,380 BIQ: FnOnce(381 Arc<FullClient<RuntimeApi, ExecutorDispatch>>,382 &Configuration,383 Option<TelemetryHandle>,384 &TaskManager,385 ) -> Result<386 sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,387 sc_service::Error,388 >,389 BIC: FnOnce(390 Arc<FullClient<RuntimeApi, ExecutorDispatch>>,391 Option<&Registry>,392 Option<TelemetryHandle>,393 &TaskManager,394 Arc<dyn RelayChainInterface>,395 Arc<sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>>,396 Arc<NetworkService<Block, Hash>>,397 SyncCryptoStorePtr,398 bool,399 ) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,400{401 if matches!(parachain_config.role, Role::Light) {402 return Err("Light client not supported!".into());403 }404405 let parachain_config = prepare_node_config(parachain_config);406407 let params =408 new_partial::<RuntimeApi, ExecutorDispatch, BIQ>(¶chain_config, build_import_queue)?;409 let (mut telemetry, filter_pool, frontier_backend, telemetry_worker_handle, fee_history_cache) =410 params.other;411412 let client = params.client.clone();413 let backend = params.backend.clone();414 let mut task_manager = params.task_manager;415416 let (relay_chain_interface, collator_key) = build_relay_chain_interface(417 polkadot_config,418 ¶chain_config,419 telemetry_worker_handle,420 &mut task_manager,421 collator_options.clone(),422 hwbench.clone(),423 )424 .await425 .map_err(|e| match e {426 RelayChainError::ServiceError(polkadot_service::Error::Sub(x)) => x,427 s => s.to_string().into(),428 })?;429430 let block_announce_validator = BlockAnnounceValidator::new(relay_chain_interface.clone(), id);431432 let force_authoring = parachain_config.force_authoring;433 let validator = parachain_config.role.is_authority();434 let prometheus_registry = parachain_config.prometheus_registry().cloned();435 let transaction_pool = params.transaction_pool.clone();436 let import_queue = cumulus_client_service::SharedImportQueue::new(params.import_queue);437438 let (network, system_rpc_tx, start_network) =439 sc_service::build_network(sc_service::BuildNetworkParams {440 config: ¶chain_config,441 client: client.clone(),442 transaction_pool: transaction_pool.clone(),443 spawn_handle: task_manager.spawn_handle(),444 import_queue: import_queue.clone(),445 block_announce_validator_builder: Some(Box::new(|_| {446 Box::new(block_announce_validator)447 })),448 warp_sync: None,449 })?;450451 let rpc_client = client.clone();452 let rpc_pool = transaction_pool.clone();453 let select_chain = params.select_chain.clone();454 let rpc_network = network.clone();455456 let rpc_frontier_backend = frontier_backend.clone();457458 let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new(459 task_manager.spawn_handle(),460 overrides_handle::<_, _, Runtime>(client.clone()),461 50,462 50,463 prometheus_registry.clone(),464 ));465466 task_manager.spawn_essential_handle().spawn(467 "frontier-mapping-sync-worker",468 None,469 MappingSyncWorker::new(470 client.import_notification_stream(),471 Duration::new(6, 0),472 client.clone(),473 backend.clone(),474 frontier_backend.clone(),475 3,476 0,477 SyncStrategy::Normal,478 )479 .for_each(|()| futures::future::ready(())),480 );481482 let rpc_builder = Box::new(move |deny_unsafe, subscription_task_executor| {483 let full_deps = unique_rpc::FullDeps {484 backend: rpc_frontier_backend.clone(),485 deny_unsafe,486 client: rpc_client.clone(),487 pool: rpc_pool.clone(),488 graph: rpc_pool.pool().clone(),489 // TODO: Unhardcode490 enable_dev_signer: false,491 filter_pool: filter_pool.clone(),492 network: rpc_network.clone(),493 select_chain: select_chain.clone(),494 is_authority: validator,495 // TODO: Unhardcode496 max_past_logs: 10000,497 block_data_cache: block_data_cache.clone(),498 fee_history_cache: fee_history_cache.clone(),499 // TODO: Unhardcode500 fee_history_limit: 2048,501 };502503 unique_rpc::create_full::<_, _, _, _, Runtime, RuntimeApi, _>(504 full_deps,505 subscription_task_executor,506 )507 .map_err(Into::into)508 });509510 sc_service::spawn_tasks(sc_service::SpawnTasksParams {511 rpc_builder,512 client: client.clone(),513 transaction_pool: transaction_pool.clone(),514 task_manager: &mut task_manager,515 config: parachain_config,516 keystore: params.keystore_container.sync_keystore(),517 backend: backend.clone(),518 network: network.clone(),519 system_rpc_tx,520 telemetry: telemetry.as_mut(),521 })?;522523 if let Some(hwbench) = hwbench {524 sc_sysinfo::print_hwbench(&hwbench);525526 if let Some(ref mut telemetry) = telemetry {527 let telemetry_handle = telemetry.handle();528 task_manager.spawn_handle().spawn(529 "telemetry_hwbench",530 None,531 sc_sysinfo::initialize_hwbench_telemetry(telemetry_handle, hwbench),532 );533 }534 }535536 let announce_block = {537 let network = network.clone();538 Arc::new(move |hash, data| network.announce_block(hash, data))539 };540541 let relay_chain_slot_duration = Duration::from_secs(6);542543 if validator {544 let parachain_consensus = build_consensus(545 client.clone(),546 prometheus_registry.as_ref(),547 telemetry.as_ref().map(|t| t.handle()),548 &task_manager,549 relay_chain_interface.clone(),550 transaction_pool,551 network,552 params.keystore_container.sync_keystore(),553 force_authoring,554 )?;555556 let spawner = task_manager.spawn_handle();557558 let params = StartCollatorParams {559 para_id: id,560 block_status: client.clone(),561 announce_block,562 client: client.clone(),563 task_manager: &mut task_manager,564 spawner,565 parachain_consensus,566 import_queue,567 collator_key: collator_key.expect("Command line arguments do not allow this. qed"),568 relay_chain_interface,569 relay_chain_slot_duration,570 };571572 start_collator(params).await?;573 } else {574 let params = StartFullNodeParams {575 client: client.clone(),576 announce_block,577 task_manager: &mut task_manager,578 para_id: id,579 import_queue,580 relay_chain_interface,581 relay_chain_slot_duration,582 collator_options,583 };584585 start_full_node(params)?;586 }587588 start_network.start_network();589590 Ok((task_manager, client))591}592593/// Build the import queue for the the parachain runtime.594pub fn parachain_build_import_queue<RuntimeApi, ExecutorDispatch>(595 client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,596 config: &Configuration,597 telemetry: Option<TelemetryHandle>,598 task_manager: &TaskManager,599) -> Result<600 sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,601 sc_service::Error,602>603where604 RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>605 + Send606 + Sync607 + 'static,608 RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>609 + sp_block_builder::BlockBuilder<Block>610 + sp_consensus_aura::AuraApi<Block, AuraId>611 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,612 ExecutorDispatch: NativeExecutionDispatch + 'static,613{614 let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;615616 cumulus_client_consensus_aura::import_queue::<617 sp_consensus_aura::sr25519::AuthorityPair,618 _,619 _,620 _,621 _,622 _,623 _,624 >(cumulus_client_consensus_aura::ImportQueueParams {625 block_import: client.clone(),626 client: client.clone(),627 create_inherent_data_providers: move |_, _| async move {628 let time = sp_timestamp::InherentDataProvider::from_system_time();629630 let slot =631 sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(632 *time,633 slot_duration,634 );635636 Ok((time, slot))637 },638 registry: config.prometheus_registry(),639 can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),640 spawner: &task_manager.spawn_essential_handle(),641 telemetry,642 })643 .map_err(Into::into)644}645646/// Start a normal parachain node.647pub async fn start_node<Runtime, RuntimeApi, ExecutorDispatch>(648 parachain_config: Configuration,649 polkadot_config: Configuration,650 collator_options: CollatorOptions,651 id: ParaId,652 hwbench: Option<sc_sysinfo::HwBench>,653) -> sc_service::error::Result<(TaskManager, Arc<FullClient<RuntimeApi, ExecutorDispatch>>)>654where655 Runtime: RuntimeInstance + Send + Sync + 'static,656 <Runtime as RuntimeInstance>::CrossAccountId: Serialize,657 for<'de> <Runtime as RuntimeInstance>::CrossAccountId: Deserialize<'de>,658 RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>659 + Send660 + Sync661 + 'static,662 RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>663 + fp_rpc::EthereumRuntimeRPCApi<Block>664 + fp_rpc::ConvertTransactionRuntimeApi<Block>665 + sp_session::SessionKeys<Block>666 + sp_block_builder::BlockBuilder<Block>667 + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>668 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>669 + up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>670 + rmrk_rpc::RmrkApi<671 Block,672 AccountId,673 RmrkCollectionInfo<AccountId>,674 RmrkInstanceInfo<AccountId>,675 RmrkResourceInfo,676 RmrkPropertyInfo,677 RmrkBaseInfo<AccountId>,678 RmrkPartType,679 RmrkTheme,680 > + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>681 + sp_api::Metadata<Block>682 + sp_offchain::OffchainWorkerApi<Block>683 + cumulus_primitives_core::CollectCollationInfo<Block>684 + sp_consensus_aura::AuraApi<Block, AuraId>,685 ExecutorDispatch: NativeExecutionDispatch + 'static,686{687 start_node_impl::<Runtime, RuntimeApi, ExecutorDispatch, _, _>(688 parachain_config,689 polkadot_config,690 collator_options,691 id,692 parachain_build_import_queue,693 |client,694 prometheus_registry,695 telemetry,696 task_manager,697 relay_chain_interface,698 transaction_pool,699 sync_oracle,700 keystore,701 force_authoring| {702 let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;703704 let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(705 task_manager.spawn_handle(),706 client.clone(),707 transaction_pool,708 prometheus_registry,709 telemetry.clone(),710 );711712 Ok(AuraConsensus::build::<713 sp_consensus_aura::sr25519::AuthorityPair,714 _,715 _,716 _,717 _,718 _,719 _,720 >(BuildAuraConsensusParams {721 proposer_factory,722 create_inherent_data_providers: move |_, (relay_parent, validation_data)| {723 let relay_chain_interface = relay_chain_interface.clone();724 async move {725 let parachain_inherent =726 cumulus_primitives_parachain_inherent::ParachainInherentData::create_at(727 relay_parent,728 &relay_chain_interface,729 &validation_data,730 id,731 ).await;732733 let time = sp_timestamp::InherentDataProvider::from_system_time();734735 let slot =736 sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(737 *time,738 slot_duration,739 );740741 let parachain_inherent = parachain_inherent.ok_or_else(|| {742 Box::<dyn std::error::Error + Send + Sync>::from(743 "Failed to create parachain inherent",744 )745 })?;746 Ok((time, slot, parachain_inherent))747 }748 },749 block_import: client.clone(),750 para_client: client,751 backoff_authoring_blocks: Option::<()>::None,752 sync_oracle,753 keystore,754 force_authoring,755 slot_duration,756 // We got around 500ms for proposing757 block_proposal_slot_portion: SlotProportion::new(1f32 / 24f32),758 telemetry,759 max_block_proposal_slot_portion: None,760 }))761 },762 hwbench,763 )764 .await765}766767fn dev_build_import_queue<RuntimeApi, ExecutorDispatch>(768 client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,769 config: &Configuration,770 _: Option<TelemetryHandle>,771 task_manager: &TaskManager,772) -> Result<773 sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,774 sc_service::Error,775>776where777 RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>778 + Send779 + Sync780 + 'static,781 RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>782 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>,783 ExecutorDispatch: NativeExecutionDispatch + 'static,784{785 Ok(sc_consensus_manual_seal::import_queue(786 Box::new(client.clone()),787 &task_manager.spawn_essential_handle(),788 config.prometheus_registry(),789 ))790}791792/// Builds a new development service. This service uses instant seal, and mocks793/// the parachain inherent794pub fn start_dev_node<Runtime, RuntimeApi, ExecutorDispatch>(795 config: Configuration,796 autoseal_interval: Duration,797) -> sc_service::error::Result<TaskManager>798where799 Runtime: RuntimeInstance + Send + Sync + 'static,800 <Runtime as RuntimeInstance>::CrossAccountId: Serialize,801 for<'de> <Runtime as RuntimeInstance>::CrossAccountId: Deserialize<'de>,802 RuntimeApi: sp_api::ConstructRuntimeApi<Block, FullClient<RuntimeApi, ExecutorDispatch>>803 + Send804 + Sync805 + 'static,806 RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>807 + fp_rpc::EthereumRuntimeRPCApi<Block>808 + fp_rpc::ConvertTransactionRuntimeApi<Block>809 + sp_session::SessionKeys<Block>810 + sp_block_builder::BlockBuilder<Block>811 + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>812 + sp_api::ApiExt<Block, StateBackend = sc_client_api::StateBackendFor<FullBackend, Block>>813 + up_rpc::UniqueApi<Block, Runtime::CrossAccountId, AccountId>814 + rmrk_rpc::RmrkApi<815 Block,816 AccountId,817 RmrkCollectionInfo<AccountId>,818 RmrkInstanceInfo<AccountId>,819 RmrkResourceInfo,820 RmrkPropertyInfo,821 RmrkBaseInfo<AccountId>,822 RmrkPartType,823 RmrkTheme,824 > + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>825 + sp_api::Metadata<Block>826 + sp_offchain::OffchainWorkerApi<Block>827 + cumulus_primitives_core::CollectCollationInfo<Block>828 + sp_consensus_aura::AuraApi<Block, AuraId>,829 ExecutorDispatch: NativeExecutionDispatch + 'static,830{831 use sc_consensus_manual_seal::{run_manual_seal, EngineCommand, ManualSealParams};832 use fc_consensus::FrontierBlockImport;833 use sc_client_api::HeaderBackend;834835 let sc_service::PartialComponents {836 client,837 backend,838 mut task_manager,839 import_queue,840 keystore_container,841 select_chain: maybe_select_chain,842 transaction_pool,843 other:844 (telemetry, filter_pool, frontier_backend, _telemetry_worker_handle, fee_history_cache),845 } = new_partial::<RuntimeApi, ExecutorDispatch, _>(846 &config,847 dev_build_import_queue::<RuntimeApi, ExecutorDispatch>,848 )?;849 let prometheus_registry = config.prometheus_registry().cloned();850851 let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new(852 task_manager.spawn_handle(),853 overrides_handle::<_, _, Runtime>(client.clone()),854 50,855 50,856 prometheus_registry.clone(),857 ));858859 let (network, system_rpc_tx, network_starter) =860 sc_service::build_network(sc_service::BuildNetworkParams {861 config: &config,862 client: client.clone(),863 transaction_pool: transaction_pool.clone(),864 spawn_handle: task_manager.spawn_handle(),865 import_queue,866 block_announce_validator_builder: None,867 warp_sync: None,868 })?;869870 if config.offchain_worker.enabled {871 sc_service::build_offchain_workers(872 &config,873 task_manager.spawn_handle(),874 client.clone(),875 network.clone(),876 );877 }878879 let collator = config.role.is_authority();880881 let select_chain = maybe_select_chain.clone();882883 if collator {884 let block_import =885 FrontierBlockImport::new(client.clone(), client.clone(), frontier_backend.clone());886887 let env = sc_basic_authorship::ProposerFactory::new(888 task_manager.spawn_handle(),889 client.clone(),890 transaction_pool.clone(),891 prometheus_registry.as_ref(),892 telemetry.as_ref().map(|x| x.handle()),893 );894895 let transactions_commands_stream: Box<896 dyn Stream<Item = EngineCommand<Hash>> + Send + Sync + Unpin,897 > = Box::new(898 transaction_pool899 .pool()900 .validated_pool()901 .import_notification_stream()902 .map(|_| EngineCommand::SealNewBlock {903 create_empty: true,904 finalize: false,905 parent_hash: None,906 sender: None,907 }),908 );909910 let autoseal_interval = Box::pin(AutosealInterval::new(&config, autoseal_interval));911 let idle_commands_stream: Box<912 dyn Stream<Item = EngineCommand<Hash>> + Send + Sync + Unpin,913 > = Box::new(autoseal_interval.map(|_| EngineCommand::SealNewBlock {914 create_empty: true,915 finalize: false,916 parent_hash: None,917 sender: None,918 }));919920 let commands_stream = select(transactions_commands_stream, idle_commands_stream);921922 let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;923 let client_set_aside_for_cidp = client.clone();924925 task_manager.spawn_essential_handle().spawn_blocking(926 "authorship_task",927 Some("block-authoring"),928 run_manual_seal(ManualSealParams {929 block_import,930 env,931 client: client.clone(),932 pool: transaction_pool.clone(),933 commands_stream,934 select_chain: select_chain.clone(),935 consensus_data_provider: None,936 create_inherent_data_providers: move |block: Hash, ()| {937 let current_para_block = client_set_aside_for_cidp938 .number(block)939 .expect("Header lookup should succeed")940 .expect("Header passed in as parent should be present in backend.");941942 let client_for_xcm = client_set_aside_for_cidp.clone();943 async move {944 let time = sp_timestamp::InherentDataProvider::from_system_time();945946 let mocked_parachain = cumulus_primitives_parachain_inherent::MockValidationDataInherentDataProvider {947 current_para_block,948 relay_offset: 1000,949 relay_blocks_per_para_block: 2,950 xcm_config: cumulus_primitives_parachain_inherent::MockXcmConfig::new(951 &*client_for_xcm,952 block,953 Default::default(),954 Default::default(),955 ),956 raw_downward_messages: vec![],957 raw_horizontal_messages: vec![],958 };959960 let slot =961 sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(962 *time,963 slot_duration,964 );965966 Ok((time, slot, mocked_parachain))967 }968 },969 }),970 );971 }972973 task_manager.spawn_essential_handle().spawn(974 "frontier-mapping-sync-worker",975 Some("block-authoring"),976 MappingSyncWorker::new(977 client.import_notification_stream(),978 Duration::new(6, 0),979 client.clone(),980 backend.clone(),981 frontier_backend.clone(),982 3,983 0,984 SyncStrategy::Normal,985 )986 .for_each(|()| futures::future::ready(())),987 );988989 let rpc_client = client.clone();990 let rpc_pool = transaction_pool.clone();991 let rpc_network = network.clone();992 let rpc_frontier_backend = frontier_backend.clone();993 let rpc_builder = Box::new(move |deny_unsafe, subscription_executor| {994 let full_deps = unique_rpc::FullDeps {995 backend: rpc_frontier_backend.clone(),996 deny_unsafe,997 client: rpc_client.clone(),998 pool: rpc_pool.clone(),999 graph: rpc_pool.pool().clone(),1000 // TODO: Unhardcode1001 enable_dev_signer: false,1002 filter_pool: filter_pool.clone(),1003 network: rpc_network.clone(),1004 select_chain: select_chain.clone(),1005 is_authority: collator,1006 // TODO: Unhardcode1007 max_past_logs: 10000,1008 block_data_cache: block_data_cache.clone(),1009 fee_history_cache: fee_history_cache.clone(),1010 // TODO: Unhardcode1011 fee_history_limit: 2048,1012 };10131014 unique_rpc::create_full::<_, _, _, _, Runtime, RuntimeApi, _>(1015 full_deps,1016 subscription_executor,1017 )1018 .map_err(Into::into)1019 });10201021 sc_service::spawn_tasks(sc_service::SpawnTasksParams {1022 network,1023 client,1024 keystore: keystore_container.sync_keystore(),1025 task_manager: &mut task_manager,1026 transaction_pool,1027 rpc_builder,1028 backend,1029 system_rpc_tx,1030 config,1031 telemetry: None,1032 })?;10331034 network_starter.start_network();1035 Ok(task_manager)1036}node/rpc/Cargo.tomldiffbeforeafterboth--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -49,7 +49,7 @@
fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier", branch = "unique-polkadot-v0.9.24" }
pallet-common = { default-features = false, path = "../../pallets/common" }
-common-types = { path = "../../common-types" }
+up-common = { path = "../../primitives/common" }
pallet-unique = { path = "../../pallets/unique" }
uc-rpc = { path = "../../client/rpc" }
up-rpc = { path = "../../primitives/rpc" }
node/rpc/src/lib.rsdiffbeforeafterboth--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -40,7 +40,7 @@
use sc_service::TransactionPool;
use std::{collections::BTreeMap, sync::Arc};
-use common_types::opaque::{Hash, AccountId, RuntimeInstance, Index, Block, BlockNumber, Balance};
+use up_common::types::opaque::{Hash, AccountId, RuntimeInstance, Index, Block, BlockNumber, Balance};
// RMRK
use up_data_structs::{
runtime/common/config/ethereum.rsdiffbeforeafterboth--- a/runtime/common/config/ethereum.rs
+++ b/runtime/common/config/ethereum.rs
@@ -7,12 +7,13 @@
use sp_runtime::{RuntimeAppPublic, Perbill};
use crate::{
runtime_common::{
- constants::*, dispatch::CollectionDispatchT, ethereum::sponsoring::EvmSponsorshipHandler,
+ dispatch::CollectionDispatchT, ethereum::sponsoring::EvmSponsorshipHandler,
config::sponsoring::DefaultSponsoringRateLimit, DealWithFees,
},
Runtime, Aura, Balances, Event, ChainId,
};
use pallet_evm::{EnsureAddressTruncated, HashedAddressMapping};
+use up_common::constants::*;
pub type CrossAccountId = pallet_evm::account::BasicCrossAccountId<Runtime>;
runtime/common/config/orml.rsdiffbeforeafterboth--- a/runtime/common/config/orml.rs
+++ b/runtime/common/config/orml.rs
@@ -16,8 +16,11 @@
use frame_support::parameter_types;
use frame_system::EnsureSigned;
-use crate::{runtime_common::constants::*, Runtime, Event, RelayChainBlockNumberProvider};
-use common_types::{AccountId, Balance};
+use crate::{Runtime, Event, RelayChainBlockNumberProvider};
+use up_common::{
+ types::{AccountId, Balance},
+ constants::*,
+};
parameter_types! {
pub const MinVestedTransfer: Balance = 10 * UNIQUE;
runtime/common/config/pallets/mod.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -18,7 +18,6 @@
use sp_runtime::traits::AccountIdConversion;
use crate::{
runtime_common::{
- constants::*,
dispatch::CollectionDispatchT,
config::{substrate::TreasuryModuleId, ethereum::EvmCollectionHelpersAddress},
weights::CommonWeights,
@@ -26,7 +25,10 @@
},
Runtime, Event, Call, Balances,
};
-use common_types::{AccountId, Balance, BlockNumber};
+use up_common::{
+ types::{AccountId, Balance, BlockNumber},
+ constants::*,
+};
use up_data_structs::{
mapping::{EvmTokenAddressMapping, CrossTokenAddressMapping},
};
runtime/common/config/pallets/scheduler.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/scheduler.rs
+++ b/runtime/common/config/pallets/scheduler.rs
@@ -22,7 +22,7 @@
runtime_common::{scheduler::SchedulerPaymentExecutor, config::substrate::RuntimeBlockWeights},
Runtime, Call, Event, Origin, OriginCaller, Balances,
};
-use common_types::AccountId;
+use up_common::types::AccountId;
parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *
runtime/common/config/parachain.rsdiffbeforeafterboth--- a/runtime/common/config/parachain.rs
+++ b/runtime/common/config/parachain.rs
@@ -15,7 +15,8 @@
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
use frame_support::{weights::Weight, parameter_types};
-use crate::{runtime_common::constants::*, Runtime, Event, XcmpQueue, DmpQueue};
+use crate::{Runtime, Event, XcmpQueue, DmpQueue};
+use up_common::constants::*;
parameter_types! {
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
runtime/common/config/sponsoring.rsdiffbeforeafterboth--- a/runtime/common/config/sponsoring.rs
+++ b/runtime/common/config/sponsoring.rs
@@ -16,10 +16,10 @@
use frame_support::parameter_types;
use crate::{
- runtime_common::{constants::*, sponsoring::UniqueSponsorshipHandler},
+ runtime_common::{sponsoring::UniqueSponsorshipHandler},
Runtime,
};
-use common_types::BlockNumber;
+use up_common::{types::BlockNumber, constants::*};
parameter_types! {
pub const DefaultSponsoringRateLimit: BlockNumber = 1 * DAYS;
runtime/common/config/substrate.rsdiffbeforeafterboth--- a/runtime/common/config/substrate.rs
+++ b/runtime/common/config/substrate.rs
@@ -35,10 +35,10 @@
use sp_arithmetic::traits::{BaseArithmetic, Unsigned};
use smallvec::smallvec;
use crate::{
- runtime_common::{DealWithFees, constants::*},
- Runtime, Event, Call, Origin, PalletInfo, System, Balances, Treasury, SS58Prefix, Version,
+ runtime_common::DealWithFees, Runtime, Event, Call, Origin, PalletInfo, System, Balances,
+ Treasury, SS58Prefix, Version,
};
-use common_types::*;
+use up_common::{types::*, constants::*};
parameter_types! {
pub const BlockHashCount: BlockNumber = 2400;
runtime/common/config/xcm.rsdiffbeforeafterboth--- a/runtime/common/config/xcm.rs
+++ b/runtime/common/config/xcm.rs
@@ -44,10 +44,13 @@
use xcm_executor::{Config, XcmExecutor, Assets};
use sp_std::marker::PhantomData;
use crate::{
- runtime_common::{constants::*, config::substrate::LinearFee},
- Runtime, Call, Event, Origin, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, XcmpQueue,
+ runtime_common::config::substrate::LinearFee, Runtime, Call, Event, Origin, Balances,
+ ParachainInfo, ParachainSystem, PolkadotXcm, XcmpQueue,
+};
+use up_common::{
+ types::{AccountId, Balance},
+ constants::*,
};
-use common_types::{AccountId, Balance};
parameter_types! {
pub const RelayLocation: MultiLocation = MultiLocation::parent();
runtime/common/constants.rsdiffbeforeafterboth--- a/runtime/common/constants.rs
+++ b/runtime/common/constants.rs
@@ -19,7 +19,7 @@
parameter_types,
weights::{Weight, constants::WEIGHT_PER_SECOND},
};
-use common_types::{BlockNumber, Balance};
+use up_common::types::{BlockNumber, Balance};
pub const MILLISECS_PER_BLOCK: u64 = 12000;
runtime/common/instance.rsdiffbeforeafterboth--- a/runtime/common/instance.rs
+++ b/runtime/common/instance.rs
@@ -4,7 +4,7 @@
},
Runtime,
};
-use common_types::opaque::RuntimeInstance;
+use up_common::types::opaque::RuntimeInstance;
impl RuntimeInstance for Runtime {
type CrossAccountId = CrossAccountId;
runtime/common/mod.rsdiffbeforeafterboth--- a/runtime/common/mod.rs
+++ b/runtime/common/mod.rs
@@ -41,7 +41,7 @@
Runtime, Call, Balances, Treasury, Aura, Signature, AllPalletsReversedWithSystemFirst,
InherentDataExt,
};
-use common_types::{AccountId, BlockNumber};
+use up_common::types::{AccountId, BlockNumber};
#[macro_export]
macro_rules! unsupported {
runtime/common/scheduler.rsdiffbeforeafterboth--- a/runtime/common/scheduler.rs
+++ b/runtime/common/scheduler.rs
@@ -25,7 +25,7 @@
DispatchErrorWithPostInfo, DispatchError,
};
use crate::{Runtime, Call, Origin, Balances, ChargeTransactionPayment};
-use common_types::{AccountId, Balance};
+use up_common::types::{AccountId, Balance};
use fp_self_contained::SelfContainedCall;
use pallet_unique_scheduler::DispatchCall;
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -113,7 +113,7 @@
'xcm/std',
'xcm-builder/std',
'xcm-executor/std',
- 'common-types/std',
+ 'up-common/std',
'rmrk-rpc/std',
'evm-coder/std',
'up-sponsorship/std',
@@ -403,7 +403,7 @@
[dependencies]
log = { version = "0.4.16", default-features = false }
-common-types = { path = "../../common-types", default-features = false }
+up-common = { path = "../../primitives/common", default-features = false }
scale-info = { version = "2.0.1", default-features = false, features = [
"derive",
] }
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -30,7 +30,7 @@
use sp_version::RuntimeVersion;
use sp_runtime::create_runtime_str;
-use common_types::*;
+use up_common::types::*;
#[path = "../../common/mod.rs"]
mod runtime_common;
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -113,7 +113,7 @@
'xcm/std',
'xcm-builder/std',
'xcm-executor/std',
- 'common-types/std',
+ 'up-common/std',
"orml-vesting/std",
]
@@ -408,7 +408,7 @@
[dependencies]
log = { version = "0.4.16", default-features = false }
-common-types = { path = "../../common-types", default-features = false }
+up-common = { path = "../../primitives/common", default-features = false }
scale-info = { version = "2.0.1", default-features = false, features = [
"derive",
] }
runtime/quartz/src/lib.rsdiffbeforeafterboth--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -30,7 +30,7 @@
use sp_version::RuntimeVersion;
use sp_runtime::create_runtime_str;
-use common_types::*;
+use up_common::types::*;
#[path = "../../common/mod.rs"]
mod runtime_common;
runtime/tests/Cargo.tomldiffbeforeafterboth--- a/runtime/tests/Cargo.toml
+++ b/runtime/tests/Cargo.toml
@@ -42,6 +42,5 @@
] }
scale-info = "*"
-common-types = { path = "../../common-types", default-features = false }
evm-coder = { default-features = false, path = '../../crates/evm-coder' }
up-sponsorship = { default-features = false, git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = 'polkadot-v0.9.24' }
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -114,7 +114,7 @@
'xcm/std',
'xcm-builder/std',
'xcm-executor/std',
- 'common-types/std',
+ 'up-common/std',
"orml-vesting/std",
]
@@ -401,7 +401,7 @@
[dependencies]
log = { version = "0.4.16", default-features = false }
-common-types = { path = "../../common-types", default-features = false }
+up-common = { path = "../../primitives/common", default-features = false }
scale-info = { version = "2.0.1", default-features = false, features = [
"derive",
] }
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -30,7 +30,7 @@
use sp_version::RuntimeVersion;
use sp_runtime::create_runtime_str;
-use common_types::*;
+use up_common::types::*;
#[path = "../../common/mod.rs"]
mod runtime_common;