difftreelog
Merge pull request #993 from UniqueNetwork/fix/governance-with-batch
in: master
Fix/governance with batch
10 files changed
Cargo.tomldiffbeforeafterboth--- a/Cargo.toml
+++ b/Cargo.toml
@@ -119,6 +119,7 @@
pallet-state-trie-migration = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-sudo = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-timestamp = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
+pallet-utility = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-transaction-payment = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
runtime/common/config/governance/technical_committee.rsdiffbeforeafterboth--- a/runtime/common/config/governance/technical_committee.rs
+++ b/runtime/common/config/governance/technical_committee.rs
@@ -38,7 +38,7 @@
type RemoveOrigin = RootOrMoreThanHalfCouncil;
type SwapOrigin = RootOrMoreThanHalfCouncil;
type ResetOrigin = EnsureRoot<AccountId>;
- type PrimeOrigin = EnsureRoot<AccountId>;
+ type PrimeOrigin = RootOrMoreThanHalfCouncil;
type MembershipInitialized = TechnicalCommittee;
type MembershipChanged = TechnicalCommittee;
type MaxMembers = TechnicalMaxMembers;
runtime/common/config/substrate.rsdiffbeforeafterboth--- a/runtime/common/config/substrate.rs
+++ b/runtime/common/config/substrate.rs
@@ -35,8 +35,8 @@
};
use pallet_transaction_payment::{Multiplier, ConstFeeMultiplier};
use crate::{
- runtime_common::DealWithFees, Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, PalletInfo,
- System, Balances, SS58Prefix, Version,
+ runtime_common::DealWithFees, Runtime, RuntimeEvent, RuntimeCall, RuntimeOrigin, OriginCaller,
+ PalletInfo, System, Balances, SS58Prefix, Version,
};
use up_common::{types::*, constants::*};
use sp_std::vec;
@@ -248,3 +248,10 @@
type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
}
+
+impl pallet_utility::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type RuntimeCall = RuntimeCall;
+ type PalletsOrigin = OriginCaller;
+ type WeightInfo = pallet_utility::weights::SubstrateWeight<Self>;
+}
runtime/common/construct_runtime.rsdiffbeforeafterboth--- a/runtime/common/construct_runtime.rs
+++ b/runtime/common/construct_runtime.rs
@@ -136,6 +136,8 @@
BalancesAdapter: pallet_balances_adapter = 155,
+ Utility: pallet_utility = 156,
+
#[cfg(feature = "pallet-test-utils")]
TestUtils: pallet_test_utils = 255,
}
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -58,6 +58,7 @@
'pallet-refungible/runtime-benchmarks',
'pallet-structure/runtime-benchmarks',
'pallet-timestamp/runtime-benchmarks',
+ 'pallet-utility/runtime-benchmarks',
'pallet-unique-scheduler-v2/runtime-benchmarks',
'pallet-unique/runtime-benchmarks',
'pallet-xcm/runtime-benchmarks',
@@ -120,6 +121,7 @@
'pallet-structure/std',
'pallet-sudo/std',
'pallet-timestamp/std',
+ 'pallet-utility/std',
'pallet-transaction-payment-rpc-runtime-api/std',
'pallet-transaction-payment/std',
'pallet-treasury/std',
@@ -213,6 +215,7 @@
'pallet-sudo/try-runtime',
'pallet-test-utils?/try-runtime',
'pallet-timestamp/try-runtime',
+ 'pallet-utility/try-runtime',
'pallet-transaction-payment/try-runtime',
'pallet-treasury/try-runtime',
'pallet-unique-scheduler-v2/try-runtime',
@@ -263,6 +266,7 @@
pallet-state-trie-migration = { workspace = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
+pallet-utility = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
pallet-treasury = { workspace = true }
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -55,6 +55,7 @@
'pallet-scheduler/runtime-benchmarks',
'pallet-structure/runtime-benchmarks',
'pallet-timestamp/runtime-benchmarks',
+ 'pallet-utility/runtime-benchmarks',
'pallet-unique/runtime-benchmarks',
'pallet-xcm/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
@@ -120,6 +121,7 @@
'pallet-structure/std',
'pallet-sudo/std',
'pallet-timestamp/std',
+ 'pallet-utility/std',
'pallet-transaction-payment-rpc-runtime-api/std',
'pallet-transaction-payment/std',
'pallet-treasury/std',
@@ -203,6 +205,7 @@
'pallet-structure/try-runtime',
'pallet-sudo/try-runtime',
'pallet-timestamp/try-runtime',
+ 'pallet-utility/try-runtime',
'pallet-transaction-payment/try-runtime',
'pallet-treasury/try-runtime',
'pallet-unique/try-runtime',
@@ -252,6 +255,7 @@
pallet-state-trie-migration = { workspace = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
+pallet-utility = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
pallet-treasury = { workspace = true }
runtime/unique/Cargo.tomldiffbeforeafterboth1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Unique Runtime'8edition = '2021'9homepage = 'https://unique.network'10license = 'GPLv3'11name = 'unique-runtime'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version.workspace = true1415[package.metadata.docs.rs]16targets = ['x86_64-unknown-linux-gnu']1718[features]19default = ['std', 'unique-runtime']20limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']21pov-estimate = []22runtime-benchmarks = [23 "pallet-preimage/runtime-benchmarks",24 'frame-benchmarking',25 'frame-support/runtime-benchmarks',26 'frame-system-benchmarking',27 'frame-system/runtime-benchmarks',28 'pallet-app-promotion/runtime-benchmarks',29 'pallet-balances/runtime-benchmarks',30 'pallet-collator-selection/runtime-benchmarks',31 'pallet-collective/runtime-benchmarks',32 'pallet-common/runtime-benchmarks',33 'pallet-configuration/runtime-benchmarks',34 'pallet-democracy/runtime-benchmarks',35 'pallet-ethereum/runtime-benchmarks',36 'pallet-evm-coder-substrate/runtime-benchmarks',37 'pallet-evm-migration/runtime-benchmarks',38 'pallet-foreign-assets/runtime-benchmarks',39 'pallet-fungible/runtime-benchmarks',40 'pallet-identity/runtime-benchmarks',41 'pallet-inflation/runtime-benchmarks',42 'pallet-maintenance/runtime-benchmarks',43 'pallet-membership/runtime-benchmarks',44 'pallet-nonfungible/runtime-benchmarks',45 'pallet-democracy/runtime-benchmarks',46 'pallet-collective/runtime-benchmarks',47 'pallet-ranked-collective/runtime-benchmarks',48 'pallet-membership/runtime-benchmarks',49 'pallet-referenda/runtime-benchmarks',50 'pallet-scheduler/runtime-benchmarks',51 'pallet-refungible/runtime-benchmarks',52 'pallet-scheduler/runtime-benchmarks',53 'pallet-structure/runtime-benchmarks',54 'pallet-timestamp/runtime-benchmarks',55 'pallet-unique/runtime-benchmarks',56 'pallet-xcm/runtime-benchmarks',57 'sp-runtime/runtime-benchmarks',58 'up-data-structs/runtime-benchmarks',59 'xcm-builder/runtime-benchmarks',60]61std = [62 'codec/std',63 'cumulus-pallet-aura-ext/std',64 'cumulus-pallet-parachain-system/std',65 'cumulus-pallet-xcm/std',66 'cumulus-pallet-xcmp-queue/std',67 'cumulus-primitives-core/std',68 'cumulus-primitives-utility/std',69 'frame-executive/std',70 'frame-support/std',71 'frame-system-rpc-runtime-api/std',72 'frame-system/std',73 'frame-try-runtime/std',74 'pallet-aura/std',75 'pallet-balances/std',76 'pallet-collective/std',77 'pallet-democracy/std',78 'pallet-membership/std',79 'pallet-scheduler/std',80 # 'pallet-contracts/std',81 # 'pallet-contracts-primitives/std',82 # 'pallet-contracts-rpc-runtime-api/std',83 # 'pallet-contract-helpers/std',84 "pallet-authorship/std",85 "pallet-identity/std",86 "pallet-preimage/std",87 "pallet-session/std",88 "pallet-state-trie-migration/std",89 "sp-consensus-aura/std",90 'app-promotion-rpc/std',91 'evm-coder/std',92 'fp-rpc/std',93 'fp-self-contained/std',94 'pallet-app-promotion/std',95 'pallet-balances-adapter/std',96 'pallet-base-fee/std',97 'pallet-charge-transaction/std',98 'pallet-collator-selection/std',99 'pallet-common/std',100 'pallet-configuration/std',101 'pallet-ethereum/std',102 'pallet-evm-coder-substrate/std',103 'pallet-evm-contract-helpers/std',104 'pallet-evm-migration/std',105 'pallet-evm-transaction-payment/std',106 'pallet-evm/std',107 'pallet-fungible/std',108 'pallet-inflation/std',109 'pallet-nonfungible/std',110 'pallet-democracy/std',111 'pallet-collective/std',112 'pallet-ranked-collective/std',113 'pallet-membership/std',114 'pallet-referenda/std',115 'pallet-gov-origins/std',116 'pallet-scheduler/std',117 'pallet-refungible/std',118 'pallet-structure/std',119 'pallet-sudo/std',120 'pallet-timestamp/std',121 'pallet-transaction-payment-rpc-runtime-api/std',122 'pallet-transaction-payment/std',123 'pallet-treasury/std',124 'pallet-unique/std',125 'parachain-info/std',126 'sp-api/std',127 'sp-block-builder/std',128 'sp-core/std',129 'sp-inherents/std',130 'sp-io/std',131 'sp-offchain/std',132 'sp-runtime/std',133 'sp-session/std',134 'sp-std/std',135 'sp-transaction-pool/std',136 'sp-version/std',137 'up-common/std',138 'up-data-structs/std',139 'up-pov-estimate-rpc/std',140 'up-rpc/std',141 'up-sponsorship/std',142 'xcm-builder/std',143 'xcm-executor/std',144 'xcm/std',145146 "orml-tokens/std",147 "orml-traits/std",148 "orml-vesting/std",149 "orml-xcm-support/std",150 "orml-xtokens/std",151 "pallet-foreign-assets/std",152 "pallet-maintenance/std",153]154stubgen = ["evm-coder/stubgen"]155try-runtime = [156 "pallet-authorship/try-runtime",157 "pallet-collator-selection/try-runtime",158 "pallet-identity/try-runtime",159 "pallet-preimage/try-runtime",160 "pallet-session/try-runtime",161 "pallet-state-trie-migration/try-runtime",162 'cumulus-pallet-aura-ext/try-runtime',163 'cumulus-pallet-dmp-queue/try-runtime',164 'cumulus-pallet-parachain-system/try-runtime',165 'cumulus-pallet-xcm/try-runtime',166 'cumulus-pallet-xcmp-queue/try-runtime',167 'fp-self-contained/try-runtime',168 'frame-executive/try-runtime',169 'frame-support/try-runtime',170 'frame-system/try-runtime',171 'frame-try-runtime',172 'orml-tokens/try-runtime',173 'orml-vesting/try-runtime',174 'orml-xtokens/try-runtime',175 'pallet-app-promotion/try-runtime',176 'pallet-aura/try-runtime',177 'pallet-balances-adapter/try-runtime',178 'pallet-balances/try-runtime',179 'pallet-charge-transaction/try-runtime',180 'pallet-collective/try-runtime',181 'pallet-common/try-runtime',182 'pallet-configuration/try-runtime',183 'pallet-democracy/try-runtime',184 'pallet-ethereum/try-runtime',185 'pallet-evm-coder-substrate/try-runtime',186 'pallet-evm-contract-helpers/try-runtime',187 'pallet-evm-migration/try-runtime',188 'pallet-evm-transaction-payment/try-runtime',189 'pallet-evm/try-runtime',190 'pallet-foreign-assets/try-runtime',191 'pallet-fungible/try-runtime',192 'pallet-inflation/try-runtime',193 'pallet-maintenance/try-runtime',194 'pallet-membership/try-runtime',195 'pallet-nonfungible/try-runtime',196 'pallet-democracy/try-runtime',197 'pallet-collective/try-runtime',198 'pallet-ranked-collective/try-runtime',199 'pallet-membership/try-runtime',200 'pallet-referenda/try-runtime',201 'pallet-gov-origins/try-runtime',202 'pallet-scheduler/try-runtime',203 'pallet-refungible/try-runtime',204 'pallet-scheduler/try-runtime',205 'pallet-structure/try-runtime',206 'pallet-sudo/try-runtime',207 'pallet-timestamp/try-runtime',208 'pallet-transaction-payment/try-runtime',209 'pallet-treasury/try-runtime',210 'pallet-unique/try-runtime',211 'pallet-xcm/try-runtime',212 'parachain-info/try-runtime',213]214unique-runtime = ['app-promotion', 'foreign-assets', 'refungible']215216app-promotion = []217collator-selection = []218foreign-assets = []219governance = []220preimage = []221refungible = []222unique-scheduler = []223gov-test-timings = []224session-test-timings = []225226################################################################################227# local dependencies228229[dependencies]230# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.231codec = { workspace = true, package = "parity-scale-codec" }232233cumulus-pallet-aura-ext = { workspace = true }234cumulus-pallet-dmp-queue = { workspace = true }235cumulus-pallet-parachain-system = { workspace = true }236cumulus-pallet-xcm = { workspace = true }237cumulus-pallet-xcmp-queue = { workspace = true }238cumulus-primitives-core = { workspace = true }239cumulus-primitives-timestamp = { workspace = true }240cumulus-primitives-utility = { workspace = true }241frame-executive = { workspace = true }242frame-support = { workspace = true }243frame-system = { workspace = true }244frame-system-rpc-runtime-api = { workspace = true }245orml-tokens = { workspace = true }246orml-traits = { workspace = true }247orml-vesting = { workspace = true }248orml-xcm-support = { workspace = true }249orml-xtokens = { workspace = true }250pallet-aura = { workspace = true }251pallet-authorship = { workspace = true }252pallet-balances = { features = ["insecure_zero_ed"], workspace = true }253pallet-preimage = { workspace = true }254pallet-session = { workspace = true }255pallet-state-trie-migration = { workspace = true }256pallet-sudo = { workspace = true }257pallet-timestamp = { workspace = true }258pallet-transaction-payment = { workspace = true }259pallet-transaction-payment-rpc-runtime-api = { workspace = true }260pallet-treasury = { workspace = true }261pallet-xcm = { workspace = true }262parachain-info = { workspace = true }263polkadot-parachain = { workspace = true }264smallvec = { workspace = true }265sp-api = { workspace = true }266sp-arithmetic = { workspace = true }267sp-block-builder = { workspace = true }268sp-consensus-aura = { workspace = true }269sp-core = { workspace = true }270sp-inherents = { workspace = true }271sp-io = { workspace = true }272sp-offchain = { workspace = true }273sp-runtime = { workspace = true }274sp-session = { workspace = true }275sp-std = { workspace = true }276sp-transaction-pool = { workspace = true }277sp-version = { workspace = true }278xcm = { workspace = true }279xcm-builder = { workspace = true }280xcm-executor = { workspace = true }281282app-promotion-rpc = { workspace = true }283derivative = { workspace = true }284log = { workspace = true }285pallet-app-promotion = { workspace = true }286pallet-balances-adapter = { workspace = true }287pallet-collator-selection = { workspace = true }288pallet-common = { workspace = true }289pallet-configuration = { workspace = true }290pallet-fungible = { workspace = true }291pallet-identity = { workspace = true }292pallet-inflation = { workspace = true }293pallet-nonfungible = { workspace = true }294pallet-democracy = { workspace = true }295pallet-collective = { workspace = true }296pallet-ranked-collective = { workspace = true }297pallet-membership = { workspace = true }298pallet-referenda = { workspace = true }299pallet-gov-origins = { workspace = true }300pallet-scheduler = { workspace = true }301pallet-refungible = { workspace = true }302pallet-structure = { workspace = true }303pallet-unique = { workspace = true }304scale-info = { workspace = true }305up-common = { workspace = true }306up-data-structs = { workspace = true }307up-pov-estimate-rpc = { workspace = true }308up-rpc = { workspace = true }309# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }310evm-coder = { workspace = true }311fp-evm = { workspace = true }312fp-rpc = { workspace = true }313fp-self-contained = { workspace = true }314num_enum = { workspace = true }315pallet-base-fee = { workspace = true }316pallet-charge-transaction = { workspace = true }317pallet-ethereum = { workspace = true }318pallet-evm = { workspace = true }319pallet-evm-coder-substrate = { workspace = true }320pallet-evm-contract-helpers = { workspace = true }321pallet-evm-migration = { workspace = true }322pallet-evm-precompile-simple = { workspace = true }323pallet-evm-transaction-payment = { workspace = true }324pallet-foreign-assets = { workspace = true }325pallet-maintenance = { workspace = true }326precompile-utils-macro = { workspace = true }327up-sponsorship = { workspace = true }328329################################################################################330# Optional dependencies331332frame-benchmarking = { workspace = true, optional = true }333frame-system-benchmarking = { workspace = true, optional = true }334frame-try-runtime = { workspace = true, optional = true }335serde = { workspace = true, optional = true }336337################################################################################338# Test dependencies339340pallet-test-utils = { workspace = true }341342################################################################################343# Other Dependencies344345hex-literal = { workspace = true }346impl-trait-for-tuples = { workspace = true }347348[build-dependencies]349substrate-wasm-builder = { workspace = true }1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Unique Runtime'8edition = '2021'9homepage = 'https://unique.network'10license = 'GPLv3'11name = 'unique-runtime'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version.workspace = true1415[package.metadata.docs.rs]16targets = ['x86_64-unknown-linux-gnu']1718[features]19default = ['std', 'unique-runtime']20limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']21pov-estimate = []22runtime-benchmarks = [23 "pallet-preimage/runtime-benchmarks",24 'frame-benchmarking',25 'frame-support/runtime-benchmarks',26 'frame-system-benchmarking',27 'frame-system/runtime-benchmarks',28 'pallet-app-promotion/runtime-benchmarks',29 'pallet-balances/runtime-benchmarks',30 'pallet-collator-selection/runtime-benchmarks',31 'pallet-collective/runtime-benchmarks',32 'pallet-common/runtime-benchmarks',33 'pallet-configuration/runtime-benchmarks',34 'pallet-democracy/runtime-benchmarks',35 'pallet-ethereum/runtime-benchmarks',36 'pallet-evm-coder-substrate/runtime-benchmarks',37 'pallet-evm-migration/runtime-benchmarks',38 'pallet-foreign-assets/runtime-benchmarks',39 'pallet-fungible/runtime-benchmarks',40 'pallet-identity/runtime-benchmarks',41 'pallet-inflation/runtime-benchmarks',42 'pallet-maintenance/runtime-benchmarks',43 'pallet-membership/runtime-benchmarks',44 'pallet-nonfungible/runtime-benchmarks',45 'pallet-democracy/runtime-benchmarks',46 'pallet-collective/runtime-benchmarks',47 'pallet-ranked-collective/runtime-benchmarks',48 'pallet-membership/runtime-benchmarks',49 'pallet-referenda/runtime-benchmarks',50 'pallet-scheduler/runtime-benchmarks',51 'pallet-refungible/runtime-benchmarks',52 'pallet-scheduler/runtime-benchmarks',53 'pallet-structure/runtime-benchmarks',54 'pallet-timestamp/runtime-benchmarks',55 'pallet-utility/runtime-benchmarks',56 'pallet-unique/runtime-benchmarks',57 'pallet-xcm/runtime-benchmarks',58 'sp-runtime/runtime-benchmarks',59 'up-data-structs/runtime-benchmarks',60 'xcm-builder/runtime-benchmarks',61]62std = [63 'codec/std',64 'cumulus-pallet-aura-ext/std',65 'cumulus-pallet-parachain-system/std',66 'cumulus-pallet-xcm/std',67 'cumulus-pallet-xcmp-queue/std',68 'cumulus-primitives-core/std',69 'cumulus-primitives-utility/std',70 'frame-executive/std',71 'frame-support/std',72 'frame-system-rpc-runtime-api/std',73 'frame-system/std',74 'frame-try-runtime/std',75 'pallet-aura/std',76 'pallet-balances/std',77 'pallet-collective/std',78 'pallet-democracy/std',79 'pallet-membership/std',80 'pallet-scheduler/std',81 # 'pallet-contracts/std',82 # 'pallet-contracts-primitives/std',83 # 'pallet-contracts-rpc-runtime-api/std',84 # 'pallet-contract-helpers/std',85 "pallet-authorship/std",86 "pallet-identity/std",87 "pallet-preimage/std",88 "pallet-session/std",89 "pallet-state-trie-migration/std",90 "sp-consensus-aura/std",91 'app-promotion-rpc/std',92 'evm-coder/std',93 'fp-rpc/std',94 'fp-self-contained/std',95 'pallet-app-promotion/std',96 'pallet-balances-adapter/std',97 'pallet-base-fee/std',98 'pallet-charge-transaction/std',99 'pallet-collator-selection/std',100 'pallet-common/std',101 'pallet-configuration/std',102 'pallet-ethereum/std',103 'pallet-evm-coder-substrate/std',104 'pallet-evm-contract-helpers/std',105 'pallet-evm-migration/std',106 'pallet-evm-transaction-payment/std',107 'pallet-evm/std',108 'pallet-fungible/std',109 'pallet-inflation/std',110 'pallet-nonfungible/std',111 'pallet-democracy/std',112 'pallet-collective/std',113 'pallet-ranked-collective/std',114 'pallet-membership/std',115 'pallet-referenda/std',116 'pallet-gov-origins/std',117 'pallet-scheduler/std',118 'pallet-refungible/std',119 'pallet-structure/std',120 'pallet-sudo/std',121 'pallet-timestamp/std',122 'pallet-utility/std',123 'pallet-transaction-payment-rpc-runtime-api/std',124 'pallet-transaction-payment/std',125 'pallet-treasury/std',126 'pallet-unique/std',127 'parachain-info/std',128 'sp-api/std',129 'sp-block-builder/std',130 'sp-core/std',131 'sp-inherents/std',132 'sp-io/std',133 'sp-offchain/std',134 'sp-runtime/std',135 'sp-session/std',136 'sp-std/std',137 'sp-transaction-pool/std',138 'sp-version/std',139 'up-common/std',140 'up-data-structs/std',141 'up-pov-estimate-rpc/std',142 'up-rpc/std',143 'up-sponsorship/std',144 'xcm-builder/std',145 'xcm-executor/std',146 'xcm/std',147148 "orml-tokens/std",149 "orml-traits/std",150 "orml-vesting/std",151 "orml-xcm-support/std",152 "orml-xtokens/std",153 "pallet-foreign-assets/std",154 "pallet-maintenance/std",155]156stubgen = ["evm-coder/stubgen"]157try-runtime = [158 "pallet-authorship/try-runtime",159 "pallet-collator-selection/try-runtime",160 "pallet-identity/try-runtime",161 "pallet-preimage/try-runtime",162 "pallet-session/try-runtime",163 "pallet-state-trie-migration/try-runtime",164 'cumulus-pallet-aura-ext/try-runtime',165 'cumulus-pallet-dmp-queue/try-runtime',166 'cumulus-pallet-parachain-system/try-runtime',167 'cumulus-pallet-xcm/try-runtime',168 'cumulus-pallet-xcmp-queue/try-runtime',169 'fp-self-contained/try-runtime',170 'frame-executive/try-runtime',171 'frame-support/try-runtime',172 'frame-system/try-runtime',173 'frame-try-runtime',174 'orml-tokens/try-runtime',175 'orml-vesting/try-runtime',176 'orml-xtokens/try-runtime',177 'pallet-app-promotion/try-runtime',178 'pallet-aura/try-runtime',179 'pallet-balances-adapter/try-runtime',180 'pallet-balances/try-runtime',181 'pallet-charge-transaction/try-runtime',182 'pallet-collective/try-runtime',183 'pallet-common/try-runtime',184 'pallet-configuration/try-runtime',185 'pallet-democracy/try-runtime',186 'pallet-ethereum/try-runtime',187 'pallet-evm-coder-substrate/try-runtime',188 'pallet-evm-contract-helpers/try-runtime',189 'pallet-evm-migration/try-runtime',190 'pallet-evm-transaction-payment/try-runtime',191 'pallet-evm/try-runtime',192 'pallet-foreign-assets/try-runtime',193 'pallet-fungible/try-runtime',194 'pallet-inflation/try-runtime',195 'pallet-maintenance/try-runtime',196 'pallet-membership/try-runtime',197 'pallet-nonfungible/try-runtime',198 'pallet-democracy/try-runtime',199 'pallet-collective/try-runtime',200 'pallet-ranked-collective/try-runtime',201 'pallet-membership/try-runtime',202 'pallet-referenda/try-runtime',203 'pallet-gov-origins/try-runtime',204 'pallet-scheduler/try-runtime',205 'pallet-refungible/try-runtime',206 'pallet-scheduler/try-runtime',207 'pallet-structure/try-runtime',208 'pallet-sudo/try-runtime',209 'pallet-timestamp/try-runtime',210 'pallet-utility/try-runtime',211 'pallet-transaction-payment/try-runtime',212 'pallet-treasury/try-runtime',213 'pallet-unique/try-runtime',214 'pallet-xcm/try-runtime',215 'parachain-info/try-runtime',216]217unique-runtime = ['app-promotion', 'foreign-assets', 'refungible']218219app-promotion = []220collator-selection = []221foreign-assets = []222governance = []223preimage = []224refungible = []225unique-scheduler = []226gov-test-timings = []227session-test-timings = []228229################################################################################230# local dependencies231232[dependencies]233# Note: `package = "parity-scale-codec"` must be supplied since the `Encode` macro searches for it.234codec = { workspace = true, package = "parity-scale-codec" }235236cumulus-pallet-aura-ext = { workspace = true }237cumulus-pallet-dmp-queue = { workspace = true }238cumulus-pallet-parachain-system = { workspace = true }239cumulus-pallet-xcm = { workspace = true }240cumulus-pallet-xcmp-queue = { workspace = true }241cumulus-primitives-core = { workspace = true }242cumulus-primitives-timestamp = { workspace = true }243cumulus-primitives-utility = { workspace = true }244frame-executive = { workspace = true }245frame-support = { workspace = true }246frame-system = { workspace = true }247frame-system-rpc-runtime-api = { workspace = true }248orml-tokens = { workspace = true }249orml-traits = { workspace = true }250orml-vesting = { workspace = true }251orml-xcm-support = { workspace = true }252orml-xtokens = { workspace = true }253pallet-aura = { workspace = true }254pallet-authorship = { workspace = true }255pallet-balances = { features = ["insecure_zero_ed"], workspace = true }256pallet-preimage = { workspace = true }257pallet-session = { workspace = true }258pallet-state-trie-migration = { workspace = true }259pallet-sudo = { workspace = true }260pallet-timestamp = { workspace = true }261pallet-utility = { workspace = true }262pallet-transaction-payment = { workspace = true }263pallet-transaction-payment-rpc-runtime-api = { workspace = true }264pallet-treasury = { workspace = true }265pallet-xcm = { workspace = true }266parachain-info = { workspace = true }267polkadot-parachain = { workspace = true }268smallvec = { workspace = true }269sp-api = { workspace = true }270sp-arithmetic = { workspace = true }271sp-block-builder = { workspace = true }272sp-consensus-aura = { workspace = true }273sp-core = { workspace = true }274sp-inherents = { workspace = true }275sp-io = { workspace = true }276sp-offchain = { workspace = true }277sp-runtime = { workspace = true }278sp-session = { workspace = true }279sp-std = { workspace = true }280sp-transaction-pool = { workspace = true }281sp-version = { workspace = true }282xcm = { workspace = true }283xcm-builder = { workspace = true }284xcm-executor = { workspace = true }285286app-promotion-rpc = { workspace = true }287derivative = { workspace = true }288log = { workspace = true }289pallet-app-promotion = { workspace = true }290pallet-balances-adapter = { workspace = true }291pallet-collator-selection = { workspace = true }292pallet-common = { workspace = true }293pallet-configuration = { workspace = true }294pallet-fungible = { workspace = true }295pallet-identity = { workspace = true }296pallet-inflation = { workspace = true }297pallet-nonfungible = { workspace = true }298pallet-democracy = { workspace = true }299pallet-collective = { workspace = true }300pallet-ranked-collective = { workspace = true }301pallet-membership = { workspace = true }302pallet-referenda = { workspace = true }303pallet-gov-origins = { workspace = true }304pallet-scheduler = { workspace = true }305pallet-refungible = { workspace = true }306pallet-structure = { workspace = true }307pallet-unique = { workspace = true }308scale-info = { workspace = true }309up-common = { workspace = true }310up-data-structs = { workspace = true }311up-pov-estimate-rpc = { workspace = true }312up-rpc = { workspace = true }313# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }314evm-coder = { workspace = true }315fp-evm = { workspace = true }316fp-rpc = { workspace = true }317fp-self-contained = { workspace = true }318num_enum = { workspace = true }319pallet-base-fee = { workspace = true }320pallet-charge-transaction = { workspace = true }321pallet-ethereum = { workspace = true }322pallet-evm = { workspace = true }323pallet-evm-coder-substrate = { workspace = true }324pallet-evm-contract-helpers = { workspace = true }325pallet-evm-migration = { workspace = true }326pallet-evm-precompile-simple = { workspace = true }327pallet-evm-transaction-payment = { workspace = true }328pallet-foreign-assets = { workspace = true }329pallet-maintenance = { workspace = true }330precompile-utils-macro = { workspace = true }331up-sponsorship = { workspace = true }332333################################################################################334# Optional dependencies335336frame-benchmarking = { workspace = true, optional = true }337frame-system-benchmarking = { workspace = true, optional = true }338frame-try-runtime = { workspace = true, optional = true }339serde = { workspace = true, optional = true }340341################################################################################342# Test dependencies343344pallet-test-utils = { workspace = true }345346################################################################################347# Other Dependencies348349hex-literal = { workspace = true }350impl-trait-for-tuples = { workspace = true }351352[build-dependencies]353substrate-wasm-builder = { workspace = true }tests/src/governance/init.test.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/governance/init.test.ts
@@ -0,0 +1,192 @@
+import {IKeyringPair} from '@polkadot/types/types';
+import {usingPlaygrounds, itSub, expect, Pallets, requirePalletsOrSkip, describeGov} from '../util';
+import {Event} from '../util/playgrounds/unique.dev';
+import {ICounselors, democracyLaunchPeriod, democracyVotingPeriod, ITechComms, democracyEnactmentPeriod, clearCouncil, clearTechComm, clearFellowship} from './util';
+
+describeGov('Governance: Initialization', () => {
+ let donor: IKeyringPair;
+ let sudoer: IKeyringPair;
+ let counselors: ICounselors;
+ let techcomms: ITechComms;
+ let coreDevs: any;
+
+ const expectedAlexFellowRank = 7;
+ const expectedFellowRank = 6;
+
+ before(async function() {
+ await usingPlaygrounds(async (helper, privateKey) => {
+ requirePalletsOrSkip(this, helper, [Pallets.Democracy, Pallets.Council, Pallets.TechnicalCommittee]);
+
+ const councilMembers = await helper.council.membership.getMembers();
+ const techcommMembers = await helper.technicalCommittee.membership.getMembers();
+ expect(councilMembers.length == 0, 'The Council must be empty before the Gov Init');
+ expect(techcommMembers.length == 0, 'The Technical Commettee must be empty before the Gov Init');
+
+ donor = await privateKey({url: import.meta.url});
+ sudoer = await privateKey('//Alice');
+
+ const counselorsNum = 5;
+ const techCommsNum = 3;
+ const coreDevsNum = 2;
+ const [
+ alex,
+ ildar,
+ charu,
+ filip,
+ irina,
+
+ greg,
+ andy,
+ constantine,
+
+ yaroslav,
+ daniel,
+ ] = await helper.arrange.createAccounts(new Array(counselorsNum + techCommsNum + coreDevsNum).fill(10_000n), donor);
+
+ counselors = {
+ alex,
+ ildar,
+ charu,
+ filip,
+ irina,
+ };
+
+ techcomms = {
+ greg,
+ andy,
+ constantine,
+ };
+
+ coreDevs = {
+ yaroslav: yaroslav,
+ daniel: daniel,
+ };
+ });
+ });
+
+ itSub('Initialize Governance', async ({helper}) => {
+ const promoteFellow = (fellow: string, promotionsNum: number) => new Array(promotionsNum).fill(helper.fellowship.collective.promoteCall(fellow));
+
+ const expectFellowRank = async (fellow: string, expectedRank: number) => {
+ expect(await helper.fellowship.collective.getMemberRank(fellow)).to.be.equal(expectedRank);
+ };
+
+ console.log('\t- Setup the Prime of the Council via sudo');
+ await helper.getSudo().utility.batchAll(sudoer, [
+ helper.council.membership.addMemberCall(counselors.alex.address),
+ helper.council.membership.setPrimeCall(counselors.alex.address),
+
+ helper.fellowship.collective.addMemberCall(counselors.alex.address),
+ ...promoteFellow(counselors.alex.address, expectedAlexFellowRank),
+ ]);
+
+ let councilMembers = await helper.council.membership.getMembers();
+ const councilPrime = await helper.council.collective.getPrimeMember();
+ const alexFellowRank = await helper.fellowship.collective.getMemberRank(counselors.alex.address);
+ expect(councilMembers).to.be.deep.equal([counselors.alex.address]);
+ expect(councilPrime).to.be.equal(counselors.alex.address);
+ expect(alexFellowRank).to.be.equal(expectedAlexFellowRank);
+
+ console.log('\t- The Council Prime initializes the Technical Commettee');
+ const councilProposalThreshold = 1;
+
+ await helper.council.collective.propose(
+ counselors.alex,
+ helper.utility.batchAllCall([
+ helper.technicalCommittee.membership.addMemberCall(techcomms.greg.address),
+ helper.technicalCommittee.membership.addMemberCall(techcomms.andy.address),
+ helper.technicalCommittee.membership.addMemberCall(techcomms.constantine.address),
+
+ helper.technicalCommittee.membership.setPrimeCall(techcomms.greg.address),
+ ]),
+ councilProposalThreshold,
+ );
+
+ const techCommMembers = await helper.technicalCommittee.membership.getMembers();
+ const techCommPrime = await helper.technicalCommittee.membership.getPrimeMember();
+ const expectedTechComms = [techcomms.greg.address, techcomms.andy.address, techcomms.constantine.address];
+ expect(techCommMembers.length).to.be.equal(expectedTechComms.length);
+ expect(techCommMembers).to.containSubset(expectedTechComms);
+ expect(techCommPrime).to.be.equal(techcomms.greg.address);
+
+ console.log('\t- The Council Prime initiates a referendum to add counselors');
+ const returnPreimageHash = true;
+ const preimageHash = await helper.preimage.notePreimageFromCall(counselors.alex, helper.utility.batchAllCall([
+ helper.council.membership.addMemberCall(counselors.ildar.address),
+ helper.council.membership.addMemberCall(counselors.charu.address),
+ helper.council.membership.addMemberCall(counselors.filip.address),
+ helper.council.membership.addMemberCall(counselors.irina.address),
+
+ helper.fellowship.collective.addMemberCall(counselors.charu.address),
+ helper.fellowship.collective.addMemberCall(counselors.ildar.address),
+ helper.fellowship.collective.addMemberCall(counselors.irina.address),
+ helper.fellowship.collective.addMemberCall(counselors.filip.address),
+ helper.fellowship.collective.addMemberCall(techcomms.greg.address),
+ helper.fellowship.collective.addMemberCall(techcomms.andy.address),
+ helper.fellowship.collective.addMemberCall(techcomms.constantine.address),
+ helper.fellowship.collective.addMemberCall(coreDevs.yaroslav.address),
+ helper.fellowship.collective.addMemberCall(coreDevs.daniel.address),
+
+ ...promoteFellow(counselors.charu.address, expectedFellowRank),
+ ...promoteFellow(counselors.ildar.address, expectedFellowRank),
+ ...promoteFellow(counselors.irina.address, expectedFellowRank),
+ ...promoteFellow(counselors.filip.address, expectedFellowRank),
+ ...promoteFellow(techcomms.greg.address, expectedFellowRank),
+ ...promoteFellow(techcomms.andy.address, expectedFellowRank),
+ ...promoteFellow(techcomms.constantine.address, expectedFellowRank),
+ ...promoteFellow(coreDevs.yaroslav.address, expectedFellowRank),
+ ...promoteFellow(coreDevs.daniel.address, expectedFellowRank),
+ ]), returnPreimageHash);
+
+ await helper.council.collective.propose(
+ counselors.alex,
+ helper.democracy.externalProposeDefaultWithPreimageCall(preimageHash),
+ councilProposalThreshold,
+ );
+
+ console.log('\t- The referendum is being decided');
+ const startedEvent = await helper.wait.expectEvent(democracyLaunchPeriod, Event.Democracy.Started);
+
+ await helper.democracy.vote(counselors.filip, startedEvent.referendumIndex, {
+ Standard: {
+ vote: {
+ aye: true,
+ conviction: 1,
+ },
+ balance: 10_000n,
+ },
+ });
+
+ const passedReferendumEvent = await helper.wait.expectEvent(democracyVotingPeriod, Event.Democracy.Passed);
+ expect(passedReferendumEvent.referendumIndex).to.be.equal(startedEvent.referendumIndex);
+
+ await helper.wait.expectEvent(democracyEnactmentPeriod, Event.Scheduler.Dispatched);
+
+ councilMembers = await helper.council.membership.getMembers();
+ const expectedCounselors = [
+ counselors.alex.address,
+ counselors.ildar.address,
+ counselors.charu.address,
+ counselors.filip.address,
+ counselors.irina.address,
+ ];
+ expect(councilMembers.length).to.be.equal(expectedCounselors.length);
+ expect(councilMembers).to.containSubset(expectedCounselors);
+
+ await expectFellowRank(counselors.ildar.address, expectedFellowRank);
+ await expectFellowRank(counselors.charu.address, expectedFellowRank);
+ await expectFellowRank(counselors.filip.address, expectedFellowRank);
+ await expectFellowRank(counselors.irina.address, expectedFellowRank);
+ await expectFellowRank(techcomms.greg.address, expectedFellowRank);
+ await expectFellowRank(techcomms.andy.address, expectedFellowRank);
+ await expectFellowRank(techcomms.constantine.address, expectedFellowRank);
+ await expectFellowRank(coreDevs.yaroslav.address, expectedFellowRank);
+ await expectFellowRank(coreDevs.daniel.address, expectedFellowRank);
+ });
+
+ after(async function() {
+ await clearFellowship(sudoer);
+ await clearTechComm(sudoer);
+ await clearCouncil(sudoer);
+ });
+});
tests/src/pallet-presence.test.tsdiffbeforeafterboth--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -27,6 +27,7 @@
'statetriemigration',
'structure',
'system',
+ 'utility',
'vesting',
'parachainsystem',
'parachaininfo',
tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -3255,8 +3255,8 @@
return this.helper.executeExtrinsic(signer, `api.tx.${this.collective}.promoteMember`, [member]);
}
- promoteCall(newMember: string) {
- return this.helper.constructApiCall(`api.tx.${this.collective}.promoteMember`, [newMember]);
+ promoteCall(member: string) {
+ return this.helper.constructApiCall(`api.tx.${this.collective}.promoteMember`, [member]);
}
demote(signer: TSigner, member: string) {
@@ -3275,6 +3275,10 @@
return (await this.helper.getApi().query.fellowshipCollective.members.keys())
.map((key) => key.args[0].toString());
}
+
+ async getMemberRank(member: string) {
+ return (await this.helper.callRpc('api.query.fellowshipCollective.members', [member])).toJSON().rank;
+ }
}
class ReferendaGroup extends HelperGroup<UniqueHelper> {
@@ -3381,6 +3385,10 @@
return this.helper.constructApiCall('api.tx.democracy.externalProposeDefault', [{Inline: proposalCall.method.toHex()}]);
}
+ externalProposeDefaultWithPreimageCall(preimage: string) {
+ return this.helper.constructApiCall('api.tx.democracy.externalProposeDefault', [{Legacy: preimage}]);
+ }
+
// ... and blacklist external proposal hash.
vetoExternal(signer: TSigner, proposalHash: string) {
return this.helper.executeExtrinsic(signer, 'api.tx.democracy.vetoExternal', [proposalHash]);
@@ -3733,6 +3741,20 @@
}
}
+class UtilityGroup<T extends ChainHelperBase> extends HelperGroup<T> {
+ async batch(signer: TSigner, txs: any[]) {
+ return await this.helper.executeExtrinsic(signer, 'api.tx.utility.batch', [txs]);
+ }
+
+ async batchAll(signer: TSigner, txs: any[]) {
+ return await this.helper.executeExtrinsic(signer, 'api.tx.utility.batchAll', [txs]);
+ }
+
+ batchAllCall(txs: any[]) {
+ return this.helper.constructApiCall('api.tx.utility.batchAll', [txs]);
+ }
+}
+
class AcalaAssetRegistryGroup extends HelperGroup<AcalaHelper> {
async registerForeignAsset(signer: TSigner, destination: any, metadata: AcalaAssetMetadata) {
await this.helper.executeExtrinsic(signer, 'api.tx.assetRegistry.registerForeignAsset', [destination, metadata], true);
@@ -3835,6 +3857,7 @@
xcm: XcmGroup<UniqueHelper>;
xTokens: XTokensGroup<UniqueHelper>;
tokens: TokensGroup<UniqueHelper>;
+ utility: UtilityGroup<UniqueHelper>;
constructor(logger?: ILogger, options: { [key: string]: any } = {}) {
super(logger, options.helperBase ?? UniqueHelper);
@@ -3865,6 +3888,7 @@
this.xcm = new XcmGroup(this, 'polkadotXcm');
this.xTokens = new XTokensGroup(this);
this.tokens = new TokensGroup(this);
+ this.utility = new UtilityGroup(this);
}
getSudo<T extends UniqueHelper>() {