Unverified Commit 6a2092d6 authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

Bump Substrate (#816)



* Amalgamate pieces of balance module

* Fixes for vesting split

* Refactoring for vesting/balances split

* Build fixes

* Remove on_free_balance_zero and some docs.

* Indentation.

* Revert branch

* Fix.

* Update substrate: fixes after CLI refactoring

* Reverting removal of exit

* Removed too much again

* Update Cargo.lock

* Cargo.lock

* Update Substrate, ready for #4820

* Fixes

* Update to latest substrate master

* Fix network tests

* Update lock

* Fix tests

* Update futures to get bug fixes

* Fix tests for new balances/vesting logic

* Cargo fix

* Another fix
Co-authored-by: default avatarCecile Tonglet <cecile.tonglet@cecton.com>
Co-authored-by: asynchronous rob's avatarRobert Habermeier <rphmeier@gmail.com>
Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
parent 4dcdf5f2
This diff is collapsed.
......@@ -11,8 +11,7 @@ edition = "2018"
[dependencies]
cli = { package = "polkadot-cli", path = "cli" }
futures = "0.3.1"
ctrlc = { version = "3.1.3", features = ["termination"] }
futures = "0.3.4"
service = { package = "polkadot-service", path = "service" }
[build-dependencies]
......
......@@ -11,7 +11,7 @@ polkadot-erasure-coding = { path = "../erasure-coding" }
parking_lot = "0.9.0"
derive_more = "0.99"
log = "0.4.8"
futures = "0.3.1"
futures = "0.3.4"
tokio = { version = "0.2.10", features = ["rt-core"] }
exit-future = "0.2.0"
codec = { package = "parity-scale-codec", version = "1.1.0", features = ["derive"] }
......
......@@ -10,7 +10,7 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
log = "0.4.8"
futures = { version = "0.3.1", features = ["compat"] }
futures = { version = "0.3.4", features = ["compat"] }
structopt = "0.3.8"
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master", optional = true }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......
......@@ -32,7 +32,8 @@ pub fn run(version: VersionInfo) -> error::Result<()> {
match opt.subcommand {
None => {
sc_cli::init(&mut config, load_spec, &opt.run.shared_params, &version)?;
sc_cli::init(&opt.run.shared_params, &version)?;
sc_cli::init_config(&mut config, &opt.run.shared_params, &version, load_spec)?;
let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama());
......@@ -72,7 +73,8 @@ pub fn run(version: VersionInfo) -> error::Result<()> {
}
},
Some(Subcommand::Base(cmd)) => {
sc_cli::init(&mut config, load_spec, cmd.get_shared_params(), &version)?;
sc_cli::init(cmd.get_shared_params(), &version)?;
sc_cli::init_config(&mut config, &opt.run.shared_params, &version, load_spec)?;
let is_kusama = config.chain_spec.as_ref().map_or(false, |s| s.is_kusama());
......
......@@ -6,7 +6,7 @@ description = "Collator node implementation"
edition = "2018"
[dependencies]
futures = "0.3.1"
futures = "0.3.4"
sc-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......
......@@ -90,9 +90,8 @@ pub trait Network: Send + Sync {
fn checked_statements(&self, relay_parent: Hash) -> Box<dyn Stream<Item=SignedStatement>>;
}
impl<P, E, SP> Network for ValidationNetwork<P, E, SP> where
impl<P, SP> Network for ValidationNetwork<P, SP> where
P: 'static + Send + Sync,
E: 'static + Send + Sync,
SP: 'static + Spawn + Clone + Send + Sync,
{
fn collator_id_to_peer_id(&self, collator_id: CollatorId) ->
......@@ -239,16 +238,15 @@ pub async fn collate<R, P>(
}
/// Polkadot-api context.
struct ApiContext<P, E, SP> {
network: Arc<ValidationNetwork<P, E, SP>>,
struct ApiContext<P, SP> {
network: Arc<ValidationNetwork<P, SP>>,
parent_hash: Hash,
validators: Vec<ValidatorId>,
}
impl<P: 'static, E: 'static, SP: 'static> RelayChainContext for ApiContext<P, E, SP> where
impl<P: 'static, SP: 'static> RelayChainContext for ApiContext<P, SP> where
P: ProvideRuntimeApi<Block> + Send + Sync,
P::Api: ParachainHost<Block>,
E: futures::Future<Output=()> + Clone + Send + Sync + 'static,
SP: Spawn + Clone + Send + Sync
{
type Error = String;
......@@ -276,13 +274,12 @@ impl<P: 'static, E: 'static, SP: 'static> RelayChainContext for ApiContext<P, E,
}
/// Run the collator node using the given `service`.
fn run_collator_node<S, E, P, Extrinsic>(
fn run_collator_node<S, P, Extrinsic>(
service: S,
exit: E,
para_id: ParaId,
key: Arc<CollatorPair>,
build_parachain_context: P,
) -> polkadot_cli::error::Result<()>
) -> Result<S, polkadot_service::Error>
where
S: AbstractService<Block = service::Block, NetworkSpecialization = service::PolkadotProtocol>,
sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi>: ProvideRuntimeApi<Block>,
......@@ -301,7 +298,6 @@ fn run_collator_node<S, E, P, Extrinsic>(
S::CallExecutor: service::CallExecutor<service::Block>,
// Rust bug: https://github.com/rust-lang/rust/issues/24159
S::SelectChain: service::SelectChain<service::Block>,
E: futures::Future<Output=()> + Clone + Unpin + Send + Sync + 'static,
P: BuildParachainContext,
P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
......@@ -315,7 +311,7 @@ fn run_collator_node<S, E, P, Extrinsic>(
let select_chain = if let Some(select_chain) = service.select_chain() {
select_chain
} else {
return Err(polkadot_cli::error::Error::Other("The node cannot work because it can't select chain.".into()))
return Err("The node cannot work because it can't select chain.".into())
};
let is_known = move |block_hash: &Hash| {
......@@ -345,7 +341,6 @@ fn run_collator_node<S, E, P, Extrinsic>(
let validation_network = Arc::new(ValidationNetwork::new(
message_validator,
exit.clone(),
client.clone(),
spawner.clone(),
));
......@@ -357,11 +352,10 @@ fn run_collator_node<S, E, P, Extrinsic>(
) {
Ok(ctx) => ctx,
Err(()) => {
return Err(polkadot_cli::error::Error::Other("Could not build the parachain context!".into()))
return Err("Could not build the parachain context!".into())
}
};
let inner_exit = exit.clone();
let work = async move {
let mut notification_stream = client.import_notification_stream();
......@@ -385,7 +379,6 @@ fn run_collator_node<S, E, P, Extrinsic>(
let key = key.clone();
let parachain_context = parachain_context.clone();
let validation_network = validation_network.clone();
let inner_exit_2 = inner_exit.clone();
let work = future::lazy(move |_| async move {
let api = client.runtime_api();
......@@ -425,8 +418,7 @@ fn run_collator_node<S, E, P, Extrinsic>(
outgoing,
);
let exit = inner_exit_2.clone();
tokio::spawn(future::select(res.boxed(), exit));
tokio::spawn(res.boxed());
});
}
future::ok(())
......@@ -444,10 +436,7 @@ fn run_collator_node<S, E, P, Extrinsic>(
}
});
let future = future::select(
silenced,
inner_exit.clone()
).map(drop);
let future = silenced.map(drop);
tokio::spawn(future);
}
......@@ -455,8 +444,7 @@ fn run_collator_node<S, E, P, Extrinsic>(
service.spawn_essential_task("collation", work);
// NOTE: this is not ideal as we should only provide the service
sc_cli::run_service_until_exit(Configuration::default(), |_config| Ok(service))
Ok(service)
}
fn compute_targets(para_id: ParaId, session_keys: &[ValidatorId], roster: DutyRoster) -> HashSet<ValidatorId> {
......@@ -472,53 +460,54 @@ fn compute_targets(para_id: ParaId, session_keys: &[ValidatorId], roster: DutyRo
/// Run a collator node with the given `RelayChainContext` and `ParachainContext`
/// build by the given `BuildParachainContext` and arguments to the underlying polkadot node.
///
/// Provide a future which resolves when the node should exit.
/// This function blocks until done.
pub fn run_collator<P, E>(
pub fn run_collator<P>(
build_parachain_context: P,
para_id: ParaId,
exit: E,
key: Arc<CollatorPair>,
config: Configuration,
) -> polkadot_cli::error::Result<()> where
P: BuildParachainContext,
P::ParachainContext: Send + 'static,
<P::ParachainContext as ParachainContext>::ProduceCandidate: Send,
E: futures::Future<Output = ()> + Unpin + Send + Clone + Sync + 'static,
{
match (config.expect_chain_spec().is_kusama(), config.roles) {
(true, Roles::LIGHT) =>
run_collator_node(
service::kusama_new_light(config, Some((key.public(), para_id)))?,
exit,
para_id,
key,
build_parachain_context,
),
sc_cli::run_service_until_exit(config, |config| {
run_collator_node(
service::kusama_new_light(config, Some((key.public(), para_id)))?,
para_id,
key,
build_parachain_context,
)
}),
(true, _) =>
run_collator_node(
service::kusama_new_full(config, Some((key.public(), para_id)), None, false, 6000)?,
exit,
para_id,
key,
build_parachain_context,
),
sc_cli::run_service_until_exit(config, |config| {
run_collator_node(
service::kusama_new_full(config, Some((key.public(), para_id)), None, false, 6000)?,
para_id,
key,
build_parachain_context,
)
}),
(false, Roles::LIGHT) =>
run_collator_node(
service::polkadot_new_light(config, Some((key.public(), para_id)))?,
exit,
para_id,
key,
build_parachain_context,
),
sc_cli::run_service_until_exit(config, |config| {
run_collator_node(
service::polkadot_new_light(config, Some((key.public(), para_id)))?,
para_id,
key,
build_parachain_context,
)
}),
(false, _) =>
run_collator_node(
service::polkadot_new_full(config, Some((key.public(), para_id)), None, false, 6000)?,
exit,
para_id,
key,
build_parachain_context,
),
sc_cli::run_service_until_exit(config, |config| {
run_collator_node(
service::polkadot_new_full(config, Some((key.public(), para_id)), None, false, 6000)?,
para_id,
key,
build_parachain_context,
)
}),
}
}
......
......@@ -17,7 +17,7 @@ sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkad
sc-network-gossip = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
futures = "0.3.1"
futures = "0.3.4"
log = "0.4.8"
exit-future = "0.2.0"
sc-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......
......@@ -35,7 +35,7 @@ use crate::gossip::{RegisteredMessageValidator, GossipMessage, GossipStatement,
use sp_api::ProvideRuntimeApi;
use futures::prelude::*;
use futures::{task::SpawnExt, future::{ready, select}};
use futures::{task::SpawnExt, future::ready};
use parking_lot::Mutex;
use log::{debug, trace};
......@@ -73,18 +73,18 @@ pub(crate) fn checked_statements<N: NetworkService>(network: &N, topic: Hash) ->
}
/// Table routing implementation.
pub struct Router<P, E, T> {
pub struct Router<P, T> {
table: Arc<SharedTable>,
attestation_topic: Hash,
fetcher: LeafWorkDataFetcher<P, E, T>,
fetcher: LeafWorkDataFetcher<P, T>,
deferred_statements: Arc<Mutex<DeferredStatements>>,
message_validator: RegisteredMessageValidator,
}
impl<P, E, T> Router<P, E, T> {
impl<P, T> Router<P, T> {
pub(crate) fn new(
table: Arc<SharedTable>,
fetcher: LeafWorkDataFetcher<P, E, T>,
fetcher: LeafWorkDataFetcher<P, T>,
message_validator: RegisteredMessageValidator,
) -> Self {
let parent_hash = fetcher.parent_hash();
......@@ -116,7 +116,7 @@ impl<P, E, T> Router<P, E, T> {
}
}
impl<P, E: Clone, T: Clone> Clone for Router<P, E, T> {
impl<P, T: Clone> Clone for Router<P, T> {
fn clone(&self) -> Self {
Router {
table: self.table.clone(),
......@@ -128,10 +128,9 @@ impl<P, E: Clone, T: Clone> Clone for Router<P, E, T> {
}
}
impl<P: ProvideRuntimeApi<Block> + Send + Sync + 'static, E, T> Router<P, E, T> where
impl<P: ProvideRuntimeApi<Block> + Send + Sync + 'static, T> Router<P, T> where
P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
T: Clone + Executor + Send + 'static,
E: Future<Output=()> + Clone + Send + Unpin + 'static,
{
/// Import a statement whose signature has been checked already.
pub(crate) fn import_statement(&self, statement: SignedStatement) {
......@@ -176,8 +175,7 @@ impl<P: ProvideRuntimeApi<Block> + Send + Sync + 'static, E, T> Router<P, E, T>
if let Some(work) = producer.map(|p| self.create_work(c_hash, p)) {
trace!(target: "validation", "driving statement work to completion");
let work = select(work.boxed(), self.fetcher.exit().clone())
.map(drop);
let work = work.boxed().map(drop);
let _ = self.fetcher.executor().spawn(work);
}
}
......@@ -226,10 +224,9 @@ impl<P: ProvideRuntimeApi<Block> + Send + Sync + 'static, E, T> Router<P, E, T>
}
}
impl<P: ProvideRuntimeApi<Block> + Send, E, T> TableRouter for Router<P, E, T> where
impl<P: ProvideRuntimeApi<Block> + Send, T> TableRouter for Router<P, T> where
P::Api: ParachainHost<Block>,
T: Clone + Executor + Send + 'static,
E: Future<Output=()> + Clone + Send + 'static,
{
type Error = io::Error;
type FetchValidationProof = Pin<Box<dyn Future<Output = Result<PoVBlock, io::Error>> + Send>>;
......@@ -283,7 +280,7 @@ impl<P: ProvideRuntimeApi<Block> + Send, E, T> TableRouter for Router<P, E, T> w
}
}
impl<P, E, T> Drop for Router<P, E, T> {
impl<P, T> Drop for Router<P, T> {
fn drop(&mut self) {
let parent_hash = self.parent_hash();
self.network().with_spec(move |spec, _| { spec.remove_validation_session(parent_hash); });
......
......@@ -319,11 +319,7 @@ impl ParachainHost<Block> for RuntimeApi {
}
}
type TestValidationNetwork<SP> = crate::validation::ValidationNetwork<
TestApi,
NeverExit,
SP,
>;
type TestValidationNetwork<SP> = crate::validation::ValidationNetwork<TestApi, SP>;
struct Built<SP> {
gossip: Pin<Box<dyn Future<Output = ()>>>,
......@@ -349,7 +345,6 @@ fn build_network<SP: Spawn + Clone>(n: usize, spawner: SP) -> Built<SP> {
TestValidationNetwork::new(
message_val,
NeverExit,
runtime_api.clone(),
spawner.clone(),
)
......
......@@ -62,40 +62,36 @@ pub struct LeafWorkParams {
}
/// Wrapper around the network service
pub struct ValidationNetwork<P, E, T> {
pub struct ValidationNetwork<P, T> {
api: Arc<P>,
executor: T,
network: RegisteredMessageValidator,
exit: E,
}
impl<P, E, T> ValidationNetwork<P, E, T> {
impl<P, T> ValidationNetwork<P, T> {
/// Create a new consensus networking object.
pub fn new(
network: RegisteredMessageValidator,
exit: E,
api: Arc<P>,
executor: T,
) -> Self {
ValidationNetwork { network, exit, api, executor }
ValidationNetwork { network, api, executor }
}
}
impl<P, E: Clone, T: Clone> Clone for ValidationNetwork<P, E, T> {
impl<P, T: Clone> Clone for ValidationNetwork<P, T> {
fn clone(&self) -> Self {
ValidationNetwork {
network: self.network.clone(),
exit: self.exit.clone(),
api: self.api.clone(),
executor: self.executor.clone(),
}
}
}
impl<P, E, T> ValidationNetwork<P, E, T> where
impl<P, T> ValidationNetwork<P, T> where
P: ProvideRuntimeApi<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block>,
E: Clone + Future<Output=()> + Send + Sync + 'static,
T: Clone + Executor + Send + Sync + 'static,
{
/// Instantiate block-DAG leaf work
......@@ -113,13 +109,12 @@ impl<P, E, T> ValidationNetwork<P, E, T> where
/// leaf-work instances safely, but they should all be coordinated on which session keys
/// are being used.
pub fn instantiate_leaf_work(&self, params: LeafWorkParams)
-> oneshot::Receiver<LeafWorkDataFetcher<P, E, T>>
-> oneshot::Receiver<LeafWorkDataFetcher<P, T>>
{
let parent_hash = params.parent_hash;
let network = self.network.clone();
let api = self.api.clone();
let task_executor = self.executor.clone();
let exit = self.exit.clone();
let authorities = params.authorities.clone();
let (tx, rx) = oneshot::channel();
......@@ -141,7 +136,6 @@ impl<P, E, T> ValidationNetwork<P, E, T> where
task_executor,
parent_hash,
knowledge: work.knowledge().clone(),
exit,
});
});
......@@ -149,7 +143,7 @@ impl<P, E, T> ValidationNetwork<P, E, T> where
}
}
impl<P, E, T> ValidationNetwork<P, E, T> {
impl<P, T> ValidationNetwork<P, T> {
/// Convert the given `CollatorId` to a `PeerId`.
pub fn collator_id_to_peer_id(&self, collator_id: CollatorId) ->
impl Future<Output=Option<PeerId>> + Send
......@@ -176,14 +170,13 @@ impl<P, E, T> ValidationNetwork<P, E, T> {
}
/// A long-lived network which can create parachain statement routing processes on demand.
impl<P, E, T> ParachainNetwork for ValidationNetwork<P, E, T> where
impl<P, T> ParachainNetwork for ValidationNetwork<P, T> where
P: ProvideRuntimeApi<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block, Error = sp_blockchain::Error>,
E: Clone + Future<Output=()> + Send + Sync + Unpin + 'static,
T: Clone + Executor + Send + Sync + 'static,
{
type Error = String;
type TableRouter = Router<P, E, T>;
type TableRouter = Router<P, T>;
type BuildTableRouter = Box<dyn Future<Output=Result<Self::TableRouter, String>> + Send + Unpin>;
fn communication_for(
......@@ -234,7 +227,7 @@ impl<P, E, T> ParachainNetwork for ValidationNetwork<P, E, T> where
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct NetworkDown;
impl<P, E: Clone, N: Clone> Collators for ValidationNetwork<P, E, N> where
impl<P, N: Clone> Collators for ValidationNetwork<P, N> where
P: ProvideRuntimeApi<Block> + Send + Sync + 'static,
P::Api: ParachainHost<Block>,
{
......@@ -518,16 +511,15 @@ impl LiveValidationLeaves {
}
/// Can fetch data for a given validation leaf-work instance.
pub struct LeafWorkDataFetcher<P, E, T> {
pub struct LeafWorkDataFetcher<P, T> {
network: RegisteredMessageValidator,
api: Arc<P>,
exit: E,
task_executor: T,
knowledge: Arc<Mutex<Knowledge>>,
parent_hash: Hash,
}
impl<P, E, T> LeafWorkDataFetcher<P, E, T> {
impl<P, T> LeafWorkDataFetcher<P, T> {
/// Get the parent hash.
pub(crate) fn parent_hash(&self) -> Hash {
self.parent_hash
......@@ -538,11 +530,6 @@ impl<P, E, T> LeafWorkDataFetcher<P, E, T> {
&self.knowledge
}
/// Get the exit future.
pub(crate) fn exit(&self) -> &E {
&self.exit
}
/// Get the network service.
pub(crate) fn network(&self) -> &RegisteredMessageValidator {
&self.network
......@@ -559,7 +546,7 @@ impl<P, E, T> LeafWorkDataFetcher<P, E, T> {
}
}
impl<P, E: Clone, T: Clone> Clone for LeafWorkDataFetcher<P, E, T> {
impl<P, T: Clone> Clone for LeafWorkDataFetcher<P, T> {
fn clone(&self) -> Self {
LeafWorkDataFetcher {
network: self.network.clone(),
......@@ -567,15 +554,13 @@ impl<P, E: Clone, T: Clone> Clone for LeafWorkDataFetcher<P, E, T> {
task_executor: self.task_executor.clone(),
parent_hash: self.parent_hash,
knowledge: self.knowledge.clone(),
exit: self.exit.clone(),
}
}
}
impl<P: ProvideRuntimeApi<Block> + Send, E, T> LeafWorkDataFetcher<P, E, T> where
impl<P: ProvideRuntimeApi<Block> + Send, T> LeafWorkDataFetcher<P, T> where
P::Api: ParachainHost<Block>,
T: Clone + Executor + Send + 'static,
E: Future<Output=()> + Clone + Send + 'static,
{
/// Fetch PoV block for the given candidate receipt.
pub fn fetch_pov_block(&self, candidate: &CandidateReceipt)
......
......@@ -27,6 +27,7 @@ frame-support = { git = "https://github.com/paritytech/substrate", branch = "pol
staking = { package = "pallet-staking", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
system = { package = "frame-system", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
timestamp = { package = "pallet-timestamp", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
vesting = { package = "pallet-vesting", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false }
polkadot-parachain = { path = "../../parachain", default-features = false }
......@@ -41,7 +42,7 @@ babe = { package = "pallet-babe", git = "https://github.com/paritytech/substrate
randomness-collective-flip = { package = "pallet-randomness-collective-flip", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
treasury = { package = "pallet-treasury", git = "https://github.com/paritytech/substrate", branch = "polkadot-master", default-features = false }
trie-db = "0.19.2"
trie-db = "0.20.0"
serde_json = "1.0.41"
[features]
......@@ -67,6 +68,7 @@ std = [
"staking/std",
"system/std",
"timestamp/std",
"vesting/std",
"serde_derive",
"serde/std",
"log",
......
......@@ -18,15 +18,14 @@
use rstd::prelude::*;
use sp_io::{hashing::keccak_256, crypto::secp256k1_ecdsa_recover};
use frame_support::{decl_event, decl_storage, decl_module, decl_error};
use frame_support::weights::SimpleDispatchInfo;
use frame_support::traits::{Currency, Get, VestingCurrency};
use frame_support::{decl_event, decl_storage, decl_module, decl_error, ensure};
use frame_support::{dispatch::DispatchResult, weights::SimpleDispatchInfo};
use frame_support::traits::{Currency, Get, VestingSchedule};
use system::{ensure_root, ensure_none};
use codec::{Encode, Decode};
#[cfg(feature = "std")]
use serde::{self, Serialize, Deserialize, Serializer, Deserializer};
#[cfg(feature = "std")]
use sp_runtime::traits::Zero;
use sp_runtime::traits::{Zero, CheckedSub};
use sp_runtime::{
RuntimeDebug, transaction_validity::{
TransactionLongevity, TransactionValidity, ValidTransaction, InvalidTransaction
......@@ -35,14 +34,14 @@ use sp_runtime::{
use primitives::ValidityError;
use system;
type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
type CurrencyOf<T> = <<T as Trait>::VestingSchedule as VestingSchedule<<T as system::Trait>::AccountId>>::Currency;
type BalanceOf<T> = <CurrencyOf<T> as Currency<<T as system::Trait>::AccountId>>::Balance;
/// Configuration trait.
pub trait Trait: system::Trait {
/// The overarching event type.
type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
type Currency: Currency<Self::AccountId>
+ VestingCurrency<Self::AccountId, Moment=Self::BlockNumber>;