mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 18:31:05 +00:00
Extended Balance Type for Staking's Election (#2134)
* First draft of extended balance type * Test cleanup. * Update staking docs. * Add a good failing test case for quintill * Bring back saturating. * Some final fixes * A few more. * Update wasm; Bump spec; * Re-bump. * Custom lossy conversion from currency to vote * remove print * Fix reverse conversion issue. * void. Re-trigger ci.
This commit is contained in:
@@ -18,16 +18,27 @@
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
use primitives::{traits::IdentityLookup, BuildStorage, Perbill};
|
||||
use primitives::{traits::{IdentityLookup, Convert}, BuildStorage, Perbill};
|
||||
use primitives::testing::{Digest, DigestItem, Header, UintAuthorityId, ConvertUintAuthorityId};
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
use runtime_io;
|
||||
use srml_support::impl_outer_origin;
|
||||
use crate::{GenesisConfig, Module, Trait, StakerStatus};
|
||||
|
||||
// The AccountId alias in this test module.
|
||||
/// The AccountId alias in this test module.
|
||||
pub type AccountIdType = u64;
|
||||
|
||||
/// Simple structure that exposes how u64 currency can be represented as... u64.
|
||||
pub struct CurrencyToVoteHandler;
|
||||
impl Convert<u64, u64> for CurrencyToVoteHandler {
|
||||
fn convert(x: u64) -> u64 { x }
|
||||
}
|
||||
impl Convert<u128, u64> for CurrencyToVoteHandler {
|
||||
fn convert(x: u128) -> u64 {
|
||||
x as u64
|
||||
}
|
||||
}
|
||||
|
||||
impl_outer_origin!{
|
||||
pub enum Origin for Test {}
|
||||
}
|
||||
@@ -73,6 +84,7 @@ impl timestamp::Trait for Test {
|
||||
}
|
||||
impl Trait for Test {
|
||||
type Currency = balances::Module<Self>;
|
||||
type CurrencyToVote = CurrencyToVoteHandler;
|
||||
type OnRewardMinted = ();
|
||||
type Event = ();
|
||||
type Slash = ();
|
||||
@@ -131,7 +143,6 @@ impl ExtBuilder {
|
||||
self
|
||||
}
|
||||
pub fn nominate(mut self, nominate: bool) -> Self {
|
||||
// NOTE: this only sets a dummy nominator for tests that want 10 and 20 (default validators) to be chosen by default.
|
||||
self.nominate = nominate;
|
||||
self
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user