Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
712 changes: 397 additions & 315 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ path = "src/main.rs"

[package]
name = "polkadot"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion availability-store/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "polkadot-availability-store"
description = "Persistent database for parachain data"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-cli"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
edition = "2018"
Expand Down
6 changes: 3 additions & 3 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ pub fn run<W>(worker: W, version: cli::VersionInfo) -> error::Result<()> where
}.map_err(|e| format!("{:?}", e))
}),
cli::ParseAndPrepare::BuildSpec(cmd) => cmd.run(load_spec),
cli::ParseAndPrepare::ExportBlocks(cmd) => cmd.run_with_builder::<(), _, _, _, _, _>(|config|
cli::ParseAndPrepare::ExportBlocks(cmd) => cmd.run_with_builder::<(), _, _, _, _, _, _>(|config|
Ok(service::new_chain_ops(config)?), load_spec, worker),
cli::ParseAndPrepare::ImportBlocks(cmd) => cmd.run_with_builder::<(), _, _, _, _, _>(|config|
cli::ParseAndPrepare::ImportBlocks(cmd) => cmd.run_with_builder::<(), _, _, _, _, _, _>(|config|
Ok(service::new_chain_ops(config)?), load_spec, worker),
cli::ParseAndPrepare::PurgeChain(cmd) => cmd.run(load_spec),
cli::ParseAndPrepare::RevertChain(cmd) => cmd.run_with_builder::<(), _, _, _, _>(|config|
cli::ParseAndPrepare::RevertChain(cmd) => cmd.run_with_builder::<(), _, _, _, _, _>(|config|
Ok(service::new_chain_ops(config)?), load_spec),
cli::ParseAndPrepare::CustomCommand(PolkadotSubCommands::ValidationWorker(args)) => {
service::run_validation_worker(&args.mem_id)?;
Expand Down
4 changes: 2 additions & 2 deletions collator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "polkadot-collator"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Collator node implementation"
edition = "2018"

[dependencies]
futures = "0.1.17"
futures03 = { package = "futures-preview", version = "0.3.0-alpha.18", features = ["compat"] }
futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] }
client = { package = "substrate-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
substrate-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
Expand Down
2 changes: 1 addition & 1 deletion erasure-coding/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-erasure-coding"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion executor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-executor"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot node implementation in Rust."
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion network/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-network"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Polkadot-specific networking protocol"
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion parachain/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-parachain"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Types and utilities for creating and working with parachains"
edition = "2018"
Expand Down
19 changes: 2 additions & 17 deletions parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub mod wasm_api;

use rstd::vec::Vec;

use codec::{Encode, Decode};
use codec::{Encode, Decode, CompactAs};

/// Validation parameters for evaluating the parachain validity function.
// TODO: balance downloads (https://github.com/paritytech/polkadot/issues/220)
Expand All @@ -78,25 +78,10 @@ pub struct ValidationResult {
}

/// Unique identifier of a parachain.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Default, Clone, Copy, Encode, Decode)]
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Default, Clone, Copy, CompactAs, Encode, Decode)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize, Debug))]
pub struct Id(u32);

impl codec::CompactAs for Id {
type As = u32;
fn encode_as(&self) -> &u32 {
&self.0
}
fn decode_from(x: u32) -> Self {
Self(x)
}
}
impl From<codec::Compact<Id>> for Id {
fn from(x: codec::Compact<Id>) -> Id {
x.0
}
}

impl From<Id> for u32 {
fn from(x: Id) -> Self { x.0 }
}
Expand Down
2 changes: 1 addition & 1 deletion primitives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-primitives"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-runtime"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ mod tests {
with_externalities(&mut new_test_ext(), || {
assert_eq!(Claims::total(), 100);
assert_eq!(Claims::claims(&alice_eth()), Some(100));
assert_eq!(Claims::claims(&Default::default()), None);
assert_eq!(Claims::claims(&EthereumAddress::default()), None);
});
}

Expand Down
5 changes: 4 additions & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kusama"),
impl_name: create_runtime_str!("parity-kusama"),
authoring_version: 1,
spec_version: 1003,
spec_version: 1004,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
};
Expand Down Expand Up @@ -174,6 +174,9 @@ parameter_types! {
impl babe::Trait for Runtime {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;

// session module is the trigger
type EpochChangeTrigger = babe::ExternalTrigger;
}

impl indices::Trait for Runtime {
Expand Down
28 changes: 17 additions & 11 deletions runtime/src/parachains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ use sr_primitives::traits::{
Hash as HashT, BlakeTwo256, Member, CheckedConversion, Saturating, One, Zero, Dispatchable,
};
use sr_primitives::weights::SimpleDispatchInfo;
use primitives::{Hash, Balance, parachain::{
self, Id as ParaId, Chain, DutyRoster, AttestedCandidate, Statement, AccountIdConversion,
ParachainDispatchOrigin, UpwardMessage, BlockIngressRoots, ValidatorId
}};
use primitives::{
Hash, Balance,
parachain::{
self, Id as ParaId, Chain, DutyRoster, AttestedCandidate, Statement, AccountIdConversion,
ParachainDispatchOrigin, UpwardMessage, BlockIngressRoots, ValidatorId
}
};
use {system, session};
use srml_support::{
Parameter, dispatch::Result, traits::{Currency, Get, WithdrawReason, ExistenceRequirement},
Expand Down Expand Up @@ -265,7 +268,7 @@ fn build<T: Trait>(config: &GenesisConfig<T>) {
// no ingress -- a chain cannot be routed to until it is live.
Code::insert(&id, &code);
Heads::insert(&id, &genesis);
<Watermarks<T>>::insert(&id, &sr_primitives::traits::Zero::zero());
<Watermarks<T>>::insert(&id, T::BlockNumber::zero());
}
}

Expand Down Expand Up @@ -981,6 +984,9 @@ mod tests {
impl babe::Trait for Test {
type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime;

// session module is the trigger
type EpochChangeTrigger = babe::ExternalTrigger;
}

parameter_types! {
Expand Down Expand Up @@ -1487,8 +1493,8 @@ mod tests {

with_externalities(&mut new_test_ext(parachains), || {
assert_eq!(Parachains::active_parachains(), vec![5u32.into(), 100u32.into()]);
assert_eq!(Parachains::parachain_code(&5u32.into()), Some(vec![1,2,3]));
assert_eq!(Parachains::parachain_code(&100u32.into()), Some(vec![4,5,6]));
assert_eq!(Parachains::parachain_code(ParaId::from(5u32)), Some(vec![1,2,3]));
assert_eq!(Parachains::parachain_code(ParaId::from(100u32)), Some(vec![4,5,6]));
});
}

Expand All @@ -1502,18 +1508,18 @@ mod tests {
with_externalities(&mut new_test_ext(parachains), || {
assert_eq!(Parachains::active_parachains(), vec![5u32.into(), 100u32.into()]);

assert_eq!(Parachains::parachain_code(&5u32.into()), Some(vec![1,2,3]));
assert_eq!(Parachains::parachain_code(&100u32.into()), Some(vec![4,5,6]));
assert_eq!(Parachains::parachain_code(ParaId::from(5u32)), Some(vec![1,2,3]));
assert_eq!(Parachains::parachain_code(ParaId::from(100u32)), Some(vec![4,5,6]));

assert_ok!(Parachains::register_parachain(Origin::ROOT, 99u32.into(), vec![7,8,9], vec![1, 1, 1]));

assert_eq!(Parachains::active_parachains(), vec![5u32.into(), 99u32.into(), 100u32.into()]);
assert_eq!(Parachains::parachain_code(&99u32.into()), Some(vec![7,8,9]));
assert_eq!(Parachains::parachain_code(ParaId::from(99u32)), Some(vec![7,8,9]));

assert_ok!(Parachains::deregister_parachain(Origin::ROOT, 5u32.into()));

assert_eq!(Parachains::active_parachains(), vec![99u32.into(), 100u32.into()]);
assert_eq!(Parachains::parachain_code(&5u32.into()), None);
assert_eq!(Parachains::parachain_code(ParaId::from(5u32)), None);
});
}

Expand Down
34 changes: 17 additions & 17 deletions runtime/src/slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use sr_primitives::traits::{CheckedSub, StaticLookup, Zero, One, CheckedConversi
use sr_primitives::weights::SimpleDispatchInfo;
use codec::{Encode, Decode};
use srml_support::{
decl_module, decl_storage, decl_event, StorageMap, ensure,
decl_module, decl_storage, decl_event, ensure,
traits::{Currency, ReservableCurrency, WithdrawReason, ExistenceRequirement, Get},
};
use primitives::parachain::AccountIdConversion;
Expand Down Expand Up @@ -1033,7 +1033,7 @@ mod tests {

run_to_block(9);
assert_eq!(Slots::onboard_queue(1), vec![0.into()]);
assert_eq!(Slots::onboarding(&0.into()),
assert_eq!(Slots::onboarding(ParaId::from(0)),
Some((1, IncomingParachain::Unset(NewBidder { who: 1, sub: 0 })))
);
assert_eq!(Slots::deposit_held(&0.into()), 1);
Expand All @@ -1052,7 +1052,7 @@ mod tests {

run_to_block(9);
assert_eq!(Slots::deposit_held(&0.into()), 1);
assert_eq!(Slots::deposits(&0.into())[0], 0);
assert_eq!(Slots::deposits(ParaId::from(0))[0], 0);

run_to_block(50);
assert_eq!(Slots::deposit_held(&0.into()), 0);
Expand All @@ -1069,7 +1069,7 @@ mod tests {

run_to_block(9);
assert_eq!(Slots::deposit_held(&0.into()), 1);
assert_eq!(Slots::deposits(&0.into())[0], 0);
assert_eq!(Slots::deposits(ParaId::from(0))[0], 0);

run_to_block(49);
assert_eq!(Slots::deposit_held(&0.into()), 1);
Expand Down Expand Up @@ -1152,17 +1152,17 @@ mod tests {
run_to_block(9);
assert_eq!(Slots::onboard_queue(1), vec![0.into()]);
assert_eq!(
Slots::onboarding(&0.into()),
Slots::onboarding(ParaId::from(0)),
Some((1, IncomingParachain::Unset(NewBidder { who: 1, sub: 0 })))
);
assert_eq!(Slots::onboard_queue(2), vec![1.into()]);
assert_eq!(
Slots::onboarding(&1.into()),
Slots::onboarding(ParaId::from(1)),
Some((2, IncomingParachain::Unset(NewBidder { who: 2, sub: 0 })))
);
assert_eq!(Slots::onboard_queue(4), vec![2.into()]);
assert_eq!(
Slots::onboarding(&2.into()),
Slots::onboarding(ParaId::from(2)),
Some((4, IncomingParachain::Unset(NewBidder { who: 3, sub: 0 })))
);
});
Expand Down Expand Up @@ -1200,26 +1200,26 @@ mod tests {
run_to_block(9);
assert_eq!(Slots::onboard_queue(1), vec![0.into(), 3.into()]);
assert_eq!(
Slots::onboarding(&0.into()),
Slots::onboarding(ParaId::from(0)),
Some((1, IncomingParachain::Unset(NewBidder { who: 1, sub: 0 })))
);
assert_eq!(
Slots::onboarding(&3.into()),
Slots::onboarding(ParaId::from(3)),
Some((1, IncomingParachain::Unset(NewBidder { who: 4, sub: 1 })))
);
assert_eq!(Slots::onboard_queue(2), vec![1.into()]);
assert_eq!(
Slots::onboarding(&1.into()),
Slots::onboarding(ParaId::from(1)),
Some((2, IncomingParachain::Unset(NewBidder { who: 2, sub: 0 })))
);
assert_eq!(Slots::onboard_queue(3), vec![4.into()]);
assert_eq!(
Slots::onboarding(&4.into()),
Slots::onboarding(ParaId::from(4)),
Some((3, IncomingParachain::Unset(NewBidder { who: 5, sub: 1 })))
);
assert_eq!(Slots::onboard_queue(4), vec![2.into()]);
assert_eq!(
Slots::onboarding(&2.into()),
Slots::onboarding(ParaId::from(2)),
Some((4, IncomingParachain::Unset(NewBidder { who: 3, sub: 0 })))
);

Expand Down Expand Up @@ -1324,13 +1324,13 @@ mod tests {
assert_ok!(Slots::bid_renew(Origin::signed(ParaId::from(0).into_account()), 2, 2, 2, 3));

run_to_block(20);
assert_eq!(Balances::free_balance(&ParaId::from(0).into_account()), 2);
assert_eq!(Balances::free_balance::<u64>(ParaId::from(0).into_account()), 2);

assert_ok!(Slots::new_auction(Origin::ROOT, 5, 2));
assert_ok!(Slots::bid_renew(Origin::signed(ParaId::from(0).into_account()), 3, 3, 3, 4));

run_to_block(30);
assert_eq!(Balances::free_balance(&ParaId::from(0).into_account()), 1);
assert_eq!(Balances::free_balance::<u64>(ParaId::from(0).into_account()), 1);
});
}

Expand All @@ -1348,7 +1348,7 @@ mod tests {
assert_eq!(Slots::onboard_queue(3), vec![]);
assert_eq!(Slots::onboard_queue(4), vec![0.into()]);
assert_eq!(Slots::onboarding(
&0.into()),
ParaId::from(0)),
Some((4, IncomingParachain::Unset(NewBidder { who: 1, sub: 0 })))
);
assert_eq!(Slots::deposit_held(&0.into()), 5);
Expand All @@ -1374,7 +1374,7 @@ mod tests {
run_to_block(9);
assert_eq!(Slots::onboard_queue(1), vec![0.into()]);
assert_eq!(
Slots::onboarding(&0.into()),
Slots::onboarding(ParaId::from(0)),
Some((1, IncomingParachain::Unset(NewBidder { who: 5, sub: 0 })))
);
assert_eq!(Slots::deposit_held(&0.into()), 5);
Expand Down Expand Up @@ -1402,7 +1402,7 @@ mod tests {
run_to_block(9);
assert_eq!(Slots::onboard_queue(1), vec![0.into()]);
assert_eq!(Slots::onboarding(
&0.into()),
ParaId::from(0)),
Some((1, IncomingParachain::Unset(NewBidder { who: 3, sub: 0 })))
);
assert_eq!(Slots::deposit_held(&0.into()), 3);
Expand Down
2 changes: 1 addition & 1 deletion service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polkadot-service"
version = "0.6.0"
version = "0.6.1"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

Expand Down
Loading