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

Commit 0a0ffac

Browse files
authored
Version bump, fixes (#572)
* Bump version, don't propose invalid blocks * Fix build. * Fixes. * More fixes. * Fix tests. * Fix more tests * More tests fixed
1 parent 6ce9337 commit 0a0ffac

File tree

14 files changed

+37
-26
lines changed

14 files changed

+37
-26
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ path = "polkadot/src/main.rs"
44

55
[package]
66
name = "polkadot"
7-
version = "0.2.4"
7+
version = "0.2.5"
88
authors = ["Parity Technologies <[email protected]>"]
99
build = "build.rs"
1010

demo/cli/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ pub fn run<I, T>(args: I) -> error::Result<()> where
143143
bonding_duration: 90, // 90 days per bond.
144144
early_era_slash: 10000,
145145
session_reward: 100,
146+
offline_slash_grace: 0,
146147
}),
147148
democracy: Some(DemocracyConfig {
148149
launch_period: 120 * 24 * 14, // 2 weeks per public referendum

demo/executor/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ mod tests {
208208
reclaim_rebate: 0,
209209
early_era_slash: 0,
210210
session_reward: 0,
211+
offline_slash_grace: 0,
211212
}),
212213
democracy: Some(Default::default()),
213214
council: Some(Default::default()),
@@ -247,7 +248,7 @@ mod tests {
247248
construct_block(
248249
1,
249250
[69u8; 32].into(),
250-
hex!("b97d52254fc967bb94bed485de6a738e9fad05decfda3453711677b8becf6d0a").into(),
251+
hex!("42b56bd84bbaf239903480e071a8e7733e6b25c120d7f28bb5ec6a9ce96d565a").into(),
251252
vec![BareExtrinsic {
252253
signed: alice(),
253254
index: 0,
@@ -260,7 +261,7 @@ mod tests {
260261
construct_block(
261262
2,
262263
block1().1,
263-
hex!("a1f018d2faa339f72f5ee29050b4670d971e2e271cc06c41ee9cbe1f4c6feec9").into(),
264+
hex!("5b282cd7bbbac9acc2393d9618b87b70b875ea5ffdd5f6d60fe5c68fc435775f").into(),
264265
vec![
265266
BareExtrinsic {
266267
signed: bob(),
@@ -280,7 +281,7 @@ mod tests {
280281
construct_block(
281282
1,
282283
[69u8; 32].into(),
283-
hex!("41d07010f49aa29b2c9aca542cbaa6f59aafd3dda53cdf711c51ddb7d386912e").into(),
284+
hex!("a3d8f40101bd901c69367b46d6b1d682ad306f506242ed96b33850a7d1c5695a").into(),
284285
vec![BareExtrinsic {
285286
signed: alice(),
286287
index: 0,

polkadot/api/src/full.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ impl<B: LocalBackend<Block>> PolkadotApi for Client<B, LocalCallExecutor<B, Nati
147147
fn inherent_extrinsics(&self, at: &BlockId, inherent_data: InherentData) -> Result<Vec<UncheckedExtrinsic>> {
148148
use codec::{Encode, Decode};
149149

150+
let runtime_version = self.runtime_version_at(at)?;
151+
150152
with_runtime!(self, at, || {
151-
let extrinsics = ::runtime::inherent_extrinsics(inherent_data);
153+
let extrinsics = ::runtime::inherent_extrinsics(inherent_data, runtime_version);
152154
extrinsics.into_iter()
153155
.map(|x| x.encode()) // get encoded representation
154156
.map(|x| Decode::decode(&mut &x[..])) // get byte-vec equivalent to extrinsic

polkadot/runtime/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ pub struct Concrete;
111111
pub const VERSION: RuntimeVersion = RuntimeVersion {
112112
spec_name: ver_str!("polkadot"),
113113
impl_name: ver_str!("parity-polkadot"),
114-
authoring_version: 2,
114+
authoring_version: 1,
115115
spec_version: 4,
116116
impl_version: 0,
117117
};
@@ -250,7 +250,7 @@ pub mod api {
250250
apply_extrinsic => |extrinsic| super::Executive::apply_extrinsic(extrinsic),
251251
execute_block => |block| super::Executive::execute_block(block),
252252
finalise_block => |()| super::Executive::finalise_block(),
253-
inherent_extrinsics => |inherent| super::inherent_extrinsics(inherent),
253+
inherent_extrinsics => |(inherent, version)| super::inherent_extrinsics(inherent, version),
254254
validator_count => |()| super::Session::validator_count(),
255255
validators => |()| super::Session::validators()
256256
);

polkadot/runtime/src/utils.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ use runtime_primitives::traits::{Checkable, AuxLookup};
2222
use timestamp::Call as TimestampCall;
2323
use parachains::Call as ParachainsCall;
2424
use staking::Call as StakingCall;
25+
use version::RuntimeVersion;
2526

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

42-
if !data.offline_indices.is_empty() {
43+
if !data.offline_indices.is_empty() && runtime_version.spec_version == 4 {
4344
inherent.push(make_inherent(
4445
Call::Staking(StakingCall::note_missed_proposal(data.offline_indices))
4546
));

polkadot/service/src/chain_spec.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ fn staging_testnet_config_genesis() -> GenesisConfig {
6464
validator_count: 12,
6565
sessions_per_era: 12, // 1 hour per era
6666
bonding_duration: 24, // 1 day per bond.
67+
offline_slash_grace: 0,
6768
}),
6869
democracy: Some(DemocracyConfig {
6970
launch_period: 12 * 60 * 24, // 1 day per public referendum
@@ -139,6 +140,7 @@ fn testnet_genesis(initial_authorities: Vec<AuthorityId>) -> GenesisConfig {
139140
bonding_duration: 2,
140141
early_era_slash: 0,
141142
session_reward: 0,
143+
offline_slash_grace: 0,
142144
}),
143145
democracy: Some(DemocracyConfig {
144146
launch_period: 9,

substrate/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "substrate-cli"
3-
version = "0.2.4"
3+
version = "0.2.5"
44
authors = ["Parity Technologies <[email protected]>"]
55
description = "Substrate CLI interface."
66
build = "build.rs"

substrate/rpc-servers/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub fn rpc_handler<Block: BlockT, S, C, A, Y>(
4747
Block: 'static,
4848
S: apis::state::StateApi<Block::Hash, Metadata=Metadata>,
4949
C: apis::chain::ChainApi<Block::Hash, Block::Header, Block::Extrinsic, Metadata=Metadata>,
50-
A: apis::author::AuthorApi<Block::Hash, Block::Extrinsic, PendingExtrinsics, Metadata=Metadata>,
50+
A: apis::author::AuthorApi<Block::Hash, Block::Extrinsic, Metadata=Metadata>,
5151
Y: apis::system::SystemApi,
5252
{
5353
let mut io = pubsub::PubSubHandler::default();

0 commit comments

Comments
 (0)