Browse Source

Restore the deleted proposal details to preserve pioneer compatibility

Shamil Gadelshin 4 years ago
parent
commit
e797f7d95e

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

@@ -46,8 +46,18 @@ pub enum ProposalDetails<MintedBalance, CurrencyBalance, BlockNumber, AccountId,
     /// Balance for the `set content working group mint capacity` proposal
     SetContentWorkingGroupMintCapacity(MintedBalance),
 
+    /// ********** Deprecated during the Nicaea release.
+    /// It is kept only for backward compatibility in the Pioneer. **********
+    /// AccountId for the `evict storage provider` proposal
+    EvictStorageProvider(AccountId),
+
     /// Validator count for the `set validator count` proposal
     SetValidatorCount(u32),
+
+    /// ********** Deprecated during the Nicaea release.
+    /// It is kept only for backward compatibility in the Pioneer. **********
+    /// Role parameters for the `set storage role parameters` proposal
+    SetStorageRoleParameters(RoleParameters<CurrencyBalance, BlockNumber>),
 }
 
 impl<MintedBalance, CurrencyBalance, BlockNumber, AccountId, MemberId> Default
@@ -58,6 +68,45 @@ impl<MintedBalance, CurrencyBalance, BlockNumber, AccountId, MemberId> Default
     }
 }
 
+/// ********** Deprecated during the Nicaea release.
+/// It is kept only for backward compatibility in the Pioneer. **********
+#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
+#[derive(Encode, Decode, Copy, Clone, Eq, PartialEq, Debug)]
+pub struct RoleParameters<Balance, BlockNumber> {
+    /// Minimum balance required to stake to enter a role.
+    pub min_stake: Balance,
+
+    /// Minimum actors to maintain - if role is unstaking
+    /// and remaining actors would be less that this value - prevent or punish for unstaking.
+    pub min_actors: u32,
+
+    /// The maximum number of spots available to fill for a role.
+    pub max_actors: u32,
+
+    /// Fixed amount of tokens paid to actors' primary account.
+    pub reward: Balance,
+
+    /// Payouts are made at this block interval.
+    pub reward_period: BlockNumber,
+
+    /// Minimum amount of time before being able to unstake.
+    pub bonding_period: BlockNumber,
+
+    /// How long tokens remain locked for after unstaking.
+    pub unbonding_period: BlockNumber,
+
+    /// Minimum period required to be in service. unbonding before this time is highly penalized
+    pub min_service_period: BlockNumber,
+
+    /// "Startup" time allowed for roles that need to sync their infrastructure
+    /// with other providers before they are considered in service and punishable for
+    /// not delivering required level of service.
+    pub startup_grace_period: BlockNumber,
+
+    /// Small fee burned to make a request to enter role.
+    pub entry_request_fee: Balance,
+}
+
 /// Contains proposal config parameters. Default values are used by migration and genesis config.
 pub struct ProposalsConfigParameters {
     /// 'Set validator count' proposal voting period

+ 13 - 0
runtime/src/integration/proposals/proposal_encoder.rs

@@ -3,6 +3,7 @@ use proposals_codex::{ProposalDetails, ProposalDetailsOf, ProposalEncoder};
 
 use codec::Encode;
 use rstd::vec::Vec;
+use srml_support::print;
 
 /// _ProposalEncoder_ implementation. It encodes extrinsics with proposal details parameters
 /// using Runtime Call and parity codec.
@@ -38,6 +39,18 @@ impl ProposalEncoder<Runtime> for ExtrinsicProposalEncoder {
                 proposals_codex::Call::execute_runtime_upgrade_proposal(wasm_code),
             )
             .encode(),
+            // ********** Deprecated during the Nicaea release.
+            // It is kept only for backward compatibility in the Pioneer. **********
+            ProposalDetails::EvictStorageProvider(_) => {
+                print("Error: Calling deprecated EvictStorageProvider encoding option.");
+                Vec::new()
+            }
+            // ********** Deprecated during the Nicaea release.
+            // It is kept only for backward compatibility in the Pioneer. **********
+            ProposalDetails::SetStorageRoleParameters(_) => {
+                print("Error: Calling deprecated SetStorageRoleParameters encoding option.");
+                Vec::new()
+            }
         }
     }
 }