diff --git a/Cargo.lock b/Cargo.lock index 5271021e06a08..c3db77874fe8e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1784,7 +1784,7 @@ dependencies = [ [[package]] name = "polkadot" -version = "0.2.4" +version = "0.2.5" dependencies = [ "ctrlc 1.1.1 (git+https://github.com/paritytech/rust-ctrlc.git)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1828,7 +1828,7 @@ dependencies = [ "polkadot-service 0.2.2", "polkadot-transaction-pool 0.1.0", "slog 2.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "substrate-cli 0.2.4", + "substrate-cli 0.2.5", "substrate-client 0.1.0", "substrate-codec 0.1.0", "substrate-extrinsic-pool 0.1.0", @@ -2614,7 +2614,7 @@ dependencies = [ [[package]] name = "substrate-cli" -version = "0.2.4" +version = "0.2.5" dependencies = [ "ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 4b5aa17328de5..6cef0dad31829 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ path = "polkadot/src/main.rs" [package] name = "polkadot" -version = "0.2.4" +version = "0.2.5" authors = ["Parity Technologies "] build = "build.rs" diff --git a/demo/cli/src/lib.rs b/demo/cli/src/lib.rs index 6eb6bfeaccdc5..997ed271aef5a 100644 --- a/demo/cli/src/lib.rs +++ b/demo/cli/src/lib.rs @@ -143,6 +143,7 @@ pub fn run(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 diff --git a/demo/executor/src/lib.rs b/demo/executor/src/lib.rs index 24ec4e5f573c9..a600732ac8a31 100644 --- a/demo/executor/src/lib.rs +++ b/demo/executor/src/lib.rs @@ -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()), @@ -247,7 +248,7 @@ mod tests { construct_block( 1, [69u8; 32].into(), - hex!("b97d52254fc967bb94bed485de6a738e9fad05decfda3453711677b8becf6d0a").into(), + hex!("42b56bd84bbaf239903480e071a8e7733e6b25c120d7f28bb5ec6a9ce96d565a").into(), vec![BareExtrinsic { signed: alice(), index: 0, @@ -260,7 +261,7 @@ mod tests { construct_block( 2, block1().1, - hex!("a1f018d2faa339f72f5ee29050b4670d971e2e271cc06c41ee9cbe1f4c6feec9").into(), + hex!("5b282cd7bbbac9acc2393d9618b87b70b875ea5ffdd5f6d60fe5c68fc435775f").into(), vec![ BareExtrinsic { signed: bob(), @@ -280,7 +281,7 @@ mod tests { construct_block( 1, [69u8; 32].into(), - hex!("41d07010f49aa29b2c9aca542cbaa6f59aafd3dda53cdf711c51ddb7d386912e").into(), + hex!("a3d8f40101bd901c69367b46d6b1d682ad306f506242ed96b33850a7d1c5695a").into(), vec![BareExtrinsic { signed: alice(), index: 0, diff --git a/polkadot/api/src/full.rs b/polkadot/api/src/full.rs index 79d77612c72bb..ca17188eacfad 100644 --- a/polkadot/api/src/full.rs +++ b/polkadot/api/src/full.rs @@ -147,8 +147,10 @@ impl> PolkadotApi for Client Result> { 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 diff --git a/polkadot/runtime/src/lib.rs b/polkadot/runtime/src/lib.rs index 1762b78044dde..2537c5e5fba5b 100644 --- a/polkadot/runtime/src/lib.rs +++ b/polkadot/runtime/src/lib.rs @@ -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, }; @@ -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() ); diff --git a/polkadot/runtime/src/utils.rs b/polkadot/runtime/src/utils.rs index d3bfe7449448f..6532765438dd7 100644 --- a/polkadot/runtime/src/utils.rs +++ b/polkadot/runtime/src/utils.rs @@ -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 { +pub fn inherent_extrinsics(data: ::primitives::InherentData, runtime_version: RuntimeVersion) -> Vec { let make_inherent = |function| UncheckedExtrinsic::new( Extrinsic { signed: Default::default(), @@ -39,7 +40,7 @@ pub fn inherent_extrinsics(data: ::primitives::InherentData) -> Vec 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 @@ -139,6 +140,7 @@ fn testnet_genesis(initial_authorities: Vec) -> GenesisConfig { bonding_duration: 2, early_era_slash: 0, session_reward: 0, + offline_slash_grace: 0, }), democracy: Some(DemocracyConfig { launch_period: 9, diff --git a/substrate/cli/Cargo.toml b/substrate/cli/Cargo.toml index 42cf85fee70f6..c31996cc2f00b 100644 --- a/substrate/cli/Cargo.toml +++ b/substrate/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-cli" -version = "0.2.4" +version = "0.2.5" authors = ["Parity Technologies "] description = "Substrate CLI interface." build = "build.rs" diff --git a/substrate/rpc-servers/src/lib.rs b/substrate/rpc-servers/src/lib.rs index e7ae82b518741..0979e405219c0 100644 --- a/substrate/rpc-servers/src/lib.rs +++ b/substrate/rpc-servers/src/lib.rs @@ -47,7 +47,7 @@ pub fn rpc_handler( Block: 'static, S: apis::state::StateApi, C: apis::chain::ChainApi, - A: apis::author::AuthorApi, + A: apis::author::AuthorApi, Y: apis::system::SystemApi, { let mut io = pubsub::PubSubHandler::default(); diff --git a/substrate/runtime/contract/src/tests.rs b/substrate/runtime/contract/src/tests.rs index 1bd3cfbcf84c6..2c43b7b5e1bb7 100644 --- a/substrate/runtime/contract/src/tests.rs +++ b/substrate/runtime/contract/src/tests.rs @@ -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(), ); diff --git a/substrate/runtime/council/src/lib.rs b/substrate/runtime/council/src/lib.rs index bdbdb687c5a78..a9f2e201ee35b 100644 --- a/substrate/runtime/council/src/lib.rs +++ b/substrate/runtime/council/src/lib.rs @@ -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::{ launch_period: 1, diff --git a/substrate/runtime/democracy/src/lib.rs b/substrate/runtime/democracy/src/lib.rs index 8a794a75470bc..2e73e60860605 100644 --- a/substrate/runtime/democracy/src/lib.rs +++ b/substrate/runtime/democracy/src/lib.rs @@ -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::{ launch_period: 1, @@ -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); }); @@ -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); }); } @@ -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); }); @@ -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); }); @@ -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); }); @@ -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); }); @@ -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); }); @@ -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); }); diff --git a/substrate/runtime/executive/src/lib.rs b/substrate/runtime/executive/src/lib.rs index f380acc0574bb..790e27b218c02 100644 --- a/substrate/runtime/executive/src/lib.rs +++ b/substrate/runtime/executive/src/lib.rs @@ -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, || { @@ -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![], }, }, @@ -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![], }, },