update substrate reference (#244)

* port polkadot_runtime and polkadot_validation

* update storages build (#245)

* all tests pass

* rebuild wasm
This commit is contained in:
Robert Habermeier
2019-05-06 18:25:55 +02:00
committed by GitHub
parent e42019e1dc
commit a65be1b2df
18 changed files with 1127 additions and 620 deletions
+17 -1
View File
@@ -90,7 +90,7 @@ use client::{
use sr_primitives::{
ApplyResult, generic, transaction_validity::TransactionValidity,
traits::{
BlakeTwo256, Block as BlockT, DigestFor, StaticLookup, CurrencyToVoteHandler, AuthorityIdFor
BlakeTwo256, Block as BlockT, DigestFor, StaticLookup, Convert, AuthorityIdFor
}
};
use version::RuntimeVersion;
@@ -188,6 +188,22 @@ impl session::Trait for Runtime {
type Event = Event;
}
/// Converter for currencies to votes.
pub struct CurrencyToVoteHandler;
impl CurrencyToVoteHandler {
fn factor() -> u128 { (Balances::total_issuance() / u64::max_value() as u128).max(1) }
}
impl Convert<u128, u64> for CurrencyToVoteHandler {
fn convert(x: u128) -> u64 { (x / Self::factor()) as u64 }
}
impl Convert<u128, u128> for CurrencyToVoteHandler {
fn convert(x: u128) -> u128 { x * Self::factor() }
}
impl staking::Trait for Runtime {
type OnRewardMinted = Treasury;
type CurrencyToVote = CurrencyToVoteHandler;