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 1 commit
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
Prev Previous commit
Next Next commit
Version bump, fixes (#572)
* Bump version, don't propose invalid blocks

* Fix build.

* Fixes.

* More fixes.

* Fix tests.

* Fix more tests

* More tests fixed
  • Loading branch information
gavofyork authored Aug 15, 2018
commit d4f6af153a0d93298baba78d08330bd23bad58bf
4 changes: 3 additions & 1 deletion 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 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 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 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