Browse Source

Update set_wg_mint_capacity proposal limits

Shamil Gadelshin 4 years ago
parent
commit
d7ff710925

+ 5 - 5
runtime-modules/proposals/codex/src/lib.rs

@@ -80,6 +80,10 @@ pub use proposal_types::{ProposalDetails, ProposalDetailsOf, ProposalEncoder};
 // proposal max balance percentage.
 const COUNCIL_MINT_MAX_BALANCE_PERCENT: u32 = 2;
 
+// 'Set working group mint capacity' proposal limit
+const CONTENT_WORKING_GROUP_MINT_CAPACITY_MAX_VALUE: u32 = 1000000;
+
+
 /// 'Proposals codex' substrate module Trait
 pub trait Trait:
     system::Trait
@@ -440,12 +444,8 @@ decl_module! {
             stake_balance: Option<BalanceOf<T>>,
             mint_balance: BalanceOfMint<T>,
         ) {
-
-            let max_mint_capacity: u32 = get_required_stake_by_fraction::<T>(1, 100)
-                .try_into()
-                .unwrap_or_default() as u32;
             ensure!(
-                mint_balance < <BalanceOfMint<T>>::from(max_mint_capacity),
+                mint_balance <= <BalanceOfMint<T>>::from(CONTENT_WORKING_GROUP_MINT_CAPACITY_MAX_VALUE),
                 Error::InvalidStorageWorkingGroupMintCapacity
             );
 

+ 3 - 3
runtime-modules/proposals/codex/src/tests/mod.rs

@@ -469,7 +469,7 @@ fn create_set_election_parameters_call_fails_with_incorrect_parameters() {
 #[test]
 fn create_working_group_mint_capacity_proposal_fails_with_invalid_parameters() {
     initial_test_ext().execute_with(|| {
-        increase_total_balance_issuance(500000);
+        increase_total_balance_issuance_using_account_id(1, 500000);
 
         assert_eq!(
             ProposalCodex::create_set_content_working_group_mint_capacity_proposal(
@@ -477,8 +477,8 @@ fn create_working_group_mint_capacity_proposal_fails_with_invalid_parameters() {
                 1,
                 b"title".to_vec(),
                 b"body".to_vec(),
-                Some(<BalanceOf<Test>>::from(1250u32)),
-                5001,
+                Some(<BalanceOf<Test>>::from(50000u32)),
+                (crate::CONTENT_WORKING_GROUP_MINT_CAPACITY_MAX_VALUE + 1) as u64,
             ),
             Err(Error::InvalidStorageWorkingGroupMintCapacity)
         );