mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 13:21:01 +00:00
Update for Substrate master (#600)
* update substrate for change to palette * change paint to palette * update lock * Fix missing import * change to polkadot-master * Use same commit hash of parity-common * Resolve linking errors * Rename to frame * bump spec * Subsume #602 and #596 * Fix DispatchInfo * Merge `futures03` and `joe-update-to-palette` (#606) * Change repo and branch * Made changes * Bumped async-std version * Fix line width * Bump spec_version * Fix `run_to_block` for Crowdfund module (#603) Probably a copy paste error. * Bump dependencies * Update trie-db to be inline with substrate * Fix documentation warning * Fix test compilation
This commit is contained in:
committed by
Gavin Wood
parent
e229074f79
commit
c9b1e3d959
@@ -5,9 +5,10 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
futures = "0.1.29"
|
||||
futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] }
|
||||
futures-timer = "0.4.0"
|
||||
futures = "0.1.17"
|
||||
futures03 = { package = "futures", version = "0.3.1", features = ["compat"] }
|
||||
futures-timer = "2.0"
|
||||
async-std = { version = "1.0.1", features = ["unstable"] }
|
||||
parking_lot = "0.9.0"
|
||||
tokio = "0.1.22"
|
||||
derive_more = "0.14.1"
|
||||
@@ -26,11 +27,12 @@ primitives = { package = "substrate-primitives", git = "https://github.com/parit
|
||||
transaction_pool = { package = "substrate-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
client = { package = "substrate-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
sr-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
block-builder = { package = "substrate-block-builder", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
trie = { package = "substrate-trie", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
runtime_primitives = { package = "sr-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
bitvec = { version = "0.15.2", default-features = false, features = ["alloc"] }
|
||||
runtime_babe = { package = "paint-babe", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
runtime_babe = { package = "pallet-babe", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
babe-primitives = { package = "substrate-consensus-babe-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
keystore = { package = "substrate-keystore", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
|
||||
|
||||
|
||||
@@ -29,7 +29,13 @@
|
||||
//!
|
||||
//! Groups themselves may be compromised by malicious authorities.
|
||||
|
||||
use std::{collections::{HashMap, HashSet}, pin::Pin, sync::Arc, time::{self, Duration, Instant}};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
pin::Pin,
|
||||
sync::Arc,
|
||||
time::{self, Duration, Instant},
|
||||
task::{Poll, Context}
|
||||
};
|
||||
|
||||
use babe_primitives::BabeApi;
|
||||
use client::{BlockchainEvents, BlockBody};
|
||||
@@ -48,16 +54,17 @@ use polkadot_primitives::parachain::{
|
||||
};
|
||||
use primitives::Pair;
|
||||
use runtime_primitives::traits::{ProvideRuntimeApi, DigestFor};
|
||||
use futures_timer::{Delay, Interval};
|
||||
use futures_timer::Delay;
|
||||
use async_std::stream::{interval, Interval};
|
||||
use transaction_pool::txpool::{Pool, ChainApi as PoolChainApi};
|
||||
|
||||
use attestation_service::ServiceHandle;
|
||||
use futures::prelude::*;
|
||||
use futures03::{future::{self, Either, FutureExt}, task::Context, stream::StreamExt};
|
||||
use futures03::{future::{self, Either}, FutureExt, StreamExt};
|
||||
use collation::CollationFetch;
|
||||
use dynamic_inclusion::DynamicInclusion;
|
||||
use inherents::InherentData;
|
||||
use runtime_babe::timestamp::TimestampInherentData;
|
||||
use sp_timestamp::TimestampInherentData;
|
||||
use log::{info, debug, warn, trace, error};
|
||||
use keystore::KeyStorePtr;
|
||||
use sr_api::ApiExt;
|
||||
@@ -594,7 +601,7 @@ impl<C, TxApi> consensus::Proposer<Block> for Proposer<C, TxApi> where
|
||||
|
||||
let timing = ProposalTiming {
|
||||
minimum: delay_future,
|
||||
attempt_propose: Interval::new(ATTEMPT_PROPOSE_EVERY),
|
||||
attempt_propose: interval(ATTEMPT_PROPOSE_EVERY),
|
||||
enough_candidates: Delay::new(enough_candidates),
|
||||
dynamic_inclusion,
|
||||
last_included: initial_included,
|
||||
@@ -642,26 +649,26 @@ struct ProposalTiming {
|
||||
impl ProposalTiming {
|
||||
// whether it's time to attempt a proposal.
|
||||
// shouldn't be called outside of the context of a task.
|
||||
fn poll(&mut self, cx: &mut Context, included: usize) -> futures03::Poll<Result<(), Error>> {
|
||||
fn poll(&mut self, cx: &mut Context, included: usize) -> Poll<()> {
|
||||
// first drain from the interval so when the minimum delay is up
|
||||
// we don't have any notifications built up.
|
||||
//
|
||||
// this interval is just meant to produce periodic task wakeups
|
||||
// that lead to the `dynamic_inclusion` getting updated as necessary.
|
||||
while let futures03::Poll::Ready(x) = self.attempt_propose.poll_next_unpin(cx) {
|
||||
while let Poll::Ready(x) = self.attempt_propose.poll_next_unpin(cx) {
|
||||
x.expect("timer still alive; intervals never end; qed");
|
||||
}
|
||||
|
||||
// wait until the minimum time has passed.
|
||||
if let Some(mut minimum) = self.minimum.take() {
|
||||
if let futures03::Poll::Pending = minimum.poll_unpin(cx) {
|
||||
if let Poll::Pending = minimum.poll_unpin(cx) {
|
||||
self.minimum = Some(minimum);
|
||||
return futures03::Poll::Pending;
|
||||
return Poll::Pending;
|
||||
}
|
||||
}
|
||||
|
||||
if included == self.last_included {
|
||||
return self.enough_candidates.poll_unpin(cx).map_err(Error::Timer);
|
||||
return self.enough_candidates.poll_unpin(cx);
|
||||
}
|
||||
|
||||
// the amount of includable candidates has changed. schedule a wakeup
|
||||
@@ -669,10 +676,10 @@ impl ProposalTiming {
|
||||
match self.dynamic_inclusion.acceptable_in(Instant::now(), included) {
|
||||
Some(instant) => {
|
||||
self.last_included = included;
|
||||
self.enough_candidates.reset(instant);
|
||||
self.enough_candidates.poll_unpin(cx).map_err(Error::Timer)
|
||||
self.enough_candidates.reset(Instant::now() + instant);
|
||||
self.enough_candidates.poll_unpin(cx)
|
||||
}
|
||||
None => futures03::Poll::Ready(Ok(())),
|
||||
None => Poll::Ready(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -791,16 +798,16 @@ impl<C, TxApi> futures03::Future for CreateProposal<C, TxApi> where
|
||||
{
|
||||
type Output = Result<Block, Error>;
|
||||
|
||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> futures03::Poll<Self::Output> {
|
||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
|
||||
// 1. try to propose if we have enough includable candidates and other
|
||||
// delays have concluded.
|
||||
let included = self.table.includable_count();
|
||||
futures03::ready!(self.timing.poll(cx, included))?;
|
||||
futures03::ready!(self.timing.poll(cx, included));
|
||||
|
||||
// 2. propose
|
||||
let proposed_candidates = self.table.proposed_set();
|
||||
|
||||
futures03::Poll::Ready(self.propose_with(proposed_candidates))
|
||||
Poll::Ready(self.propose_with(proposed_candidates))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user