Commit 69937fda authored by Bastian Köcher's avatar Bastian Köcher Committed by asynchronous rob
Browse files

Update to latest substrate (#120)

parent 98203aab
Pipeline #29780 passed with stages
in 13 minutes and 56 seconds
This diff is collapsed.
...@@ -8,7 +8,7 @@ authors = ["Parity Technologies <admin@parity.io>"] ...@@ -8,7 +8,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
polkadot-primitives = { path = "../primitives" } polkadot-primitives = { path = "../primitives" }
parking_lot = "0.4" parking_lot = "0.4"
log = "0.3" log = "0.3"
parity-codec = "2.1" parity-codec = "3.0"
substrate-primitives = { git = "https://github.com/paritytech/substrate" } substrate-primitives = { git = "https://github.com/paritytech/substrate" }
kvdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" } kvdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" } kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common", rev="616b40150ded71f57f650067fcbc5c99d7c343e6" }
......
...@@ -7,7 +7,7 @@ description = "Collator node implementation" ...@@ -7,7 +7,7 @@ description = "Collator node implementation"
[dependencies] [dependencies]
futures = "0.1.17" futures = "0.1.17"
substrate-client = { git = "https://github.com/paritytech/substrate" } substrate-client = { git = "https://github.com/paritytech/substrate" }
parity-codec = "2.1" parity-codec = "3.0"
substrate-primitives = { git = "https://github.com/paritytech/substrate" } substrate-primitives = { git = "https://github.com/paritytech/substrate" }
polkadot-runtime = { path = "../runtime", version = "0.1" } polkadot-runtime = { path = "../runtime", version = "0.1" }
polkadot-primitives = { path = "../primitives", version = "0.1" } polkadot-primitives = { path = "../primitives", version = "0.1" }
......
...@@ -10,7 +10,7 @@ tokio = "0.1.7" ...@@ -10,7 +10,7 @@ tokio = "0.1.7"
error-chain = "0.12" error-chain = "0.12"
log = "0.3" log = "0.3"
exit-future = "0.1" exit-future = "0.1"
parity-codec = "2.1" parity-codec = "3.0"
polkadot-availability-store = { path = "../availability-store" } polkadot-availability-store = { path = "../availability-store" }
polkadot-parachain = { path = "../parachain" } polkadot-parachain = { path = "../parachain" }
polkadot-primitives = { path = "../primitives" } polkadot-primitives = { path = "../primitives" }
......
...@@ -83,7 +83,7 @@ use polkadot_primitives::parachain::{ ...@@ -83,7 +83,7 @@ use polkadot_primitives::parachain::{
AttestedCandidate, ParachainHost, Statement as PrimitiveStatement AttestedCandidate, ParachainHost, Statement as PrimitiveStatement
}; };
use primitives::{Ed25519AuthorityId as AuthorityId, ed25519}; use primitives::{Ed25519AuthorityId as AuthorityId, ed25519};
use runtime_primitives::traits::ProvideRuntimeApi; use runtime_primitives::{traits::ProvideRuntimeApi, ApplyError};
use tokio::runtime::TaskExecutor; use tokio::runtime::TaskExecutor;
use tokio::timer::{Delay, Interval}; use tokio::timer::{Delay, Interval};
use transaction_pool::txpool::{Pool, ChainApi as PoolChainApi}; use transaction_pool::txpool::{Pool, ChainApi as PoolChainApi};
...@@ -507,7 +507,7 @@ impl<C, TxApi> consensus::Proposer<Block> for Proposer<C, TxApi> where ...@@ -507,7 +507,7 @@ impl<C, TxApi> consensus::Proposer<Block> for Proposer<C, TxApi> where
type Error = Error; type Error = Error;
type Create = Either<CreateProposal<C, TxApi>, future::FutureResult<Block, Error>>; type Create = Either<CreateProposal<C, TxApi>, future::FutureResult<Block, Error>>;
fn propose(&self, inherent_data: InherentData) -> Self::Create { fn propose(&self, inherent_data: InherentData, max_duration: Duration) -> Self::Create {
const ATTEMPT_PROPOSE_EVERY: Duration = Duration::from_millis(100); const ATTEMPT_PROPOSE_EVERY: Duration = Duration::from_millis(100);
const SLOT_DURATION_DENOMINATOR: u64 = 3; // wait up to 1/3 of the slot for candidates. const SLOT_DURATION_DENOMINATOR: u64 = 3; // wait up to 1/3 of the slot for candidates.
...@@ -558,6 +558,8 @@ impl<C, TxApi> consensus::Proposer<Block> for Proposer<C, TxApi> where ...@@ -558,6 +558,8 @@ impl<C, TxApi> consensus::Proposer<Block> for Proposer<C, TxApi> where
believed_minimum_timestamp: believed_timestamp, believed_minimum_timestamp: believed_timestamp,
timing, timing,
inherent_data: Some(inherent_data), inherent_data: Some(inherent_data),
// leave some time for the proposal finalisation
deadline: Instant::now() + max_duration - max_duration / 3,
}) })
} }
} }
...@@ -626,6 +628,7 @@ pub struct CreateProposal<C: Send + Sync, TxApi: PoolChainApi> { ...@@ -626,6 +628,7 @@ pub struct CreateProposal<C: Send + Sync, TxApi: PoolChainApi> {
timing: ProposalTiming, timing: ProposalTiming,
believed_minimum_timestamp: u64, believed_minimum_timestamp: u64,
inherent_data: Option<InherentData>, inherent_data: Option<InherentData>,
deadline: Instant,
} }
impl<C, TxApi> CreateProposal<C, TxApi> where impl<C, TxApi> CreateProposal<C, TxApi> where
...@@ -637,8 +640,6 @@ impl<C, TxApi> CreateProposal<C, TxApi> where ...@@ -637,8 +640,6 @@ impl<C, TxApi> CreateProposal<C, TxApi> where
use client::block_builder::BlockBuilder; use client::block_builder::BlockBuilder;
use runtime_primitives::traits::{Hash as HashT, BlakeTwo256}; use runtime_primitives::traits::{Hash as HashT, BlakeTwo256};
const MAX_TRANSACTIONS: usize = 40;
let mut inherent_data = self.inherent_data.take().expect("CreateProposal is not polled after finishing; qed"); let mut inherent_data = self.inherent_data.take().expect("CreateProposal is not polled after finishing; qed");
inherent_data.put_data(polkadot_runtime::PARACHAIN_INHERENT_IDENTIFIER, &candidates).map_err(ErrorKind::InherentError)?; inherent_data.put_data(polkadot_runtime::PARACHAIN_INHERENT_IDENTIFIER, &candidates).map_err(ErrorKind::InherentError)?;
...@@ -653,18 +654,20 @@ impl<C, TxApi> CreateProposal<C, TxApi> where ...@@ -653,18 +654,20 @@ impl<C, TxApi> CreateProposal<C, TxApi> where
} }
let mut unqueue_invalid = Vec::new(); let mut unqueue_invalid = Vec::new();
let mut pending_size = 0;
let ready_iter = self.transaction_pool.ready(); for ready in self.transaction_pool.ready() {
for ready in ready_iter.take(MAX_TRANSACTIONS) { if Instant::now() > self.deadline {
let encoded_size = ready.data.encode().len(); debug!("Consensus deadline reached when pushing block transactions, proceeding with proposing.");
if pending_size + encoded_size >= MAX_TRANSACTIONS_SIZE { break;
break
} }
match block_builder.push(ready.data.clone()) { match block_builder.push(ready.data.clone()) {
Ok(()) => { Ok(()) => {
pending_size += encoded_size; debug!("[{:?}] Pushed to the block.", ready.hash);
}
Err(client::error::Error(client::error::ErrorKind::ApplyExtrinsicFailed(ApplyError::FullBlock), _)) => {
debug!("Block is full, proceed with proposing.");
break;
} }
Err(e) => { Err(e) => {
trace!(target: "transaction-pool", "Invalid transaction: {}", e); trace!(target: "transaction-pool", "Invalid transaction: {}", e);
......
...@@ -7,6 +7,6 @@ edition = "2018" ...@@ -7,6 +7,6 @@ edition = "2018"
[dependencies] [dependencies]
polkadot-primitives = { path = "../primitives" } polkadot-primitives = { path = "../primitives" }
reed-solomon-erasure = { git = "https://github.com/paritytech/reed-solomon-erasure" } reed-solomon-erasure = { git = "https://github.com/paritytech/reed-solomon-erasure" }
parity-codec = "2.1" parity-codec = "3.0"
substrate-primitives = { git = "https://github.com/paritytech/substrate" } substrate-primitives = { git = "https://github.com/paritytech/substrate" }
substrate-trie = { git = "https://github.com/paritytech/substrate" } substrate-trie = { git = "https://github.com/paritytech/substrate" }
...@@ -10,8 +10,8 @@ parking_lot = "0.4" ...@@ -10,8 +10,8 @@ parking_lot = "0.4"
polkadot-availability-store = { path = "../availability-store" } polkadot-availability-store = { path = "../availability-store" }
polkadot-consensus = { path = "../consensus" } polkadot-consensus = { path = "../consensus" }
polkadot-primitives = { path = "../primitives" } polkadot-primitives = { path = "../primitives" }
parity-codec = "2.1" parity-codec = "3.0"
parity-codec-derive = "2.1" parity-codec-derive = "3.0"
substrate-network = { git = "https://github.com/paritytech/substrate" } substrate-network = { git = "https://github.com/paritytech/substrate" }
substrate-primitives = { git = "https://github.com/paritytech/substrate" } substrate-primitives = { git = "https://github.com/paritytech/substrate" }
sr-primitives = { git = "https://github.com/paritytech/substrate" } sr-primitives = { git = "https://github.com/paritytech/substrate" }
......
...@@ -5,8 +5,8 @@ authors = ["Parity Technologies <admin@parity.io>"] ...@@ -5,8 +5,8 @@ authors = ["Parity Technologies <admin@parity.io>"]
description = "Types and utilities for creating and working with parachains" description = "Types and utilities for creating and working with parachains"
[dependencies] [dependencies]
parity-codec = { version = "2.1", default-features = false } parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "2.1", default-features = false } parity-codec-derive = { version = "3.0", default-features = false }
wasmi = { version = "0.4.3", optional = true } wasmi = { version = "0.4.3", optional = true }
error-chain = { version = "0.12", optional = true } error-chain = { version = "0.12", optional = true }
......
...@@ -6,8 +6,8 @@ authors = ["Parity Technologies <admin@parity.io>"] ...@@ -6,8 +6,8 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
serde = { version = "1.0", default-features = false } serde = { version = "1.0", default-features = false }
serde_derive = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true }
parity-codec = { version = "2.1", default-features = false } parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "2.1", default-features = false } parity-codec-derive = { version = "3.0", default-features = false }
substrate-primitives = { git = "https://github.com/paritytech/substrate", default-features = false } substrate-primitives = { git = "https://github.com/paritytech/substrate", default-features = false }
substrate-client = { git = "https://github.com/paritytech/substrate", default-features = false } substrate-client = { git = "https://github.com/paritytech/substrate", default-features = false }
sr-version = { git = "https://github.com/paritytech/substrate", default-features = false } sr-version = { git = "https://github.com/paritytech/substrate", default-features = false }
......
...@@ -11,8 +11,8 @@ serde = { version = "1.0", default-features = false } ...@@ -11,8 +11,8 @@ serde = { version = "1.0", default-features = false }
serde_derive = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true }
safe-mix = { version = "1.0", default-features = false} safe-mix = { version = "1.0", default-features = false}
polkadot-primitives = { path = "../primitives", default-features = false } polkadot-primitives = { path = "../primitives", default-features = false }
parity-codec = { version = "2.2", default-features = false } parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "2.2", default-features = false } parity-codec-derive = { version = "3.0", default-features = false }
substrate-serializer = { git = "https://github.com/paritytech/substrate", default-features = false } substrate-serializer = { git = "https://github.com/paritytech/substrate", default-features = false }
sr-std = { git = "https://github.com/paritytech/substrate", default-features = false } sr-std = { git = "https://github.com/paritytech/substrate", default-features = false }
sr-io = { git = "https://github.com/paritytech/substrate", default-features = false } sr-io = { git = "https://github.com/paritytech/substrate", default-features = false }
......
...@@ -105,7 +105,7 @@ pub use balances::Call as BalancesCall; ...@@ -105,7 +105,7 @@ pub use balances::Call as BalancesCall;
pub use parachains::{Call as ParachainsCall, INHERENT_IDENTIFIER as PARACHAIN_INHERENT_IDENTIFIER}; pub use parachains::{Call as ParachainsCall, INHERENT_IDENTIFIER as PARACHAIN_INHERENT_IDENTIFIER};
pub use sr_primitives::{Permill, Perbill}; pub use sr_primitives::{Permill, Perbill};
pub use timestamp::BlockPeriod; pub use timestamp::BlockPeriod;
pub use srml_support::{StorageValue, RuntimeMetadata}; pub use srml_support::StorageValue;
/// Runtime version. /// Runtime version.
pub const VERSION: RuntimeVersion = RuntimeVersion { pub const VERSION: RuntimeVersion = RuntimeVersion {
......
This diff is collapsed.
...@@ -73,6 +73,7 @@ fn run() -> cli::error::Result<()> { ...@@ -73,6 +73,7 @@ fn run() -> cli::error::Result<()> {
executable_name: "polkadot", executable_name: "polkadot",
author: "Parity Team <admin@parity.io>", author: "Parity Team <admin@parity.io>",
description: "Polkadot Relay-chain Client Node", description: "Polkadot Relay-chain Client Node",
support_url: "https://github.com/paritytech/polkadot/issues/new",
}; };
cli::run(::std::env::args(), Worker, version) cli::run(::std::env::args(), Worker, version)
} }
...@@ -4,7 +4,7 @@ version = "0.1.0" ...@@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
parity-codec = "2.1" parity-codec = "3.0"
parity-codec-derive = "2.1" parity-codec-derive = "3.0"
substrate-primitives = { git = "https://github.com/paritytech/substrate" } substrate-primitives = { git = "https://github.com/paritytech/substrate" }
polkadot-primitives = { path = "../primitives" } polkadot-primitives = { path = "../primitives" }
...@@ -6,6 +6,6 @@ description = "Test parachain which adds to a number as its state transition" ...@@ -6,6 +6,6 @@ description = "Test parachain which adds to a number as its state transition"
[dependencies] [dependencies]
polkadot-parachain = { path = "../../parachain/", default-features = false } polkadot-parachain = { path = "../../parachain/", default-features = false }
parity-codec = { version = "2.1", default-features = false } parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "2.1", default-features = false } parity-codec-derive = { version = "3.0", default-features = false }
tiny-keccak = "1.4" tiny-keccak = "1.4"
...@@ -137,6 +137,7 @@ fn main() { ...@@ -137,6 +137,7 @@ fn main() {
executable_name: "adder-collator", executable_name: "adder-collator",
description: "collator for adder parachain", description: "collator for adder parachain",
author: "parity technologies", author: "parity technologies",
support_url: "https://github.com/paritytech/polkadot/issues/new",
} }
); );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment