mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
Refactor sr_primitives. (#3214)
* refactor sr_primitives. * Fix try build error. * Line-width * Ui test. * Final fixes. * Fix build again. * bring back ui test. * Fix unsigned import. * Another ui fix. * Also refactor substrate-primitives * Fix benchmarks. * Fix doc test. * fix doc tests
This commit is contained in:
committed by
Bastian Köcher
parent
cf80af9255
commit
79feb23a22
@@ -11,14 +11,14 @@ parity-codec = { version = "4.1.1", default-features = false, features = ["deriv
|
||||
substrate-keyring = { path = "../../core/keyring", optional = true }
|
||||
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }
|
||||
runtime_io = { package = "sr-io", path = "../../core/sr-io", default-features = false }
|
||||
primitives = { package = "sr-primitives", path = "../../core/sr-primitives", default-features = false }
|
||||
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
|
||||
srml-support = { path = "../support", default-features = false }
|
||||
system = { package = "srml-system", path = "../system", default-features = false }
|
||||
session = { package = "srml-session", path = "../session", default-features = false, features = ["historical"] }
|
||||
authorship = { package = "srml-authorship", path = "../authorship", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
substrate-primitives = { path = "../../core/primitives" }
|
||||
primitives = { package = "substrate-primitives", path = "../../core/primitives" }
|
||||
balances = { package = "srml-balances", path = "../balances" }
|
||||
timestamp = { package = "srml-timestamp", path = "../timestamp" }
|
||||
rand = "0.6.5"
|
||||
@@ -35,7 +35,7 @@ std = [
|
||||
"rstd/std",
|
||||
"runtime_io/std",
|
||||
"srml-support/std",
|
||||
"primitives/std",
|
||||
"sr-primitives/std",
|
||||
"session/std",
|
||||
"system/std",
|
||||
"authorship/std",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! http://research.web3.foundation/en/latest/polkadot/Token%20Economics/#inflation-model
|
||||
|
||||
use primitives::{Perbill, traits::SimpleArithmetic};
|
||||
use sr_primitives::{Perbill, traits::SimpleArithmetic};
|
||||
|
||||
/// Linear function truncated to positive part `y = max(0, b [+ or -] a*x)` for PNPoS usage
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
|
||||
@@ -293,14 +293,14 @@ use srml_support::{
|
||||
}
|
||||
};
|
||||
use session::{historical::OnSessionEnding, SelectInitialValidators, SessionIndex};
|
||||
use primitives::Perbill;
|
||||
use primitives::weights::SimpleDispatchInfo;
|
||||
use primitives::traits::{
|
||||
use sr_primitives::Perbill;
|
||||
use sr_primitives::weights::SimpleDispatchInfo;
|
||||
use sr_primitives::traits::{
|
||||
Convert, Zero, One, StaticLookup, CheckedSub, CheckedShl, Saturating, Bounded,
|
||||
SaturatedConversion, SimpleArithmetic
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
use primitives::{Serialize, Deserialize};
|
||||
use sr_primitives::{Serialize, Deserialize};
|
||||
use system::{ensure_signed, ensure_root};
|
||||
|
||||
use phragmen::{elect, ACCURACY, ExtendedBalance, equalize};
|
||||
@@ -621,8 +621,8 @@ decl_storage! {
|
||||
config(stakers):
|
||||
Vec<(T::AccountId, T::AccountId, BalanceOf<T>, StakerStatus<T::AccountId>)>;
|
||||
build(|
|
||||
storage: &mut primitives::StorageOverlay,
|
||||
_: &mut primitives::ChildrenStorageOverlay,
|
||||
storage: &mut sr_primitives::StorageOverlay,
|
||||
_: &mut sr_primitives::ChildrenStorageOverlay,
|
||||
config: &GenesisConfig<T>
|
||||
| {
|
||||
with_storage(storage, || {
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
//! Test utilities
|
||||
|
||||
use std::{collections::HashSet, cell::RefCell};
|
||||
use primitives::Perbill;
|
||||
use primitives::traits::{IdentityLookup, Convert, OpaqueKeys, OnInitialize};
|
||||
use primitives::testing::{Header, UintAuthorityId};
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
use sr_primitives::Perbill;
|
||||
use sr_primitives::traits::{IdentityLookup, Convert, OpaqueKeys, OnInitialize};
|
||||
use sr_primitives::testing::{Header, UintAuthorityId};
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use runtime_io;
|
||||
use srml_support::{assert_ok, impl_outer_origin, parameter_types, EnumerableStorageMap};
|
||||
use srml_support::traits::{Currency, Get, FindAuthor};
|
||||
@@ -111,7 +111,7 @@ impl system::Trait for Test {
|
||||
type Index = u64;
|
||||
type BlockNumber = BlockNumber;
|
||||
type Hash = H256;
|
||||
type Hashing = ::primitives::traits::BlakeTwo256;
|
||||
type Hashing = ::sr_primitives::traits::BlakeTwo256;
|
||||
type AccountId = AccountId;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
//! Rust implementation of the Phragmén election algorithm.
|
||||
|
||||
use rstd::{prelude::*, collections::btree_map::BTreeMap};
|
||||
use primitives::{PerU128};
|
||||
use primitives::traits::{Zero, Convert, Saturating};
|
||||
use sr_primitives::{PerU128};
|
||||
use sr_primitives::traits::{Zero, Convert, Saturating};
|
||||
use crate::{BalanceOf, RawAssignment, ExpoMap, Trait, ValidatorPrefs, IndividualExposure};
|
||||
|
||||
type Fraction = PerU128;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use super::*;
|
||||
use runtime_io::with_externalities;
|
||||
use phragmen;
|
||||
use primitives::traits::OnInitialize;
|
||||
use sr_primitives::traits::OnInitialize;
|
||||
use srml_support::{assert_ok, assert_noop, assert_eq_uvec, EnumerableStorageMap};
|
||||
use mock::*;
|
||||
use srml_support::traits::{Currency, ReservableCurrency};
|
||||
|
||||
Reference in New Issue
Block a user