Browse Source

runtime: utility: rename pallet

conectado 4 years ago
parent
commit
ed39938936

+ 27 - 27
Cargo.lock

@@ -2380,7 +2380,8 @@ dependencies = [
  "pallet-timestamp",
  "pallet-transaction-payment",
  "pallet-transaction-payment-rpc-runtime-api",
- "pallet-utility",
+ "pallet-utility 1.0.0",
+ "pallet-utility 2.0.0",
  "pallet-working-group",
  "parity-scale-codec",
  "serde",
@@ -2402,7 +2403,6 @@ dependencies = [
  "sp-version",
  "strum 0.19.5",
  "substrate-wasm-builder-runner",
- "utility",
 ]
 
 [[package]]
@@ -4295,6 +4295,31 @@ dependencies = [
  "sp-std",
 ]
 
+[[package]]
+name = "pallet-utility"
+version = "1.0.0"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "pallet-balances",
+ "pallet-common",
+ "pallet-council",
+ "pallet-membership",
+ "pallet-referendum",
+ "pallet-staking-handler",
+ "pallet-timestamp",
+ "pallet-working-group",
+ "parity-scale-codec",
+ "serde",
+ "sp-arithmetic",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+ "strum 0.19.5",
+]
+
 [[package]]
 name = "pallet-utility"
 version = "2.0.0"
@@ -8238,31 +8263,6 @@ dependencies = [
  "percent-encoding 2.1.0",
 ]
 
-[[package]]
-name = "utility"
-version = "1.0.0"
-dependencies = [
- "frame-benchmarking",
- "frame-support",
- "frame-system",
- "pallet-balances",
- "pallet-common",
- "pallet-council",
- "pallet-membership",
- "pallet-referendum",
- "pallet-staking-handler",
- "pallet-timestamp",
- "pallet-working-group",
- "parity-scale-codec",
- "serde",
- "sp-arithmetic",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std",
- "strum 0.19.5",
-]
-
 [[package]]
 name = "vcpkg"
 version = "0.2.10"

+ 1 - 1
runtime-modules/utility/Cargo.toml

@@ -1,5 +1,5 @@
 [package]
-name = 'utility'
+name = 'pallet-utility'
 version = '1.0.0'
 authors = ['Joystream contributors']
 edition = '2018'

+ 1 - 1
runtime-modules/utility/src/lib.rs

@@ -1,7 +1,7 @@
 //! # Joystream Utility pallet.
 //! `Utility` pallet for the Joystream platform.
 //!
-//! Different extrinsics that doesn't fit anywhere else
+//! A stateless module with Joystream operations helpers.
 //!
 //! ## Extrinsics
 //!

+ 6 - 6
runtime/Cargo.toml

@@ -53,7 +53,7 @@ pallet-staking = { package = 'pallet-staking', default-features = false, git = '
 pallet-timestamp = { package = 'pallet-timestamp', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
 pallet-balances = { package = 'pallet-balances', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
 pallet-im-online = { package = 'pallet-im-online', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
-pallet-utility = { package = 'pallet-utility', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
+substrate-utility = { package = 'pallet-utility', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
 
 # Benchmarking
 frame-benchmarking = { git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca', default-features = false, optional = true }
@@ -79,7 +79,7 @@ content-directory = { package = 'pallet-content-directory', default-features = f
 pallet_constitution = { package = 'pallet-constitution', default-features = false, path = '../runtime-modules/constitution' }
 staking-handler = { package = 'pallet-staking-handler', default-features = false, path = '../runtime-modules/staking-handler'}
 blog = { package = 'pallet-blog', default-features = false, path = '../runtime-modules/blog'}
-utility = { package = 'utility', default-features = false, path = '../runtime-modules/utility'}
+joystream-utility = { package = 'pallet-utility', default-features = false, path = '../runtime-modules/utility'}
 
 [dev-dependencies]
 sp-io = { package = 'sp-io', default-features = false, git = 'https://github.com/paritytech/substrate.git', rev = 'a200cdb93c6af5763b9c7bf313fa708764ac88ca'}
@@ -135,7 +135,7 @@ std = [
     'pallet-sudo/std',
     'pallet-im-online/std',
     'pallet-offences/std',
-    'pallet-utility/std',
+    'substrate-utility/std',
 
     # Joystream
     'common/std',
@@ -154,7 +154,7 @@ std = [
     'pallet_constitution/std',
     'staking-handler/std',
     'blog/std',
-    'utility/std'
+    'joystream-utility/std'
 ]
 runtime-benchmarks = [
     "frame-system/runtime-benchmarks",
@@ -167,11 +167,11 @@ runtime-benchmarks = [
     "frame-benchmarking",
     "frame-system-benchmarking",
     "pallet-session-benchmarking",
-    "pallet-utility/runtime-benchmarks",
+    "substrate-utility/runtime-benchmarks",
     "proposals-discussion/runtime-benchmarks",
     "proposals-engine/runtime-benchmarks",
     "proposals-codex/runtime-benchmarks",
-    "utility/runtime-benchmarks",
+    "joystream-utility/runtime-benchmarks",
     "pallet_constitution/runtime-benchmarks",
     "working-group/runtime-benchmarks",
     "forum/runtime-benchmarks",

+ 5 - 5
runtime/src/integration/proposals/proposal_encoder.rs

@@ -34,7 +34,7 @@ impl ProposalEncoder<Runtime> for ExtrinsicProposalEncoder {
     fn encode_proposal(proposal_details: ProposalDetailsOf<Runtime>) -> Vec<u8> {
         let call = match proposal_details {
             ProposalDetails::Signal(signal) => {
-                Call::JoystreamUtility(utility::Call::execute_signal_proposal(signal))
+                Call::JoystreamUtility(joystream_utility::Call::execute_signal_proposal(signal))
             }
             ProposalDetails::FundingRequest(params) => {
                 Call::Council(council::Call::funding_request(params))
@@ -42,9 +42,9 @@ impl ProposalEncoder<Runtime> for ExtrinsicProposalEncoder {
             ProposalDetails::SetMaxValidatorCount(new_validator_count) => Call::Staking(
                 pallet_staking::Call::set_validator_count(new_validator_count),
             ),
-            ProposalDetails::RuntimeUpgrade(blob) => {
-                Call::JoystreamUtility(utility::Call::execute_runtime_upgrade_proposal(blob))
-            }
+            ProposalDetails::RuntimeUpgrade(blob) => Call::JoystreamUtility(
+                joystream_utility::Call::execute_runtime_upgrade_proposal(blob),
+            ),
             ProposalDetails::CreateWorkingGroupLeadOpening(create_opening_params) => {
                 wrap_working_group_call!(
                     create_opening_params.group,
@@ -58,7 +58,7 @@ impl ProposalEncoder<Runtime> for ExtrinsicProposalEncoder {
                 )
             }
             ProposalDetails::UpdateWorkingGroupBudget(amount, working_group, balance_kind) => {
-                Call::JoystreamUtility(utility::Call::update_working_group_budget(
+                Call::JoystreamUtility(joystream_utility::Call::update_working_group_budget(
                     working_group,
                     amount,
                     balance_kind,

+ 6 - 6
runtime/src/lib.rs

@@ -156,10 +156,10 @@ impl frame_system::Trait for Runtime {
     type SystemWeightInfo = weights::frame_system::WeightInfo;
 }
 
-impl pallet_utility::Trait for Runtime {
+impl substrate_utility::Trait for Runtime {
     type Event = Event;
     type Call = Call;
-    type WeightInfo = weights::pallet_utility::WeightInfo;
+    type WeightInfo = weights::substrate_utility::WeightInfo;
 }
 
 parameter_types! {
@@ -827,10 +827,10 @@ impl proposals_discussion::Trait for Runtime {
     type WeightInfo = weights::proposals_discussion::WeightInfo;
 }
 
-impl utility::Trait for Runtime {
+impl joystream_utility::Trait for Runtime {
     type Event = Event;
 
-    type WeightInfo = weights::utility::WeightInfo;
+    type WeightInfo = weights::joystream_utility::WeightInfo;
 
     fn get_working_group_budget(working_group: WorkingGroup) -> Balance {
         call_wg!(working_group, get_budget)
@@ -932,7 +932,7 @@ construct_runtime!(
     {
         // Substrate
         System: frame_system::{Module, Call, Storage, Config, Event<T>},
-        Utility: pallet_utility::{Module, Call, Event},
+        Utility: substrate_utility::{Module, Call, Event},
         Babe: pallet_babe::{Module, Call, Storage, Config, Inherent, ValidateUnsigned},
         Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
         Authorship: pallet_authorship::{Module, Call, Storage, Inherent},
@@ -957,7 +957,7 @@ construct_runtime!(
         ContentDirectory: content_directory::{Module, Call, Storage, Event<T>, Config<T>},
         Constitution: pallet_constitution::{Module, Call, Storage, Event},
         Blog: blog::<Instance1>::{Module, Call, Storage, Event<T>},
-        JoystreamUtility: utility::{Module, Call, Event<T>},
+        JoystreamUtility: joystream_utility::{Module, Call, Event<T>},
         // --- Storage
         DataObjectTypeRegistry: data_object_type_registry::{Module, Call, Storage, Event<T>, Config<T>},
         DataDirectory: data_directory::{Module, Call, Storage, Event<T>},

+ 2 - 2
runtime/src/runtime_api.rs

@@ -370,7 +370,7 @@ impl_runtime_apis! {
 
             // Frame benchmarks
             add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);
-            add_benchmark!(params, batches, pallet_utility, Utility);
+            add_benchmark!(params, batches, substrate_utility, Utility);
             add_benchmark!(params, batches, pallet_timestamp, Timestamp);
             add_benchmark!(params, batches, pallet_session, SessionBench::<Runtime>);
             add_benchmark!(params, batches, pallet_im_online, ImOnline);
@@ -386,7 +386,7 @@ impl_runtime_apis! {
             add_benchmark!(params, batches, referendum, Referendum);
             add_benchmark!(params, batches, council, Council);
             add_benchmark!(params, batches, blog, Blog);
-            add_benchmark!(params, batches, utility, JoystreamUtility);
+            add_benchmark!(params, batches, joystream_utility, JoystreamUtility);
 
             if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
             Ok(batches)

+ 2 - 1
runtime/src/tests/proposals_integration/mod.rs

@@ -119,7 +119,8 @@ impl Default for DummyProposalFixture {
     fn default() -> Self {
         let title = b"title".to_vec();
         let description = b"description".to_vec();
-        let dummy_proposal = utility::Call::<Runtime>::execute_signal_proposal(b"signal".to_vec());
+        let dummy_proposal =
+            joystream_utility::Call::<Runtime>::execute_signal_proposal(b"signal".to_vec());
 
         DummyProposalFixture {
             parameters: ProposalParameters {

+ 1 - 1
runtime/src/weights/utility.rs → runtime/src/weights/joystream_utility.rs

@@ -6,7 +6,7 @@
 use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight};
 
 pub struct WeightInfo;
-impl utility::WeightInfo for WeightInfo {
+impl joystream_utility::WeightInfo for WeightInfo {
     fn execute_signal_proposal(i: u32) -> Weight {
         (81_623_000 as Weight).saturating_add((162_000 as Weight).saturating_mul(i as Weight))
     }

+ 2 - 2
runtime/src/weights/mod.rs

@@ -21,17 +21,17 @@ pub mod pallet_balances;
 pub mod pallet_session;
 pub mod pallet_staking;
 pub mod pallet_timestamp;
-pub mod pallet_utility;
+pub mod substrate_utility;
 
 // Joystream pallets
 pub mod blog;
 pub mod council;
 pub mod forum;
+pub mod joystream_utility;
 pub mod membership;
 pub mod pallet_constitution;
 pub mod proposals_codex;
 pub mod proposals_discussion;
 pub mod proposals_engine;
 pub mod referendum;
-pub mod utility;
 pub mod working_group;

+ 1 - 1
runtime/src/weights/pallet_utility.rs → runtime/src/weights/substrate_utility.rs

@@ -6,7 +6,7 @@
 use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight};
 
 pub struct WeightInfo;
-impl pallet_utility::WeightInfo for WeightInfo {
+impl substrate_utility::WeightInfo for WeightInfo {
     fn batch(c: u32) -> Weight {
         (0 as Weight).saturating_add((105_180_000 as Weight).saturating_mul(c as Weight))
     }