Browse Source

Merge branch 'sumer' into storage-upload-to-any-provider

Mokhtar Naamani 4 years ago
parent
commit
9d3a401f3f

+ 1 - 1
Cargo.lock

@@ -1993,7 +1993,7 @@ dependencies = [
 
 [[package]]
 name = "joystream-node"
-version = "3.7.1"
+version = "3.7.2"
 dependencies = [
  "frame-benchmarking",
  "frame-benchmarking-cli",

+ 1 - 1
node/Cargo.toml

@@ -3,7 +3,7 @@ authors = ['Joystream contributors']
 build = 'build.rs'
 edition = '2018'
 name = 'joystream-node'
-version = '3.7.1'
+version = '3.7.2'
 default-run = "joystream-node"
 
 [[bin]]

+ 4 - 4
pioneer/packages/joy-proposals/src/validationSchema.ts

@@ -32,8 +32,8 @@ const RATIONALE_MAX_LENGTH = 3000;
 const FILE_SIZE_BYTES_MIN = 1;
 
 // Set Election Parameters
-const ANNOUNCING_PERIOD_MAX = 43200;
 const ANNOUNCING_PERIOD_MIN = 14400;
+const ANNOUNCING_PERIOD_MAX = 43200;
 const VOTING_PERIOD_MIN = 14400;
 const VOTING_PERIOD_MAX = 28800;
 const REVEALING_PERIOD_MIN = 14400;
@@ -42,10 +42,10 @@ const MIN_COUNCIL_STAKE_MIN = 1;
 const MIN_COUNCIL_STAKE_MAX = 100000;
 const NEW_TERM_DURATION_MIN = 14400;
 const NEW_TERM_DURATION_MAX = 432000;
-const CANDIDACY_LIMIT_MIN = 25;
+const CANDIDACY_LIMIT_MIN = 50;
 const CANDIDACY_LIMIT_MAX = 100;
-const COUNCIL_SIZE_MAX = 20;
 const COUNCIL_SIZE_MIN = 4;
+const COUNCIL_SIZE_MAX = 20;
 const MIN_VOTING_STAKE_MIN = 1;
 const MIN_VOTING_STAKE_MAX = 100000;
 
@@ -55,7 +55,7 @@ const TOKENS_MAX = 5000000;
 
 // Set Validator Count
 const MAX_VALIDATOR_COUNT_MIN = 4;
-const MAX_VALIDATOR_COUNT_MAX = 100;
+const MAX_VALIDATOR_COUNT_MAX = 300;
 
 // Add Working Group Leader Opening Parameters
 // TODO: Discuss the actual values

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

@@ -85,13 +85,13 @@ const WORKING_GROUP_MINT_CAPACITY_MAX_VALUE: u32 = 5_000_000;
 // Max allowed value for 'spending' proposal
 const MAX_SPENDING_PROPOSAL_VALUE: u32 = 5_000_000_u32;
 // Max validator count for the 'set validator count' proposal
-const MAX_VALIDATOR_COUNT: u32 = 100;
+const MAX_VALIDATOR_COUNT: u32 = 300;
 // council_size min value for the 'set election parameters' proposal
 const ELECTION_PARAMETERS_COUNCIL_SIZE_MIN_VALUE: u32 = 4;
 // council_size max value for the 'set election parameters' proposal
 const ELECTION_PARAMETERS_COUNCIL_SIZE_MAX_VALUE: u32 = 20;
 // candidacy_limit min value for the 'set election parameters' proposal
-const ELECTION_PARAMETERS_CANDIDACY_LIMIT_MIN_VALUE: u32 = 25;
+const ELECTION_PARAMETERS_CANDIDACY_LIMIT_MIN_VALUE: u32 = 50;
 // candidacy_limit max value for the 'set election parameters' proposal
 const ELECTION_PARAMETERS_CANDIDACY_LIMIT_MAX_VALUE: u32 = 100;
 // min_voting_stake min value for the 'set election parameters' proposal

+ 1 - 1
runtime-modules/proposals/codex/src/proposal_types/mod.rs

@@ -317,7 +317,7 @@ impl Default for ProposalsConfigParameters {
             set_validator_count_proposal_voting_period: 43200u32,
             set_validator_count_proposal_grace_period: 0u32,
             runtime_upgrade_proposal_voting_period: 72000u32,
-            runtime_upgrade_proposal_grace_period: 72000u32,
+            runtime_upgrade_proposal_grace_period: 28800u32,
             text_proposal_voting_period: 72000u32,
             text_proposal_grace_period: 0u32,
             set_election_parameters_proposal_voting_period: 72000u32,

+ 3 - 3
runtime-modules/proposals/codex/src/proposal_types/parameters.rs

@@ -10,7 +10,7 @@ pub(crate) fn set_validator_count_proposal<T: crate::Trait>(
         approval_threshold_percentage: 80,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOf<T>>::from(100_000_u32)),
+        required_stake: Some(<BalanceOf<T>>::from(500_000_u32)),
     }
 }
 
@@ -24,7 +24,7 @@ pub(crate) fn runtime_upgrade_proposal<T: crate::Trait>(
         approval_threshold_percentage: 100,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOf<T>>::from(1_000_000_u32)),
+        required_stake: Some(<BalanceOf<T>>::from(5_000_000_u32)),
     }
 }
 
@@ -51,7 +51,7 @@ pub(crate) fn set_election_parameters_proposal<T: crate::Trait>(
         approval_threshold_percentage: 80,
         slashing_quorum_percentage: 60,
         slashing_threshold_percentage: 80,
-        required_stake: Some(<BalanceOf<T>>::from(200_000_u32)),
+        required_stake: Some(<BalanceOf<T>>::from(1_000_000_u32)),
     }
 }
 

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

@@ -187,7 +187,7 @@ fn create_text_proposal_codex_call_fails_with_incorrect_text_size() {
 #[test]
 fn create_runtime_upgrade_common_checks_succeed() {
     initial_test_ext().execute_with(|| {
-        increase_total_balance_issuance_using_account_id(1, 5000000);
+        increase_total_balance_issuance_using_account_id(1, 10000000);
 
         let proposal_fixture = ProposalTestFixture {
             insufficient_rights_call: || {
@@ -226,7 +226,7 @@ fn create_runtime_upgrade_common_checks_succeed() {
                     1,
                     b"title".to_vec(),
                     b"body".to_vec(),
-                    Some(<BalanceOf<Test>>::from(1_000_000_u32)),
+                    Some(<BalanceOf<Test>>::from(5_000_000_u32)),
                     b"wasm".to_vec(),
                 )
             },
@@ -272,7 +272,7 @@ fn create_upgrade_runtime_proposal_codex_call_fails_with_incorrect_wasm_size() {
 #[test]
 fn create_set_election_parameters_proposal_common_checks_succeed() {
     initial_test_ext().execute_with(|| {
-        increase_total_balance_issuance_using_account_id(1, 500000);
+        increase_total_balance_issuance_using_account_id(1, 2000000);
 
         let proposal_fixture = ProposalTestFixture {
             insufficient_rights_call: || {
@@ -311,7 +311,7 @@ fn create_set_election_parameters_proposal_common_checks_succeed() {
                     1,
                     b"title".to_vec(),
                     b"body".to_vec(),
-                    Some(<BalanceOf<Test>>::from(200_000_u32)),
+                    Some(<BalanceOf<Test>>::from(1_000_000_u32)),
                     get_valid_election_parameters(),
                 )
             },
@@ -348,7 +348,7 @@ fn get_valid_election_parameters() -> ElectionParameters<u64, u64> {
         voting_period: 14400,
         revealing_period: 14400,
         council_size: 4,
-        candidacy_limit: 25,
+        candidacy_limit: 50,
         new_term_duration: 14400,
         min_council_stake: 1,
         min_voting_stake: 1,
@@ -358,7 +358,7 @@ fn get_valid_election_parameters() -> ElectionParameters<u64, u64> {
 #[test]
 fn create_set_election_parameters_call_fails_with_incorrect_parameters() {
     initial_test_ext().execute_with(|| {
-        increase_total_balance_issuance_using_account_id(1, 500000);
+        increase_total_balance_issuance_using_account_id(1, 1500000);
 
         let mut election_parameters = get_valid_election_parameters();
         election_parameters.council_size = 2;
@@ -566,7 +566,7 @@ fn create_spending_proposal_call_fails_with_incorrect_balance() {
 #[test]
 fn create_set_validator_count_proposal_common_checks_succeed() {
     initial_test_ext().execute_with(|| {
-        increase_total_balance_issuance_using_account_id(1, 500000);
+        increase_total_balance_issuance_using_account_id(1, 1000000);
 
         let proposal_fixture = ProposalTestFixture {
             insufficient_rights_call: || {
@@ -605,7 +605,7 @@ fn create_set_validator_count_proposal_common_checks_succeed() {
                     1,
                     b"title".to_vec(),
                     b"body".to_vec(),
-                    Some(<BalanceOf<Test>>::from(100_000_u32)),
+                    Some(<BalanceOf<Test>>::from(500_000_u32)),
                     4,
                 )
             },

+ 1 - 1
runtime/src/constants.rs

@@ -18,7 +18,7 @@ pub const MILLISECS_PER_BLOCK: Moment = 6000;
 pub const SECS_PER_BLOCK: Moment = MILLISECS_PER_BLOCK / 1000;
 
 pub const SLOT_DURATION: Moment = 6000;
-pub const BONDING_DURATION: u32 = 24;
+pub const BONDING_DURATION: u32 = 24 * 7;
 
 pub const EPOCH_DURATION_IN_BLOCKS: BlockNumber = 10 * MINUTES;
 pub const EPOCH_DURATION_IN_SLOTS: u64 = {

+ 1 - 1
runtime/src/lib.rs

@@ -533,7 +533,7 @@ parameter_types! {
     pub const ProposalRejectionFee: u64 = 5000;
     pub const ProposalTitleMaxLength: u32 = 40;
     pub const ProposalDescriptionMaxLength: u32 = 3000;
-    pub const ProposalMaxActiveProposalLimit: u32 = 5;
+    pub const ProposalMaxActiveProposalLimit: u32 = 20;
 }
 
 impl proposals_engine::Trait for Runtime {

+ 4 - 4
runtime/src/tests/proposals_integration/mod.rs

@@ -513,7 +513,7 @@ where
             setup_members(NUMBER_OF_MEMBERS_TO_SETUP_IN_CODEX_PROPOSAL_FIXTURE);
             setup_council();
 
-            increase_total_balance_issuance_using_account_id(account_id.clone().into(), 500000);
+            increase_total_balance_issuance_using_account_id(account_id.clone().into(), 1000000);
         }
 
         assert_eq!((self.successful_call)(), Ok(()));
@@ -620,7 +620,7 @@ fn set_election_parameters_proposal_execution_succeeds() {
             voting_period: 14400,
             revealing_period: 14400,
             council_size: 4,
-            candidacy_limit: 25,
+            candidacy_limit: 50,
             new_term_duration: 14400,
             min_council_stake: 1,
             min_voting_stake: 1,
@@ -633,7 +633,7 @@ fn set_election_parameters_proposal_execution_succeeds() {
                 member_id as u64,
                 b"title".to_vec(),
                 b"body".to_vec(),
-                Some(<BalanceOf<Runtime>>::from(200_000_u32)),
+                Some(<BalanceOf<Runtime>>::from(1_000_000_u32)),
                 election_parameters,
             )
         });
@@ -658,7 +658,7 @@ fn set_validator_count_proposal_execution_succeeds() {
                 member_id as u64,
                 b"title".to_vec(),
                 b"body".to_vec(),
-                Some(<BalanceOf<Runtime>>::from(100_000_u32)),
+                Some(<BalanceOf<Runtime>>::from(500_000_u32)),
                 new_validator_count,
             )
         });

+ 4 - 0
testnets/joy-testnet-4.json

@@ -12,6 +12,10 @@
     [
       "/dns/telemetry.polkadot.io/tcp/443/x-parity-wss/%2Fsubmit%2F",
       0
+    ],
+    [
+      "/dns/telemetry.joystream.org/tcp/443/x-parity-wss/%2Fsubmit%2F",
+      0
     ]
   ],
   "protocolId": "/joy/testnet/4",

+ 16 - 12
tests/network-tests/src/fixtures/proposalsModule.ts

@@ -415,7 +415,7 @@ export class ElectionParametersProposalFixture extends BaseFixture {
   public async execute(): Promise<void> {
     // Setup
     const proposalTitle: string = 'Testing proposal ' + uuid().substring(0, 8)
-    const description: string = 'Testing validator count proposal ' + uuid().substring(0, 8)
+    const description: string = 'Testing Election Parameters proposal ' + uuid().substring(0, 8)
 
     const announcingPeriod: BN = new BN(28800)
     const votingPeriod: BN = new BN(14400)
@@ -428,7 +428,7 @@ export class ElectionParametersProposalFixture extends BaseFixture {
 
     // Proposal stake calculation
     // Required stake is hardcoded in runtime-module (but not available as const)
-    const proposalStake: BN = new BN(200000)
+    const proposalStake: BN = new BN(1000000)
     const proposalFee: BN = this.api.estimateProposeElectionParametersFee(
       description,
       description,
@@ -450,7 +450,9 @@ export class ElectionParametersProposalFixture extends BaseFixture {
     const proposedVotingPeriod: BN = votingPeriod.addn(1)
     const proposedRevealingPeriod: BN = revealingPeriod.addn(1)
     const proposedCouncilSize: BN = councilSize.addn(1)
-    const proposedCandidacyLimit: BN = candidacyLimit.addn(1)
+    const proposedCandidacyLimit: BN = new BN(51) // candidacyLimit.addn(1)
+    // assert they are different
+    assert(!candidacyLimit.eq(proposedCandidacyLimit))
     const proposedNewTermDuration: BN = newTermDuration.addn(1)
     const proposedMinCouncilStake: BN = minCouncilStake.addn(1)
     const proposedMinVotingStake: BN = minVotingStake.addn(1)
@@ -618,12 +620,12 @@ export class TextProposalFixture extends BaseFixture {
 
 export class ValidatorCountProposalFixture extends BaseFixture {
   private proposer: string
-  private validatorCountIncrement: BN
+  private proposedValidatorCount: BN
 
-  constructor(api: Api, proposer: string, validatorCountIncrement: BN) {
+  constructor(api: Api, proposer: string, validatorCount: BN) {
     super(api)
     this.proposer = proposer
-    this.validatorCountIncrement = validatorCountIncrement
+    this.proposedValidatorCount = validatorCount
   }
 
   public async execute(): Promise<void> {
@@ -632,19 +634,21 @@ export class ValidatorCountProposalFixture extends BaseFixture {
     const description: string = 'Testing validator count proposal ' + uuid().substring(0, 8)
 
     // Proposal stake calculation
-    const proposalStake: BN = new BN(100000)
+    const proposalStake: BN = new BN(500000)
     const proposalFee: BN = this.api.estimateProposeValidatorCountFee(description, description, proposalStake)
     this.api.treasuryTransferBalance(this.proposer, proposalFee.add(proposalStake))
-    const validatorCount: BN = await this.api.getValidatorCount()
+    const currentValidatorCount: BN = await this.api.getValidatorCount()
 
     // Proposal creation
-    const proposedValidatorCount: BN = validatorCount.add(this.validatorCountIncrement)
+    // Make sure proposed is different than current to ensure change is applied.
+    assert(!currentValidatorCount.eq(this.proposedValidatorCount))
+
     const result = await this.api.proposeValidatorCount(
       this.proposer,
       proposalTitle,
       description,
       proposalStake,
-      proposedValidatorCount
+      this.proposedValidatorCount
     )
     const proposalNumber: ProposalId = this.api.findProposalCreatedEvent(result.events) as ProposalId
     assert.notEqual(proposalNumber, undefined)
@@ -656,8 +660,8 @@ export class ValidatorCountProposalFixture extends BaseFixture {
 
     const newValidatorCount: BN = await this.api.getValidatorCount()
     assert(
-      proposedValidatorCount.eq(newValidatorCount),
-      `Validator count has unexpeccted value ${newValidatorCount}, expected ${proposedValidatorCount}`
+      this.proposedValidatorCount.eq(newValidatorCount),
+      `Validator count has unexpeccted value ${newValidatorCount}, expected ${this.proposedValidatorCount}`
     )
   }
 }

+ 3 - 4
tests/network-tests/src/flows/proposals/validatorCountProposal.ts

@@ -6,7 +6,7 @@ import { FixtureRunner } from '../../Fixture'
 import Debugger from 'debug'
 import { Resource } from '../../Resources'
 
-export default async function validatorCount({ api, env, lock }: FlowProps): Promise<void> {
+export default async function validatorCount({ api, lock }: FlowProps): Promise<void> {
   const debug = Debugger('flow:validatorCountProposal')
   debug('Started')
   await lock(Resource.Proposals)
@@ -16,13 +16,12 @@ export default async function validatorCount({ api, env, lock }: FlowProps): Pro
   assert(council.length)
 
   const proposer = council[0].member.toString()
-
-  const validatorCountIncrement: BN = new BN(+env.VALIDATOR_COUNT_INCREMENT!)
+  const proposedValidatorCount = new BN(300)
 
   const validatorCountProposalFixture: ValidatorCountProposalFixture = new ValidatorCountProposalFixture(
     api,
     proposer,
-    validatorCountIncrement
+    proposedValidatorCount
   )
   await new FixtureRunner(validatorCountProposalFixture).run()