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.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -63,7 +63,7 @@
use fc_rpc_core::types::FilterPool;
use fc_mapping_sync::{MappingSyncWorker, SyncStrategy};
-use common_types::opaque::{AuraId, RuntimeInstance, AccountId, Balance, Index, Hash, Block};
+use up_common::types::opaque::{AuraId, RuntimeInstance, AccountId, Balance, Index, Hash, Block};
// RMRK
use up_data_structs::{
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.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/>.1617use frame_support::{18 traits::{Everything, ConstU32},19 weights::{20 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},21 DispatchClass, WeightToFeePolynomial, WeightToFeeCoefficients, ConstantMultiplier,22 WeightToFeeCoefficient,23 },24 parameter_types, PalletId,25};26use sp_runtime::{27 generic,28 traits::{BlakeTwo256, AccountIdLookup},29 Perbill, Permill, Percent,30};31use frame_system::{32 limits::{BlockLength, BlockWeights},33 EnsureRoot,34};35use sp_arithmetic::traits::{BaseArithmetic, Unsigned};36use smallvec::smallvec;37use crate::{38 runtime_common::{DealWithFees, constants::*},39 Runtime, Event, Call, Origin, PalletInfo, System, Balances, Treasury, SS58Prefix, Version,40};41use common_types::*;4243parameter_types! {44 pub const BlockHashCount: BlockNumber = 2400;45 pub RuntimeBlockLength: BlockLength =46 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);47 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);48 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;49 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()50 .base_block(BlockExecutionWeight::get())51 .for_class(DispatchClass::all(), |weights| {52 weights.base_extrinsic = ExtrinsicBaseWeight::get();53 })54 .for_class(DispatchClass::Normal, |weights| {55 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);56 })57 .for_class(DispatchClass::Operational, |weights| {58 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);59 // Operational transactions have some extra reserved space, so that they60 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.61 weights.reserved = Some(62 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT63 );64 })65 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)66 .build_or_panic();67}6869impl frame_system::Config for Runtime {70 /// The data to be stored in an account.71 type AccountData = pallet_balances::AccountData<Balance>;72 /// The identifier used to distinguish between accounts.73 type AccountId = AccountId;74 /// The basic call filter to use in dispatchable.75 type BaseCallFilter = Everything;76 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).77 type BlockHashCount = BlockHashCount;78 /// The maximum length of a block (in bytes).79 type BlockLength = RuntimeBlockLength;80 /// The index type for blocks.81 type BlockNumber = BlockNumber;82 /// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.83 type BlockWeights = RuntimeBlockWeights;84 /// The aggregated dispatch type that is available for extrinsics.85 type Call = Call;86 /// The weight of database operations that the runtime can invoke.87 type DbWeight = RocksDbWeight;88 /// The ubiquitous event type.89 type Event = Event;90 /// The type for hashing blocks and tries.91 type Hash = Hash;92 /// The hashing algorithm used.93 type Hashing = BlakeTwo256;94 /// The header type.95 type Header = generic::Header<BlockNumber, BlakeTwo256>;96 /// The index type for storing how many extrinsics an account has signed.97 type Index = Index;98 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.99 type Lookup = AccountIdLookup<AccountId, ()>;100 /// What to do if an account is fully reaped from the system.101 type OnKilledAccount = ();102 /// What to do if a new account is created.103 type OnNewAccount = ();104 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;105 /// The ubiquitous origin type.106 type Origin = Origin;107 /// This type is being generated by `construct_runtime!`.108 type PalletInfo = PalletInfo;109 /// This is used as an identifier of the chain. 42 is the generic substrate prefix.110 type SS58Prefix = SS58Prefix;111 /// Weight information for the extrinsics of this pallet.112 type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;113 /// Version of the runtime.114 type Version = Version;115 type MaxConsumers = ConstU32<16>;116}117118impl pallet_randomness_collective_flip::Config for Runtime {}119120parameter_types! {121 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;122}123124impl pallet_timestamp::Config for Runtime {125 /// A timestamp: milliseconds since the unix epoch.126 type Moment = u64;127 type OnTimestampSet = ();128 type MinimumPeriod = MinimumPeriod;129 type WeightInfo = ();130}131132parameter_types! {133 // pub const ExistentialDeposit: u128 = 500;134 pub const ExistentialDeposit: u128 = 0;135 pub const MaxLocks: u32 = 50;136 pub const MaxReserves: u32 = 50;137}138139impl pallet_balances::Config for Runtime {140 type MaxLocks = MaxLocks;141 type MaxReserves = MaxReserves;142 type ReserveIdentifier = [u8; 16];143 /// The type for recording an account's balance.144 type Balance = Balance;145 /// The ubiquitous event type.146 type Event = Event;147 type DustRemoval = Treasury;148 type ExistentialDeposit = ExistentialDeposit;149 type AccountStore = System;150 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;151}152153parameter_types! {154 /// This value increases the priority of `Operational` transactions by adding155 /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.156 pub const OperationalFeeMultiplier: u8 = 5;157}158159/// Linear implementor of `WeightToFeePolynomial`160pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);161162impl<T> WeightToFeePolynomial for LinearFee<T>163where164 T: BaseArithmetic + From<u32> + Copy + Unsigned,165{166 type Balance = T;167168 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {169 smallvec!(WeightToFeeCoefficient {170 coeff_integer: WEIGHT_TO_FEE_COEFF.into(),171 coeff_frac: Perbill::zero(),172 negative: false,173 degree: 1,174 })175 }176}177178impl pallet_transaction_payment::Config for Runtime {179 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;180 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;181 type OperationalFeeMultiplier = OperationalFeeMultiplier;182 type WeightToFee = LinearFee<Balance>;183 type FeeMultiplierUpdate = ();184}185186parameter_types! {187 pub const ProposalBond: Permill = Permill::from_percent(5);188 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;189 pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;190 pub const SpendPeriod: BlockNumber = 5 * MINUTES;191 pub const Burn: Permill = Permill::from_percent(0);192 pub const TipCountdown: BlockNumber = 1 * DAYS;193 pub const TipFindersFee: Percent = Percent::from_percent(20);194 pub const TipReportDepositBase: Balance = 1 * UNIQUE;195 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;196 pub const BountyDepositBase: Balance = 1 * UNIQUE;197 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;198 pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");199 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;200 pub const MaximumReasonLength: u32 = 16384;201 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);202 pub const BountyValueMinimum: Balance = 5 * UNIQUE;203 pub const MaxApprovals: u32 = 100;204}205206impl pallet_treasury::Config for Runtime {207 type PalletId = TreasuryModuleId;208 type Currency = Balances;209 type ApproveOrigin = EnsureRoot<AccountId>;210 type RejectOrigin = EnsureRoot<AccountId>;211 type Event = Event;212 type OnSlash = ();213 type ProposalBond = ProposalBond;214 type ProposalBondMinimum = ProposalBondMinimum;215 type ProposalBondMaximum = ProposalBondMaximum;216 type SpendPeriod = SpendPeriod;217 type Burn = Burn;218 type BurnDestination = ();219 type SpendFunds = ();220 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;221 type MaxApprovals = MaxApprovals;222}223224impl pallet_sudo::Config for Runtime {225 type Event = Event;226 type Call = Call;227}228229parameter_types! {230 pub const MaxAuthorities: u32 = 100_000;231}232233impl pallet_aura::Config for Runtime {234 type AuthorityId = AuraId;235 type DisabledValidators = ();236 type MaxAuthorities = MaxAuthorities;237}1// 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/>.1617use frame_support::{18 traits::{Everything, ConstU32},19 weights::{20 constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},21 DispatchClass, WeightToFeePolynomial, WeightToFeeCoefficients, ConstantMultiplier,22 WeightToFeeCoefficient,23 },24 parameter_types, PalletId,25};26use sp_runtime::{27 generic,28 traits::{BlakeTwo256, AccountIdLookup},29 Perbill, Permill, Percent,30};31use frame_system::{32 limits::{BlockLength, BlockWeights},33 EnsureRoot,34};35use sp_arithmetic::traits::{BaseArithmetic, Unsigned};36use smallvec::smallvec;37use crate::{38 runtime_common::DealWithFees, Runtime, Event, Call, Origin, PalletInfo, System, Balances,39 Treasury, SS58Prefix, Version,40};41use up_common::{types::*, constants::*};4243parameter_types! {44 pub const BlockHashCount: BlockNumber = 2400;45 pub RuntimeBlockLength: BlockLength =46 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);47 pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);48 pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;49 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()50 .base_block(BlockExecutionWeight::get())51 .for_class(DispatchClass::all(), |weights| {52 weights.base_extrinsic = ExtrinsicBaseWeight::get();53 })54 .for_class(DispatchClass::Normal, |weights| {55 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);56 })57 .for_class(DispatchClass::Operational, |weights| {58 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);59 // Operational transactions have some extra reserved space, so that they60 // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.61 weights.reserved = Some(62 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT63 );64 })65 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)66 .build_or_panic();67}6869impl frame_system::Config for Runtime {70 /// The data to be stored in an account.71 type AccountData = pallet_balances::AccountData<Balance>;72 /// The identifier used to distinguish between accounts.73 type AccountId = AccountId;74 /// The basic call filter to use in dispatchable.75 type BaseCallFilter = Everything;76 /// Maximum number of block number to block hash mappings to keep (oldest pruned first).77 type BlockHashCount = BlockHashCount;78 /// The maximum length of a block (in bytes).79 type BlockLength = RuntimeBlockLength;80 /// The index type for blocks.81 type BlockNumber = BlockNumber;82 /// The weight of the overhead invoked on the block import process, independent of the extrinsics included in that block.83 type BlockWeights = RuntimeBlockWeights;84 /// The aggregated dispatch type that is available for extrinsics.85 type Call = Call;86 /// The weight of database operations that the runtime can invoke.87 type DbWeight = RocksDbWeight;88 /// The ubiquitous event type.89 type Event = Event;90 /// The type for hashing blocks and tries.91 type Hash = Hash;92 /// The hashing algorithm used.93 type Hashing = BlakeTwo256;94 /// The header type.95 type Header = generic::Header<BlockNumber, BlakeTwo256>;96 /// The index type for storing how many extrinsics an account has signed.97 type Index = Index;98 /// The lookup mechanism to get account ID from whatever is passed in dispatchers.99 type Lookup = AccountIdLookup<AccountId, ()>;100 /// What to do if an account is fully reaped from the system.101 type OnKilledAccount = ();102 /// What to do if a new account is created.103 type OnNewAccount = ();104 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;105 /// The ubiquitous origin type.106 type Origin = Origin;107 /// This type is being generated by `construct_runtime!`.108 type PalletInfo = PalletInfo;109 /// This is used as an identifier of the chain. 42 is the generic substrate prefix.110 type SS58Prefix = SS58Prefix;111 /// Weight information for the extrinsics of this pallet.112 type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;113 /// Version of the runtime.114 type Version = Version;115 type MaxConsumers = ConstU32<16>;116}117118impl pallet_randomness_collective_flip::Config for Runtime {}119120parameter_types! {121 pub const MinimumPeriod: u64 = SLOT_DURATION / 2;122}123124impl pallet_timestamp::Config for Runtime {125 /// A timestamp: milliseconds since the unix epoch.126 type Moment = u64;127 type OnTimestampSet = ();128 type MinimumPeriod = MinimumPeriod;129 type WeightInfo = ();130}131132parameter_types! {133 // pub const ExistentialDeposit: u128 = 500;134 pub const ExistentialDeposit: u128 = 0;135 pub const MaxLocks: u32 = 50;136 pub const MaxReserves: u32 = 50;137}138139impl pallet_balances::Config for Runtime {140 type MaxLocks = MaxLocks;141 type MaxReserves = MaxReserves;142 type ReserveIdentifier = [u8; 16];143 /// The type for recording an account's balance.144 type Balance = Balance;145 /// The ubiquitous event type.146 type Event = Event;147 type DustRemoval = Treasury;148 type ExistentialDeposit = ExistentialDeposit;149 type AccountStore = System;150 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;151}152153parameter_types! {154 /// This value increases the priority of `Operational` transactions by adding155 /// a "virtual tip" that's equal to the `OperationalFeeMultiplier * final_fee`.156 pub const OperationalFeeMultiplier: u8 = 5;157}158159/// Linear implementor of `WeightToFeePolynomial`160pub struct LinearFee<T>(sp_std::marker::PhantomData<T>);161162impl<T> WeightToFeePolynomial for LinearFee<T>163where164 T: BaseArithmetic + From<u32> + Copy + Unsigned,165{166 type Balance = T;167168 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {169 smallvec!(WeightToFeeCoefficient {170 coeff_integer: WEIGHT_TO_FEE_COEFF.into(),171 coeff_frac: Perbill::zero(),172 negative: false,173 degree: 1,174 })175 }176}177178impl pallet_transaction_payment::Config for Runtime {179 type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, DealWithFees>;180 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;181 type OperationalFeeMultiplier = OperationalFeeMultiplier;182 type WeightToFee = LinearFee<Balance>;183 type FeeMultiplierUpdate = ();184}185186parameter_types! {187 pub const ProposalBond: Permill = Permill::from_percent(5);188 pub const ProposalBondMinimum: Balance = 1 * UNIQUE;189 pub const ProposalBondMaximum: Balance = 1000 * UNIQUE;190 pub const SpendPeriod: BlockNumber = 5 * MINUTES;191 pub const Burn: Permill = Permill::from_percent(0);192 pub const TipCountdown: BlockNumber = 1 * DAYS;193 pub const TipFindersFee: Percent = Percent::from_percent(20);194 pub const TipReportDepositBase: Balance = 1 * UNIQUE;195 pub const DataDepositPerByte: Balance = 1 * CENTIUNIQUE;196 pub const BountyDepositBase: Balance = 1 * UNIQUE;197 pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;198 pub const TreasuryModuleId: PalletId = PalletId(*b"py/trsry");199 pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;200 pub const MaximumReasonLength: u32 = 16384;201 pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);202 pub const BountyValueMinimum: Balance = 5 * UNIQUE;203 pub const MaxApprovals: u32 = 100;204}205206impl pallet_treasury::Config for Runtime {207 type PalletId = TreasuryModuleId;208 type Currency = Balances;209 type ApproveOrigin = EnsureRoot<AccountId>;210 type RejectOrigin = EnsureRoot<AccountId>;211 type Event = Event;212 type OnSlash = ();213 type ProposalBond = ProposalBond;214 type ProposalBondMinimum = ProposalBondMinimum;215 type ProposalBondMaximum = ProposalBondMaximum;216 type SpendPeriod = SpendPeriod;217 type Burn = Burn;218 type BurnDestination = ();219 type SpendFunds = ();220 type WeightInfo = pallet_treasury::weights::SubstrateWeight<Self>;221 type MaxApprovals = MaxApprovals;222}223224impl pallet_sudo::Config for Runtime {225 type Event = Event;226 type Call = Call;227}228229parameter_types! {230 pub const MaxAuthorities: u32 = 100_000;231}232233impl pallet_aura::Config for Runtime {234 type AuthorityId = AuraId;235 type DisabledValidators = ();236 type MaxAuthorities = MaxAuthorities;237}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;