mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
OpenGov improvements for Kusama (#6372)
* Tweaks to optimise gov2 * Use new inactive funds * Introduce migrations * Fixes * Fixes * Fixes * Some constant updates for Fellowship * Further tweaks * Lower floor for whitelisted
This commit is contained in:
@@ -15,7 +15,50 @@
|
|||||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use frame_support::{storage_alias, Twox64Concat};
|
use frame_support::{
|
||||||
|
dispatch::GetStorageVersion, storage_alias, traits::OnRuntimeUpgrade, Twox64Concat,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct MigrateToTrackInactive<T>(sp_std::marker::PhantomData<T>);
|
||||||
|
impl<T: Config> OnRuntimeUpgrade for MigrateToTrackInactive<T> {
|
||||||
|
fn on_runtime_upgrade() -> Weight {
|
||||||
|
let current_version = Pallet::<T>::current_storage_version();
|
||||||
|
let onchain_version = Pallet::<T>::on_chain_storage_version();
|
||||||
|
|
||||||
|
if onchain_version == 0 && current_version == 1 {
|
||||||
|
let mut translated = 0u64;
|
||||||
|
for index in Funds::<T>::iter_keys() {
|
||||||
|
let b = CurrencyOf::<T>::total_balance(&Pallet::<T>::fund_account_id(index.into()));
|
||||||
|
CurrencyOf::<T>::deactivate(b);
|
||||||
|
translated.saturating_inc();
|
||||||
|
}
|
||||||
|
current_version.put::<Pallet<T>>();
|
||||||
|
log::info!(target: "runtime::crowdloan", "Summed {} funds, storage to version {:?}", translated, current_version);
|
||||||
|
T::DbWeight::get().reads_writes(translated * 2 + 1, translated * 2 + 1)
|
||||||
|
} else {
|
||||||
|
log::info!(target: "runtime::crowdloan", "Migration did not execute. This probably should be removed");
|
||||||
|
T::DbWeight::get().reads(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "try-runtime")]
|
||||||
|
fn pre_upgrade() -> Result<Vec<u8>, &'static str> {
|
||||||
|
let total = Funds::<T>::iter_keys()
|
||||||
|
.map(|index| {
|
||||||
|
CurrencyOf::<T>::total_balance(&Pallet::<T>::fund_account_id(index.into()))
|
||||||
|
})
|
||||||
|
.fold(BalanceOf::<T>::zero(), |a, i| a.saturating_add(i));
|
||||||
|
Ok((total, CurrencyOf::<T>::active_issuance()).encode())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "try-runtime")]
|
||||||
|
fn post_upgrade(total: Vec<u8>) -> Result<(), &'static str> {
|
||||||
|
let (total, active) = <(BalanceOf<T>, BalanceOf<T>)>::decode(&mut total.as_slice())
|
||||||
|
.expect("the state parameter should be something that was generated by pre_upgrade");
|
||||||
|
assert_eq!(active - total, CurrencyOf::<T>::active_issuance(), "the total be correct");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Migrations for using fund index to create fund accounts instead of para ID.
|
/// Migrations for using fund index to create fund accounts instead of para ID.
|
||||||
pub mod crowdloan_index_migration {
|
pub mod crowdloan_index_migration {
|
||||||
|
|||||||
@@ -51,6 +51,8 @@
|
|||||||
|
|
||||||
pub mod migration;
|
pub mod migration;
|
||||||
|
|
||||||
|
// TODO: Expose the total amount held.
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
slot_range::SlotRange,
|
slot_range::SlotRange,
|
||||||
traits::{Auctioneer, Registrar},
|
traits::{Auctioneer, Registrar},
|
||||||
@@ -488,6 +490,7 @@ pub mod pallet {
|
|||||||
ensure!(balance > Zero::zero(), Error::<T>::NoContributions);
|
ensure!(balance > Zero::zero(), Error::<T>::NoContributions);
|
||||||
|
|
||||||
CurrencyOf::<T>::transfer(&fund_account, &who, balance, AllowDeath)?;
|
CurrencyOf::<T>::transfer(&fund_account, &who, balance, AllowDeath)?;
|
||||||
|
CurrencyOf::<T>::reactivate(balance);
|
||||||
|
|
||||||
Self::contribution_kill(fund.fund_index, &who);
|
Self::contribution_kill(fund.fund_index, &who);
|
||||||
fund.raised = fund.raised.saturating_sub(balance);
|
fund.raised = fund.raised.saturating_sub(balance);
|
||||||
@@ -527,6 +530,7 @@ pub mod pallet {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
CurrencyOf::<T>::transfer(&fund_account, &who, balance, AllowDeath)?;
|
CurrencyOf::<T>::transfer(&fund_account, &who, balance, AllowDeath)?;
|
||||||
|
CurrencyOf::<T>::reactivate(balance);
|
||||||
Self::contribution_kill(fund.fund_index, &who);
|
Self::contribution_kill(fund.fund_index, &who);
|
||||||
fund.raised = fund.raised.saturating_sub(balance);
|
fund.raised = fund.raised.saturating_sub(balance);
|
||||||
refund_count += 1;
|
refund_count += 1;
|
||||||
@@ -777,6 +781,7 @@ impl<T: Config> Pallet<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CurrencyOf::<T>::transfer(&who, &fund_account, value, existence)?;
|
CurrencyOf::<T>::transfer(&who, &fund_account, value, existence)?;
|
||||||
|
CurrencyOf::<T>::deactivate(value);
|
||||||
|
|
||||||
let balance = old_balance.saturating_add(value);
|
let balance = old_balance.saturating_add(value);
|
||||||
Self::contribution_put(fund.fund_index, &who, &balance, &memo);
|
Self::contribution_put(fund.fund_index, &who, &balance, &memo);
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ pub mod currency {
|
|||||||
pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS;
|
pub const EXISTENTIAL_DEPOSIT: Balance = 1 * CENTS;
|
||||||
|
|
||||||
pub const UNITS: Balance = 1_000_000_000_000;
|
pub const UNITS: Balance = 1_000_000_000_000;
|
||||||
pub const CENTS: Balance = UNITS / 30_000;
|
pub const QUID: Balance = UNITS / 30;
|
||||||
pub const QUID: Balance = CENTS * 100;
|
pub const CENTS: Balance = QUID / 100;
|
||||||
pub const GRAND: Balance = QUID * 1_000;
|
pub const GRAND: Balance = QUID * 1_000;
|
||||||
pub const MILLICENTS: Balance = CENTS / 1_000;
|
pub const MILLICENTS: Balance = CENTS / 1_000;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 4,
|
min_enactment_period: 1 * MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -72,7 +72,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 4,
|
min_enactment_period: 1 * MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -94,7 +94,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 4,
|
min_enactment_period: 1 * MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -138,7 +138,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 4,
|
min_enactment_period: 1 * MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -160,7 +160,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 4,
|
min_enactment_period: 1 * MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -182,7 +182,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 4,
|
min_enactment_period: 1 * MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -204,7 +204,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 4,
|
min_enactment_period: 1 * MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -226,7 +226,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 4,
|
min_enactment_period: 1 * MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
@@ -248,7 +248,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
|||||||
prepare_period: 30 * MINUTES,
|
prepare_period: 30 * MINUTES,
|
||||||
decision_period: 7 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 30 * MINUTES,
|
confirm_period: 30 * MINUTES,
|
||||||
min_enactment_period: 4,
|
min_enactment_period: 1 * MINUTES,
|
||||||
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
min_approval: pallet_referenda::Curve::LinearDecreasing {
|
||||||
length: Perbill::from_percent(100),
|
length: Perbill::from_percent(100),
|
||||||
floor: Perbill::from_percent(50),
|
floor: Perbill::from_percent(50),
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ impl pallet_conviction_voting::Config for Runtime {
|
|||||||
type Currency = Balances;
|
type Currency = Balances;
|
||||||
type VoteLockingPeriod = VoteLockingPeriod;
|
type VoteLockingPeriod = VoteLockingPeriod;
|
||||||
type MaxVotes = ConstU32<512>;
|
type MaxVotes = ConstU32<512>;
|
||||||
type MaxTurnout = frame_support::traits::TotalIssuanceOf<Balances, Self::AccountId>;
|
type MaxTurnout =
|
||||||
|
frame_support::traits::tokens::currency::ActiveIssuanceOf<Balances, Self::AccountId>;
|
||||||
type Polls = Referenda;
|
type Polls = Referenda;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ pub mod pallet_custom_origins {
|
|||||||
SmallSpender = 10 * GRAND,
|
SmallSpender = 10 * GRAND,
|
||||||
MediumSpender = 100 * GRAND,
|
MediumSpender = 100 * GRAND,
|
||||||
BigSpender = 1_000 * GRAND,
|
BigSpender = 1_000 * GRAND,
|
||||||
|
Treasurer = 10_000 * GRAND,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ const SUP_BIG_SPENDER: Curve = Curve::make_reciprocal(20, 28, percent(1), percen
|
|||||||
const APP_WHITELISTED_CALLER: Curve =
|
const APP_WHITELISTED_CALLER: Curve =
|
||||||
Curve::make_reciprocal(16, 28 * 24, percent(96), percent(50), percent(100));
|
Curve::make_reciprocal(16, 28 * 24, percent(96), percent(50), percent(100));
|
||||||
const SUP_WHITELISTED_CALLER: Curve =
|
const SUP_WHITELISTED_CALLER: Curve =
|
||||||
Curve::make_reciprocal(1, 28, percent(20), percent(10), percent(50));
|
Curve::make_reciprocal(1, 28, percent(20), percent(5), percent(50));
|
||||||
|
|
||||||
const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15] = [
|
const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15] = [
|
||||||
(
|
(
|
||||||
@@ -71,9 +71,9 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
pallet_referenda::TrackInfo {
|
pallet_referenda::TrackInfo {
|
||||||
name: "root",
|
name: "root",
|
||||||
max_deciding: 1,
|
max_deciding: 1,
|
||||||
decision_deposit: 1_000 * GRAND,
|
decision_deposit: 100 * GRAND,
|
||||||
prepare_period: 3 * HOURS,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 3 * HOURS,
|
confirm_period: 3 * HOURS,
|
||||||
min_enactment_period: 3 * HOURS,
|
min_enactment_period: 3 * HOURS,
|
||||||
min_approval: APP_ROOT,
|
min_approval: APP_ROOT,
|
||||||
@@ -84,10 +84,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
1,
|
1,
|
||||||
pallet_referenda::TrackInfo {
|
pallet_referenda::TrackInfo {
|
||||||
name: "whitelisted_caller",
|
name: "whitelisted_caller",
|
||||||
max_deciding: 10,
|
max_deciding: 30,
|
||||||
decision_deposit: 10_000 * GRAND,
|
decision_deposit: 100 * GRAND,
|
||||||
prepare_period: 3 * HOURS,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 10 * MINUTES,
|
confirm_period: 10 * MINUTES,
|
||||||
min_enactment_period: 30 * MINUTES,
|
min_enactment_period: 30 * MINUTES,
|
||||||
min_approval: APP_WHITELISTED_CALLER,
|
min_approval: APP_WHITELISTED_CALLER,
|
||||||
@@ -100,8 +100,8 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "staking_admin",
|
name: "staking_admin",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 5 * GRAND,
|
decision_deposit: 5 * GRAND,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 3 * HOURS,
|
confirm_period: 3 * HOURS,
|
||||||
min_enactment_period: 2 * DAYS,
|
min_enactment_period: 2 * DAYS,
|
||||||
min_approval: APP_STAKING_ADMIN,
|
min_approval: APP_STAKING_ADMIN,
|
||||||
@@ -114,8 +114,8 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "treasurer",
|
name: "treasurer",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 5 * GRAND,
|
decision_deposit: 5 * GRAND,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 3 * HOURS,
|
confirm_period: 3 * HOURS,
|
||||||
min_enactment_period: 2 * DAYS,
|
min_enactment_period: 2 * DAYS,
|
||||||
min_approval: APP_TREASURER,
|
min_approval: APP_TREASURER,
|
||||||
@@ -128,8 +128,8 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "lease_admin",
|
name: "lease_admin",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 5 * GRAND,
|
decision_deposit: 5 * GRAND,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 3 * HOURS,
|
confirm_period: 3 * HOURS,
|
||||||
min_enactment_period: 2 * DAYS,
|
min_enactment_period: 2 * DAYS,
|
||||||
min_approval: APP_LEASE_ADMIN,
|
min_approval: APP_LEASE_ADMIN,
|
||||||
@@ -142,8 +142,8 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "fellowship_admin",
|
name: "fellowship_admin",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 5 * GRAND,
|
decision_deposit: 5 * GRAND,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 3 * HOURS,
|
confirm_period: 3 * HOURS,
|
||||||
min_enactment_period: 2 * DAYS,
|
min_enactment_period: 2 * DAYS,
|
||||||
min_approval: APP_FELLOWSHIP_ADMIN,
|
min_approval: APP_FELLOWSHIP_ADMIN,
|
||||||
@@ -156,8 +156,8 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "general_admin",
|
name: "general_admin",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 5 * GRAND,
|
decision_deposit: 5 * GRAND,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 3 * HOURS,
|
confirm_period: 3 * HOURS,
|
||||||
min_enactment_period: 2 * DAYS,
|
min_enactment_period: 2 * DAYS,
|
||||||
min_approval: APP_GENERAL_ADMIN,
|
min_approval: APP_GENERAL_ADMIN,
|
||||||
@@ -170,8 +170,8 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "auction_admin",
|
name: "auction_admin",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 5 * GRAND,
|
decision_deposit: 5 * GRAND,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 3 * HOURS,
|
confirm_period: 3 * HOURS,
|
||||||
min_enactment_period: 2 * DAYS,
|
min_enactment_period: 2 * DAYS,
|
||||||
min_approval: APP_AUCTION_ADMIN,
|
min_approval: APP_AUCTION_ADMIN,
|
||||||
@@ -184,8 +184,8 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "referendum_canceller",
|
name: "referendum_canceller",
|
||||||
max_deciding: 1_000,
|
max_deciding: 1_000,
|
||||||
decision_deposit: 50 * GRAND,
|
decision_deposit: 50 * GRAND,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 3 * HOURS,
|
confirm_period: 3 * HOURS,
|
||||||
min_enactment_period: 10 * MINUTES,
|
min_enactment_period: 10 * MINUTES,
|
||||||
min_approval: APP_REFERENDUM_CANCELLER,
|
min_approval: APP_REFERENDUM_CANCELLER,
|
||||||
@@ -198,8 +198,8 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "referendum_killer",
|
name: "referendum_killer",
|
||||||
max_deciding: 1_000,
|
max_deciding: 1_000,
|
||||||
decision_deposit: 50 * GRAND,
|
decision_deposit: 50 * GRAND,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 3 * HOURS,
|
confirm_period: 3 * HOURS,
|
||||||
min_enactment_period: 10 * MINUTES,
|
min_enactment_period: 10 * MINUTES,
|
||||||
min_approval: APP_REFERENDUM_KILLER,
|
min_approval: APP_REFERENDUM_KILLER,
|
||||||
@@ -212,10 +212,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "small_tipper",
|
name: "small_tipper",
|
||||||
max_deciding: 200,
|
max_deciding: 200,
|
||||||
decision_deposit: 5 * QUID,
|
decision_deposit: 5 * QUID,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 3 * HOURS,
|
confirm_period: 3 * HOURS,
|
||||||
min_enactment_period: 28 * DAYS,
|
min_enactment_period: 24 * HOURS,
|
||||||
min_approval: APP_SMALL_TIPPER,
|
min_approval: APP_SMALL_TIPPER,
|
||||||
min_support: SUP_SMALL_TIPPER,
|
min_support: SUP_SMALL_TIPPER,
|
||||||
},
|
},
|
||||||
@@ -226,10 +226,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "big_tipper",
|
name: "big_tipper",
|
||||||
max_deciding: 100,
|
max_deciding: 100,
|
||||||
decision_deposit: 50 * QUID,
|
decision_deposit: 50 * QUID,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 7 * DAYS,
|
||||||
confirm_period: 6 * HOURS,
|
confirm_period: 6 * HOURS,
|
||||||
min_enactment_period: 28 * DAYS,
|
min_enactment_period: 24 * HOURS,
|
||||||
min_approval: APP_BIG_TIPPER,
|
min_approval: APP_BIG_TIPPER,
|
||||||
min_support: SUP_BIG_TIPPER,
|
min_support: SUP_BIG_TIPPER,
|
||||||
},
|
},
|
||||||
@@ -240,10 +240,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "small_spender",
|
name: "small_spender",
|
||||||
max_deciding: 50,
|
max_deciding: 50,
|
||||||
decision_deposit: 500 * QUID,
|
decision_deposit: 500 * QUID,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 12 * HOURS,
|
confirm_period: 12 * HOURS,
|
||||||
min_enactment_period: 28 * DAYS,
|
min_enactment_period: 24 * HOURS,
|
||||||
min_approval: APP_SMALL_SPENDER,
|
min_approval: APP_SMALL_SPENDER,
|
||||||
min_support: SUP_SMALL_SPENDER,
|
min_support: SUP_SMALL_SPENDER,
|
||||||
},
|
},
|
||||||
@@ -254,10 +254,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "medium_spender",
|
name: "medium_spender",
|
||||||
max_deciding: 20,
|
max_deciding: 20,
|
||||||
decision_deposit: 1_500 * QUID,
|
decision_deposit: 1_500 * QUID,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 24 * HOURS,
|
confirm_period: 24 * HOURS,
|
||||||
min_enactment_period: 28 * DAYS,
|
min_enactment_period: 24 * HOURS,
|
||||||
min_approval: APP_MEDIUM_SPENDER,
|
min_approval: APP_MEDIUM_SPENDER,
|
||||||
min_support: SUP_MEDIUM_SPENDER,
|
min_support: SUP_MEDIUM_SPENDER,
|
||||||
},
|
},
|
||||||
@@ -268,10 +268,10 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
|
|||||||
name: "big_spender",
|
name: "big_spender",
|
||||||
max_deciding: 10,
|
max_deciding: 10,
|
||||||
decision_deposit: 5 * GRAND,
|
decision_deposit: 5 * GRAND,
|
||||||
prepare_period: 4,
|
prepare_period: 4 * HOURS,
|
||||||
decision_period: 28 * DAYS,
|
decision_period: 14 * DAYS,
|
||||||
confirm_period: 48 * HOURS,
|
confirm_period: 48 * HOURS,
|
||||||
min_enactment_period: 28 * DAYS,
|
min_enactment_period: 24 * HOURS,
|
||||||
min_approval: APP_BIG_SPENDER,
|
min_approval: APP_BIG_SPENDER,
|
||||||
min_support: SUP_BIG_SPENDER,
|
min_support: SUP_BIG_SPENDER,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ use governance::{
|
|||||||
old::CouncilCollective, pallet_custom_origins, AuctionAdmin, GeneralAdmin, LeaseAdmin,
|
old::CouncilCollective, pallet_custom_origins, AuctionAdmin, GeneralAdmin, LeaseAdmin,
|
||||||
StakingAdmin, Treasurer, TreasurySpender,
|
StakingAdmin, Treasurer, TreasurySpender,
|
||||||
};
|
};
|
||||||
|
use xcm_config::CheckAccount;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
@@ -1480,6 +1481,11 @@ impl Get<&'static str> for StakingMigrationV11OldPallet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub type Migrations = (
|
||||||
|
pallet_balances::migration::MigrateToTrackInactive<Runtime, CheckAccount>,
|
||||||
|
crowdloan::migration::MigrateToTrackInactive<Runtime>,
|
||||||
|
);
|
||||||
|
|
||||||
/// Unchecked extrinsic type as expected by this runtime.
|
/// Unchecked extrinsic type as expected by this runtime.
|
||||||
pub type UncheckedExtrinsic =
|
pub type UncheckedExtrinsic =
|
||||||
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
||||||
@@ -1490,7 +1496,7 @@ pub type Executive = frame_executive::Executive<
|
|||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithSystem,
|
AllPalletsWithSystem,
|
||||||
(),
|
Migrations,
|
||||||
>;
|
>;
|
||||||
/// The payload being signed in the transactions.
|
/// The payload being signed in the transactions.
|
||||||
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
|
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
|
||||||
@@ -2071,7 +2077,7 @@ mod tests_fess {
|
|||||||
// ensure this number does not change, or that it is checked after each change.
|
// ensure this number does not change, or that it is checked after each change.
|
||||||
// a 1 MB solution should need around 0.16 KSM deposit
|
// a 1 MB solution should need around 0.16 KSM deposit
|
||||||
let deposit = SignedDepositBase::get() + (SignedDepositByte::get() * 1024 * 1024);
|
let deposit = SignedDepositBase::get() + (SignedDepositByte::get() * 1024 * 1024);
|
||||||
assert_eq_error_rate!(deposit, UNITS * 16 / 100, UNITS / 100);
|
assert_eq_error_rate!(deposit, UNITS * 167 / 100, UNITS / 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1598,6 +1598,11 @@ impl Get<&'static str> for StakingMigrationV11OldPallet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub type Migrations = (
|
||||||
|
pallet_balances::migration::MigrateToTrackInactive<Runtime, xcm_config::CheckAccount>,
|
||||||
|
crowdloan::migration::MigrateToTrackInactive<Runtime>,
|
||||||
|
);
|
||||||
|
|
||||||
/// Unchecked extrinsic type as expected by this runtime.
|
/// Unchecked extrinsic type as expected by this runtime.
|
||||||
pub type UncheckedExtrinsic =
|
pub type UncheckedExtrinsic =
|
||||||
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
||||||
@@ -1608,7 +1613,7 @@ pub type Executive = frame_executive::Executive<
|
|||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithSystem,
|
AllPalletsWithSystem,
|
||||||
(),
|
Migrations,
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/// The payload being signed in transactions.
|
/// The payload being signed in transactions.
|
||||||
|
|||||||
@@ -1476,6 +1476,12 @@ pub type SignedExtra = (
|
|||||||
/// Unchecked extrinsic type as expected by this runtime.
|
/// Unchecked extrinsic type as expected by this runtime.
|
||||||
pub type UncheckedExtrinsic =
|
pub type UncheckedExtrinsic =
|
||||||
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
||||||
|
|
||||||
|
pub type Migrations = (
|
||||||
|
pallet_balances::migration::MigrateToTrackInactive<Runtime, xcm_config::CheckAccount>,
|
||||||
|
crowdloan::migration::MigrateToTrackInactive<Runtime>,
|
||||||
|
);
|
||||||
|
|
||||||
/// Executive: handles dispatch to the various modules.
|
/// Executive: handles dispatch to the various modules.
|
||||||
pub type Executive = frame_executive::Executive<
|
pub type Executive = frame_executive::Executive<
|
||||||
Runtime,
|
Runtime,
|
||||||
@@ -1483,7 +1489,7 @@ pub type Executive = frame_executive::Executive<
|
|||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithSystem,
|
AllPalletsWithSystem,
|
||||||
(),
|
Migrations,
|
||||||
>;
|
>;
|
||||||
/// The payload being signed in transactions.
|
/// The payload being signed in transactions.
|
||||||
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
|
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
|
||||||
|
|||||||
@@ -744,6 +744,7 @@ pub type SignedExtra = (
|
|||||||
/// Unchecked extrinsic type as expected by this runtime.
|
/// Unchecked extrinsic type as expected by this runtime.
|
||||||
pub type UncheckedExtrinsic =
|
pub type UncheckedExtrinsic =
|
||||||
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
||||||
|
|
||||||
/// Executive: handles dispatch to the various modules.
|
/// Executive: handles dispatch to the various modules.
|
||||||
pub type Executive = frame_executive::Executive<
|
pub type Executive = frame_executive::Executive<
|
||||||
Runtime,
|
Runtime,
|
||||||
|
|||||||
@@ -1212,6 +1212,11 @@ impl Get<&'static str> for StakingMigrationV11OldPallet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub type Migrations = (
|
||||||
|
pallet_balances::migration::MigrateToTrackInactive<Runtime, xcm_config::CheckAccount>,
|
||||||
|
crowdloan::migration::MigrateToTrackInactive<Runtime>,
|
||||||
|
);
|
||||||
|
|
||||||
/// Unchecked extrinsic type as expected by this runtime.
|
/// Unchecked extrinsic type as expected by this runtime.
|
||||||
pub type UncheckedExtrinsic =
|
pub type UncheckedExtrinsic =
|
||||||
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
||||||
@@ -1222,7 +1227,7 @@ pub type Executive = frame_executive::Executive<
|
|||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithSystem,
|
AllPalletsWithSystem,
|
||||||
(),
|
Migrations,
|
||||||
>;
|
>;
|
||||||
/// The payload being signed in transactions.
|
/// The payload being signed in transactions.
|
||||||
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
|
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;
|
||||||
|
|||||||
@@ -125,6 +125,9 @@ impl<
|
|||||||
AllowDeath,
|
AllowDeath,
|
||||||
)
|
)
|
||||||
.is_ok();
|
.is_ok();
|
||||||
|
if ok {
|
||||||
|
Currency::reactivate(amount);
|
||||||
|
}
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
ok,
|
ok,
|
||||||
"`can_check_in` must have returned `true` immediately prior; qed"
|
"`can_check_in` must have returned `true` immediately prior; qed"
|
||||||
@@ -138,6 +141,7 @@ impl<
|
|||||||
if let Some(amount) = Matcher::matches_fungible(what) {
|
if let Some(amount) = Matcher::matches_fungible(what) {
|
||||||
if let Some(checked_account) = CheckedAccount::get() {
|
if let Some(checked_account) = CheckedAccount::get() {
|
||||||
Currency::deposit_creating(&checked_account, amount);
|
Currency::deposit_creating(&checked_account, amount);
|
||||||
|
Currency::deactivate(amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user