mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-22 21:55:45 +00:00
Nonlinear locking and cleanups (#2733)
* Nonlinear locking and cleanups * Bump runtime version * Minor cleanup * Fix tests * Fix council tests * Fix flaw in turnout counting * fix: lock_voting_should_work_with_delegation test * chore: fix comment refering to unexisting function
This commit is contained in:
@@ -29,7 +29,7 @@ mod tests {
|
||||
// These re-exports are here for a reason, edit with care
|
||||
pub use super::*;
|
||||
pub use runtime_io::with_externalities;
|
||||
use srml_support::{impl_outer_origin, impl_outer_event, impl_outer_dispatch};
|
||||
use srml_support::{impl_outer_origin, impl_outer_event, impl_outer_dispatch, parameter_types};
|
||||
pub use substrate_primitives::H256;
|
||||
pub use primitives::BuildStorage;
|
||||
pub use primitives::traits::{BlakeTwo256, IdentityLookup};
|
||||
@@ -81,10 +81,20 @@ mod tests {
|
||||
type TransferPayment = ();
|
||||
type DustRemoval = ();
|
||||
}
|
||||
parameter_types! {
|
||||
pub const LaunchPeriod: u64 = 1;
|
||||
pub const VotingPeriod: u64 = 3;
|
||||
pub const MinimumDeposit: u64 = 1;
|
||||
pub const EnactmentPeriod: u64 = 0;
|
||||
}
|
||||
impl democracy::Trait for Test {
|
||||
type Currency = balances::Module<Self>;
|
||||
type Proposal = Call;
|
||||
type Event = Event;
|
||||
type Currency = balances::Module<Self>;
|
||||
type EnactmentPeriod = EnactmentPeriod;
|
||||
type LaunchPeriod = LaunchPeriod;
|
||||
type VotingPeriod = VotingPeriod;
|
||||
type MinimumDeposit = MinimumDeposit;
|
||||
}
|
||||
impl seats::Trait for Test {
|
||||
type Event = Event;
|
||||
@@ -111,13 +121,7 @@ mod tests {
|
||||
creation_fee: 0,
|
||||
vesting: vec![],
|
||||
}.build_storage().unwrap().0);
|
||||
t.extend(democracy::GenesisConfig::<Test>{
|
||||
launch_period: 1,
|
||||
voting_period: 3,
|
||||
minimum_deposit: 1,
|
||||
public_delay: 0,
|
||||
max_lock_periods: 6,
|
||||
}.build_storage().unwrap().0);
|
||||
t.extend(democracy::GenesisConfig::<Test>::default().build_storage().unwrap().0);
|
||||
t.extend(seats::GenesisConfig::<Test> {
|
||||
candidacy_bond: 9,
|
||||
voter_bond: 3,
|
||||
|
||||
+627
-353
File diff suppressed because it is too large
Load Diff
@@ -65,6 +65,39 @@ pub use self::dispatch::{Parameter, Dispatchable, Callable, IsSubType};
|
||||
pub use self::double_map::StorageDoubleMapWithHasher;
|
||||
pub use runtime_io::{print, storage_root};
|
||||
|
||||
/// Macro for easily creating a new implementation of the `Get` trait. Use similarly to
|
||||
/// how you would declare a `const`:
|
||||
///
|
||||
/// ```no_compile
|
||||
/// parameter_types! {
|
||||
/// pub const Argument: u64 = 42;
|
||||
/// }
|
||||
/// trait Config {
|
||||
/// type Parameter: Get<u64>;
|
||||
/// }
|
||||
/// struct Runtime;
|
||||
/// impl Config for Runtime {
|
||||
/// type Parameter = Argument;
|
||||
/// }
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! parameter_types {
|
||||
(pub const $name:ident: $type:ty = $value:expr; $( $rest:tt )*) => (
|
||||
pub struct $name;
|
||||
$crate::parameter_types!{IMPL $name , $type , $value}
|
||||
$crate::parameter_types!{ $( $rest )* }
|
||||
);
|
||||
(const $name:ident: $type:ty = $value:expr; $( $rest:tt )*) => (
|
||||
struct $name;
|
||||
$crate::parameter_types!{IMPL $name , $type , $value}
|
||||
$crate::parameter_types!{ $( $rest )* }
|
||||
);
|
||||
() => ();
|
||||
(IMPL $name:ident , $type:ty , $value:expr) => {
|
||||
impl $crate::traits::Get<$type> for $name { fn get() -> $type { $value } }
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(inline)]
|
||||
pub use srml_support_procedural::decl_storage;
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Traits for SRML
|
||||
//! Traits for SRML.
|
||||
//!
|
||||
//! NOTE: If you're looking for `parameter_types`, it has moved in to the top-level module.
|
||||
|
||||
use crate::rstd::result;
|
||||
use crate::codec::{Codec, Encode, Decode};
|
||||
@@ -28,39 +30,6 @@ pub trait Get<T> {
|
||||
fn get() -> T;
|
||||
}
|
||||
|
||||
/// Macro for easily creating a new implementation of the `Get` trait. Use similarly to
|
||||
/// how you would declare a `const`:
|
||||
///
|
||||
/// ```no_compile
|
||||
/// parameter_types! {
|
||||
/// pub const Argument: u64 = 42;
|
||||
/// }
|
||||
/// trait Config {
|
||||
/// type Parameter: Get<u64>;
|
||||
/// }
|
||||
/// struct Runtime;
|
||||
/// impl Config for Runtime {
|
||||
/// type Parameter = Argument;
|
||||
/// }
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! parameter_types {
|
||||
(pub const $name:ident: $type:ty = $value:expr; $( $rest:tt )*) => (
|
||||
pub struct $name;
|
||||
$crate::parameter_types!{IMPL $name , $type , $value}
|
||||
$crate::parameter_types!{ $( $rest )* }
|
||||
);
|
||||
(const $name:ident: $type:ty = $value:expr; $( $rest:tt )*) => (
|
||||
struct $name;
|
||||
$crate::parameter_types!{IMPL $name , $type , $value}
|
||||
$crate::parameter_types!{ $( $rest )* }
|
||||
);
|
||||
() => ();
|
||||
(IMPL $name:ident , $type:ty , $value:expr) => {
|
||||
impl $crate::traits::Get<$type> for $name { fn get() -> $type { $value } }
|
||||
}
|
||||
}
|
||||
|
||||
/// The account with the given id was killed.
|
||||
pub trait OnFreeBalanceZero<AccountId> {
|
||||
/// The account was the given id was killed.
|
||||
|
||||
Reference in New Issue
Block a user