mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Backport all v0.6 changes to master... (#552)
* Bump Substrate and versions (#531) * Bump versions * Build fix. * Enable governance (#536) * Enable governance * Tweak a few parameters * Bump substrate, versions. (#538) * Bump substrate, versions. * Build fix * Bump rpc deps (#537) * Update to latest sub * Revert branch update * Update. * Update tests. * Ignore warnings in tests. * Revert substrate (#540) * Version bump * Bump Substrate, versions. (#542) * Bump Substrate, versions. Also revert the enabling of democracy * Build fix * Bump Substrate (#544) * Bump Substrate * Fix * A few tidyups * Bump Substrate (#547) * Bump Substrate * Another bump * Fixed build for new block_import API * Enable grandpa migration. (#549) * Enable grandpa migration. * Bump runtime version
This commit is contained in:
committed by
Bastian Köcher
parent
88150e83d2
commit
bd79b34bb3
@@ -67,8 +67,9 @@
|
||||
//! funds ultimately end up in module's fund sub-account.
|
||||
|
||||
use srml_support::{
|
||||
decl_module, decl_storage, decl_event, storage::child, ensure,
|
||||
traits::{Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement}
|
||||
decl_module, decl_storage, decl_event, storage::child, ensure, traits::{
|
||||
Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement::AllowDeath
|
||||
}
|
||||
};
|
||||
use system::ensure_signed;
|
||||
use sr_primitives::{ModuleId, weights::SimpleDispatchInfo,
|
||||
@@ -204,12 +205,8 @@ decl_module! {
|
||||
ensure!(end > <system::Module<T>>::block_number(), "end must be in the future");
|
||||
|
||||
let deposit = T::SubmissionDeposit::get();
|
||||
let imb = T::Currency::withdraw(
|
||||
&owner,
|
||||
deposit,
|
||||
WithdrawReason::Transfer.into(),
|
||||
ExistenceRequirement::AllowDeath,
|
||||
)?;
|
||||
let transfer = WithdrawReason::Transfer.into();
|
||||
let imb = T::Currency::withdraw(&owner, deposit, transfer, AllowDeath)?;
|
||||
|
||||
let index = FundCount::get();
|
||||
let next_index = index.checked_add(1).ok_or("overflow when adding fund")?;
|
||||
@@ -250,7 +247,7 @@ decl_module! {
|
||||
let now = <system::Module<T>>::block_number();
|
||||
ensure!(fund.end > now, "contribution period ended");
|
||||
|
||||
T::Currency::transfer(&who, &Self::fund_account_id(index), value)?;
|
||||
T::Currency::transfer(&who, &Self::fund_account_id(index), value, AllowDeath)?;
|
||||
|
||||
let balance = Self::contribution_get(index, &who);
|
||||
let balance = balance.saturating_add(value);
|
||||
@@ -375,12 +372,10 @@ decl_module! {
|
||||
ensure!(balance > Zero::zero(), "no contributions stored");
|
||||
|
||||
// Avoid using transfer to ensure we don't pay any fees.
|
||||
let _ = T::Currency::resolve_into_existing(&who, T::Currency::withdraw(
|
||||
&Self::fund_account_id(index),
|
||||
balance,
|
||||
WithdrawReason::Transfer.into(),
|
||||
ExistenceRequirement::AllowDeath
|
||||
)?);
|
||||
let fund_account = &Self::fund_account_id(index);
|
||||
let transfer = WithdrawReason::Transfer.into();
|
||||
let imbalance = T::Currency::withdraw(fund_account, balance, transfer, AllowDeath)?;
|
||||
let _ = T::Currency::resolve_into_existing(&who, imbalance);
|
||||
|
||||
Self::contribution_kill(index, &who);
|
||||
fund.raised = fund.raised.saturating_sub(balance);
|
||||
@@ -404,19 +399,12 @@ decl_module! {
|
||||
let account = Self::fund_account_id(index);
|
||||
|
||||
// Avoid using transfer to ensure we don't pay any fees.
|
||||
let _ = T::Currency::resolve_into_existing(&fund.owner, T::Currency::withdraw(
|
||||
&account,
|
||||
fund.deposit,
|
||||
WithdrawReason::Transfer.into(),
|
||||
ExistenceRequirement::AllowDeath
|
||||
)?);
|
||||
let transfer = WithdrawReason::Transfer.into();
|
||||
let imbalance = T::Currency::withdraw(&account, fund.deposit, transfer, AllowDeath)?;
|
||||
let _ = T::Currency::resolve_into_existing(&fund.owner, imbalance);
|
||||
|
||||
T::OrphanedFunds::on_unbalanced(T::Currency::withdraw(
|
||||
&account,
|
||||
fund.raised,
|
||||
WithdrawReason::Transfer.into(),
|
||||
ExistenceRequirement::AllowDeath
|
||||
)?);
|
||||
let imbalance = T::Currency::withdraw(&account, fund.raised, transfer, AllowDeath)?;
|
||||
T::OrphanedFunds::on_unbalanced(imbalance);
|
||||
|
||||
Self::crowdfund_kill(index);
|
||||
<Funds<T>>::remove(index);
|
||||
|
||||
+15
-11
@@ -99,7 +99,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("kusama"),
|
||||
impl_name: create_runtime_str!("parity-kusama"),
|
||||
authoring_version: 1,
|
||||
spec_version: 1012,
|
||||
spec_version: 1017,
|
||||
impl_version: 0,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
};
|
||||
@@ -129,12 +129,9 @@ impl SignedExtension for OnlyStakingAndClaims {
|
||||
-> TransactionValidity
|
||||
{
|
||||
match call {
|
||||
Call::Staking(_) | Call::Claims(_) | Call::Sudo(_) | Call::Session(_)
|
||||
| Call::ElectionsPhragmen(_) | Call::TechnicalMembership(_)
|
||||
| Call::TechnicalCommittee(_) | Call::Nicks(_)
|
||||
=>
|
||||
Ok(Default::default()),
|
||||
_ => Err(InvalidTransaction::Custom(ValidityError::NoPermission.into()).into()),
|
||||
Call::Balances(_) | Call::Slots(_) | Call::Registrar(_) | Call::Democracy(_)
|
||||
=> Err(InvalidTransaction::Custom(ValidityError::NoPermission.into()).into()),
|
||||
_ => Ok(Default::default()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,7 +303,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl staking::Trait for Runtime {
|
||||
type OnRewardMinted = Treasury;
|
||||
type RewardRemainder = Treasury;
|
||||
type CurrencyToVote = CurrencyToVoteHandler;
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
@@ -323,7 +320,8 @@ parameter_types! {
|
||||
// KUSAMA: These values are 1/4 of what we expect for the mainnet.
|
||||
pub const LaunchPeriod: BlockNumber = 7 * DAYS;
|
||||
pub const VotingPeriod: BlockNumber = 7 * DAYS;
|
||||
pub const EmergencyVotingPeriod: BlockNumber = 3 * HOURS;
|
||||
// KUSAMA: This is a bit short; should be increased to 3 hours.
|
||||
pub const EmergencyVotingPeriod: BlockNumber = 1 * HOURS;
|
||||
pub const MinimumDeposit: Balance = 100 * DOLLARS;
|
||||
pub const EnactmentPeriod: BlockNumber = 8 * DAYS;
|
||||
pub const CooloffPeriod: BlockNumber = 7 * DAYS;
|
||||
@@ -341,7 +339,8 @@ impl democracy::Trait for Runtime {
|
||||
/// A straight majority of the council can decide what their next motion is.
|
||||
type ExternalOrigin = collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>;
|
||||
/// A super-majority can have the next scheduled referendum be a straight majority-carries vote.
|
||||
type ExternalMajorityOrigin = collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>;
|
||||
// KUSAMA: A majority can have the next scheduled legislation be majority-carries.
|
||||
type ExternalMajorityOrigin = collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>;
|
||||
/// A unanimous council can have the next scheduled referendum be a straight default-carries
|
||||
/// (NTB) vote.
|
||||
type ExternalDefaultOrigin = collective::EnsureProportionAtLeast<_1, _1, AccountId, CouncilCollective>;
|
||||
@@ -366,7 +365,7 @@ impl collective::Trait<CouncilCollective> for Runtime {
|
||||
parameter_types! {
|
||||
pub const CandidacyBond: Balance = 100 * DOLLARS;
|
||||
pub const VotingBond: Balance = 5 * DOLLARS;
|
||||
pub const TermDuration: BlockNumber = 10 * MINUTES;
|
||||
pub const TermDuration: BlockNumber = 2 * HOURS;
|
||||
pub const DesiredMembers: u32 = 13;
|
||||
pub const DesiredRunnersUp: u32 = 7;
|
||||
}
|
||||
@@ -432,12 +431,17 @@ impl offences::Trait for Runtime {
|
||||
|
||||
type SubmitTransaction = TransactionSubmitter<ImOnlineId, Runtime, UncheckedExtrinsic>;
|
||||
|
||||
parameter_types! {
|
||||
pub const SessionDuration: BlockNumber = EPOCH_DURATION_IN_BLOCKS as _;
|
||||
}
|
||||
|
||||
impl im_online::Trait for Runtime {
|
||||
type AuthorityId = ImOnlineId;
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
type SubmitTransaction = SubmitTransaction;
|
||||
type ReportUnresponsiveness = Offences;
|
||||
type SessionDuration = SessionDuration;
|
||||
}
|
||||
|
||||
impl grandpa::Trait for Runtime {
|
||||
|
||||
@@ -1046,7 +1046,7 @@ mod tests {
|
||||
}
|
||||
|
||||
impl staking::Trait for Test {
|
||||
type OnRewardMinted = ();
|
||||
type RewardRemainder = ();
|
||||
type CurrencyToVote = ();
|
||||
type Event = ();
|
||||
type Currency = balances::Module<Test>;
|
||||
|
||||
Reference in New Issue
Block a user