Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Version bump, fixes #572

Merged
merged 7 commits into from
Aug 15, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 = "polkadot/src/main.rs"

[package]
name = "polkadot"
version = "0.2.4"
version = "0.2.5"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"

Expand Down
1 change: 1 addition & 0 deletions demo/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ pub fn run<I, T>(args: I) -> error::Result<()> where
bonding_duration: 90, // 90 days per bond.
early_era_slash: 10000,
session_reward: 100,
offline_slash_grace: 0,
}),
democracy: Some(DemocracyConfig {
launch_period: 120 * 24 * 14, // 2 weeks per public referendum
Expand Down
7 changes: 4 additions & 3 deletions demo/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ mod tests {
reclaim_rebate: 0,
early_era_slash: 0,
session_reward: 0,
offline_slash_grace: 0,
}),
democracy: Some(Default::default()),
council: Some(Default::default()),
Expand Down Expand Up @@ -247,7 +248,7 @@ mod tests {
construct_block(
1,
[69u8; 32].into(),
hex!("b97d52254fc967bb94bed485de6a738e9fad05decfda3453711677b8becf6d0a").into(),
hex!("42b56bd84bbaf239903480e071a8e7733e6b25c120d7f28bb5ec6a9ce96d565a").into(),
vec![BareExtrinsic {
signed: alice(),
index: 0,
Expand All @@ -260,7 +261,7 @@ mod tests {
construct_block(
2,
block1().1,
hex!("a1f018d2faa339f72f5ee29050b4670d971e2e271cc06c41ee9cbe1f4c6feec9").into(),
hex!("5b282cd7bbbac9acc2393d9618b87b70b875ea5ffdd5f6d60fe5c68fc435775f").into(),
vec![
BareExtrinsic {
signed: bob(),
Expand All @@ -280,7 +281,7 @@ mod tests {
construct_block(
1,
[69u8; 32].into(),
hex!("41d07010f49aa29b2c9aca542cbaa6f59aafd3dda53cdf711c51ddb7d386912e").into(),
hex!("a3d8f40101bd901c69367b46d6b1d682ad306f506242ed96b33850a7d1c5695a").into(),
vec![BareExtrinsic {
signed: alice(),
index: 0,
Expand Down
4 changes: 3 additions & 1 deletion polkadot/api/src/full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ impl<B: LocalBackend<Block>> PolkadotApi for Client<B, LocalCallExecutor<B, Nati
fn inherent_extrinsics(&self, at: &BlockId, inherent_data: InherentData) -> Result<Vec<UncheckedExtrinsic>> {
use codec::{Encode, Decode};

let runtime_version = self.runtime_version_at(at)?;

with_runtime!(self, at, || {
let extrinsics = ::runtime::inherent_extrinsics(inherent_data);
let extrinsics = ::runtime::inherent_extrinsics(inherent_data, runtime_version);
extrinsics.into_iter()
.map(|x| x.encode()) // get encoded representation
.map(|x| Decode::decode(&mut &x[..])) // get byte-vec equivalent to extrinsic
Expand Down
4 changes: 2 additions & 2 deletions polkadot/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub struct Concrete;
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: ver_str!("polkadot"),
impl_name: ver_str!("parity-polkadot"),
authoring_version: 2,
authoring_version: 1,
spec_version: 4,
impl_version: 0,
};
Expand Down Expand Up @@ -250,7 +250,7 @@ pub mod api {
apply_extrinsic => |extrinsic| super::Executive::apply_extrinsic(extrinsic),
execute_block => |block| super::Executive::execute_block(block),
finalise_block => |()| super::Executive::finalise_block(),
inherent_extrinsics => |inherent| super::inherent_extrinsics(inherent),
inherent_extrinsics => |(inherent, version)| super::inherent_extrinsics(inherent, version),
validator_count => |()| super::Session::validator_count(),
validators => |()| super::Session::validators()
);
Expand Down
5 changes: 3 additions & 2 deletions polkadot/runtime/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ use runtime_primitives::traits::{Checkable, AuxLookup};
use timestamp::Call as TimestampCall;
use parachains::Call as ParachainsCall;
use staking::Call as StakingCall;
use version::RuntimeVersion;

/// Produces the list of inherent extrinsics.
pub fn inherent_extrinsics(data: ::primitives::InherentData) -> Vec<UncheckedExtrinsic> {
pub fn inherent_extrinsics(data: ::primitives::InherentData, runtime_version: RuntimeVersion) -> Vec<UncheckedExtrinsic> {
let make_inherent = |function| UncheckedExtrinsic::new(
Extrinsic {
signed: Default::default(),
Expand All @@ -39,7 +40,7 @@ pub fn inherent_extrinsics(data: ::primitives::InherentData) -> Vec<UncheckedExt
make_inherent(Call::Parachains(ParachainsCall::set_heads(data.parachain_heads))),
];

if !data.offline_indices.is_empty() {
if !data.offline_indices.is_empty() && runtime_version.spec_version == 4 {
inherent.push(make_inherent(
Call::Staking(StakingCall::note_missed_proposal(data.offline_indices))
));
Expand Down
2 changes: 2 additions & 0 deletions polkadot/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
validator_count: 12,
sessions_per_era: 12, // 1 hour per era
bonding_duration: 24, // 1 day per bond.
offline_slash_grace: 0,
}),
democracy: Some(DemocracyConfig {
launch_period: 12 * 60 * 24, // 1 day per public referendum
Expand Down Expand Up @@ -139,6 +140,7 @@ fn testnet_genesis(initial_authorities: Vec<AuthorityId>) -> GenesisConfig {
bonding_duration: 2,
early_era_slash: 0,
session_reward: 0,
offline_slash_grace: 0,
}),
democracy: Some(DemocracyConfig {
launch_period: 9,
Expand Down
2 changes: 1 addition & 1 deletion substrate/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "substrate-cli"
version = "0.2.4"
version = "0.2.5"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Substrate CLI interface."
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion substrate/rpc-servers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub fn rpc_handler<Block: BlockT, S, C, A, Y>(
Block: 'static,
S: apis::state::StateApi<Block::Hash, Metadata=Metadata>,
C: apis::chain::ChainApi<Block::Hash, Block::Header, Block::Extrinsic, Metadata=Metadata>,
A: apis::author::AuthorApi<Block::Hash, Block::Extrinsic, PendingExtrinsics, Metadata=Metadata>,
A: apis::author::AuthorApi<Block::Hash, Block::Extrinsic, Metadata=Metadata>,
Y: apis::system::SystemApi,
{
let mut io = pubsub::PubSubHandler::default();
Expand Down
1 change: 1 addition & 0 deletions substrate/runtime/contract/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ fn new_test_ext(existential_deposit: u64, gas_price: u64) -> runtime_io::TestExt
reclaim_rebate: 0,
early_era_slash: 0,
session_reward: 0,
offline_slash_grace: 0,
}.build_storage()
.unwrap(),
);
Expand Down
1 change: 1 addition & 0 deletions substrate/runtime/council/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ mod tests {
reclaim_rebate: 0,
early_era_slash: 0,
session_reward: 0,
offline_slash_grace: 0,
}.build_storage().unwrap());
t.extend(democracy::GenesisConfig::<Test>{
launch_period: 1,
Expand Down
21 changes: 11 additions & 10 deletions substrate/runtime/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ mod tests {
reclaim_rebate: 0,
early_era_slash: 0,
session_reward: 0,
offline_slash_grace: 0,
}.build_storage().unwrap());
t.extend(GenesisConfig::<Test>{
launch_period: 1,
Expand Down Expand Up @@ -495,7 +496,7 @@ mod tests {
assert_eq!(Democracy::tally(r), (10, 0));

assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
Staking::on_session_change(0, Vec::new());
Staking::on_session_change(0, true);

assert_eq!(Staking::era_length(), 2);
});
Expand Down Expand Up @@ -573,19 +574,19 @@ mod tests {
System::set_block_number(1);
assert_ok!(Democracy::vote(&1, 0, true));
assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
Staking::on_session_change(0, Vec::new());
Staking::on_session_change(0, true);
assert_eq!(Staking::bonding_duration(), 4);

System::set_block_number(2);
assert_ok!(Democracy::vote(&1, 1, true));
assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
Staking::on_session_change(0, Vec::new());
Staking::on_session_change(0, true);
assert_eq!(Staking::bonding_duration(), 3);

System::set_block_number(3);
assert_ok!(Democracy::vote(&1, 2, true));
assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
Staking::on_session_change(0, Vec::new());
Staking::on_session_change(0, true);
assert_eq!(Staking::bonding_duration(), 2);
});
}
Expand All @@ -606,7 +607,7 @@ mod tests {
assert_eq!(Democracy::tally(r), (10, 0));

assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
Staking::on_session_change(0, Vec::new());
Staking::on_session_change(0, true);

assert_eq!(Staking::era_length(), 2);
});
Expand All @@ -621,7 +622,7 @@ mod tests {
assert_ok!(Democracy::cancel_referendum(r));

assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
Staking::on_session_change(0, Vec::new());
Staking::on_session_change(0, true);

assert_eq!(Staking::era_length(), 1);
});
Expand All @@ -639,7 +640,7 @@ mod tests {
assert_eq!(Democracy::tally(r), (0, 10));

assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
Staking::on_session_change(0, Vec::new());
Staking::on_session_change(0, true);

assert_eq!(Staking::era_length(), 1);
});
Expand All @@ -660,7 +661,7 @@ mod tests {
assert_eq!(Democracy::tally(r), (110, 100));

assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
Staking::on_session_change(0, Vec::new());
Staking::on_session_change(0, true);

assert_eq!(Staking::era_length(), 2);
});
Expand All @@ -677,7 +678,7 @@ mod tests {
assert_eq!(Democracy::tally(r), (60, 50));

assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
Staking::on_session_change(0, Vec::new());
Staking::on_session_change(0, true);

assert_eq!(Staking::era_length(), 1);
});
Expand All @@ -698,7 +699,7 @@ mod tests {
assert_eq!(Democracy::tally(r), (100, 50));

assert_eq!(Democracy::end_block(System::block_number()), Ok(()));
Staking::on_session_change(0, Vec::new());
Staking::on_session_change(0, true);

assert_eq!(Staking::era_length(), 2);
});
Expand Down
5 changes: 3 additions & 2 deletions substrate/runtime/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ mod tests {
reclaim_rebate: 0,
early_era_slash: 0,
session_reward: 0,
offline_slash_grace: 0,
}.build_storage().unwrap());
let xt = primitives::testing::TestXt((1, 0, Call::transfer(2.into(), 69)));
with_externalities(&mut t, || {
Expand All @@ -313,7 +314,7 @@ mod tests {
header: Header {
parent_hash: [69u8; 32].into(),
number: 1,
state_root: hex!("8fad93b6b9e5251a2e4913598fd0d74a138c0e486eb1133ff8081b429b0c56f2").into(),
state_root: hex!("06efddda99014ce420dc903e6c8b7f87a1c96e699fbb43d26dc5f3203ae94ee0").into(),
extrinsics_root: hex!("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").into(),
digest: Digest { logs: vec![], },
},
Expand Down Expand Up @@ -347,7 +348,7 @@ mod tests {
header: Header {
parent_hash: [69u8; 32].into(),
number: 1,
state_root: hex!("8fad93b6b9e5251a2e4913598fd0d74a138c0e486eb1133ff8081b429b0c56f2").into(),
state_root: hex!("06efddda99014ce420dc903e6c8b7f87a1c96e699fbb43d26dc5f3203ae94ee0").into(),
extrinsics_root: [0u8; 32].into(),
digest: Digest { logs: vec![], },
},
Expand Down