Commit 27ffb816 authored by Gav's avatar Gav
Browse files

Update to latest substrate

parent 9e244dec
This diff is collapsed.
......@@ -549,8 +549,8 @@ impl<C> bft::Proposer<Block> for Proposer<C>
// refuse to vote if this block says a validator is offline that we
// think isn't.
let missed_proposal = proposal.noted_missed_proposal();
if !self.offline.read().check_consistency(&self.validators[..], missed_proposal) {
let offline = proposal.noted_offline();
if !self.offline.read().check_consistency(&self.validators[..], offline) {
return Box::new(futures::empty());
}
......
......@@ -16,10 +16,10 @@
//! Typesafe block interaction.
use super::{Call, Block, TIMESTAMP_SET_POSITION, PARACHAINS_SET_POSITION, NOTE_MISSED_PROPOSAL_POSITION};
use super::{Call, Block, TIMESTAMP_SET_POSITION, PARACHAINS_SET_POSITION, NOTE_OFFLINE_POSITION};
use timestamp::Call as TimestampCall;
use parachains::Call as ParachainsCall;
use staking::Call as StakingCall;
use consensus::Call as ConsensusCall;
use primitives::parachain::CandidateReceipt;
/// Provides a type-safe wrapper around a structurally valid block.
......@@ -91,9 +91,9 @@ impl CheckedBlock {
}
/// Extract the noted missed proposal validator indices (if any) from the block.
pub fn noted_missed_proposal(&self) -> &[u32] {
self.inner.extrinsics.get(NOTE_MISSED_PROPOSAL_POSITION as usize).and_then(|xt| match xt.extrinsic.function {
Call::Staking(StakingCall::note_missed_proposal(ref x)) => Some(&x[..]),
pub fn noted_offline(&self) -> &[u32] {
self.inner.extrinsics.get(NOTE_OFFLINE_POSITION as usize).and_then(|xt| match xt.extrinsic.function {
Call::Consensus(ConsensusCall::note_offline(ref x)) => Some(&x[..]),
_ => None,
}).unwrap_or(&[])
}
......
......@@ -88,8 +88,8 @@ pub use primitives::Header;
pub const TIMESTAMP_SET_POSITION: u32 = 0;
/// The position of the parachains set extrinsic.
pub const PARACHAINS_SET_POSITION: u32 = 1;
/// The position of the note_missed_proposal extrinsic in the block, if it exists.
pub const NOTE_MISSED_PROPOSAL_POSITION: u32 = 2;
/// The position of the note_offline in the block, if it exists.
pub const NOTE_OFFLINE_POSITION: u32 = 2;
/// The address format for describing accounts.
pub type Address = balances::Address<Concrete>;
......@@ -155,7 +155,9 @@ impl balances::Trait for Concrete {
pub type Balances = balances::Module<Concrete>;
impl consensus::Trait for Concrete {
const NOTE_OFFLINE_POSITION: u32 = NOTE_OFFLINE_POSITION;
type SessionKey = SessionKey;
type OnOfflineValidator = Staking;
}
/// Consensus module for this concrete runtime.
pub type Consensus = consensus::Module<Concrete>;
......@@ -184,7 +186,6 @@ impl session::Trait for Concrete {
pub type Session = session::Module<Concrete>;
impl staking::Trait for Concrete {
const NOTE_MISSED_PROPOSAL_POSITION: u32 = NOTE_MISSED_PROPOSAL_POSITION;
type Event = Event;
}
/// Staking module for this concrete runtime.
......
......@@ -21,7 +21,7 @@ use super::{Call, UncheckedExtrinsic, Extrinsic, Balances};
use runtime_primitives::traits::{Checkable, AuxLookup};
use timestamp::Call as TimestampCall;
use parachains::Call as ParachainsCall;
use staking::Call as StakingCall;
use consensus::Call as ConsensusCall;
/// Produces the list of inherent extrinsics.
pub fn inherent_extrinsics(data: ::primitives::InherentData) -> Vec<UncheckedExtrinsic> {
......@@ -41,7 +41,7 @@ pub fn inherent_extrinsics(data: ::primitives::InherentData) -> Vec<UncheckedExt
if !data.offline_indices.is_empty() {
inherent.push(make_inherent(
Call::Staking(StakingCall::note_missed_proposal(data.offline_indices))
Call::Consensus(ConsensusCall::note_offline(data.offline_indices))
));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment