Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
27ffb816
Commit
27ffb816
authored
Aug 30, 2018
by
Gav
Browse files
Update to latest substrate
parent
9e244dec
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
27ffb816
This diff is collapsed.
Click to expand it.
consensus/src/lib.rs
View file @
27ffb816
...
@@ -549,8 +549,8 @@ impl<C> bft::Proposer<Block> for Proposer<C>
...
@@ -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
// refuse to vote if this block says a validator is offline that we
// think isn't.
// think isn't.
let
missed_proposal
=
proposal
.noted_
missed_proposal
();
let
offline
=
proposal
.noted_
offline
();
if
!
self
.offline
.read
()
.check_consistency
(
&
self
.validators
[
..
],
missed_proposal
)
{
if
!
self
.offline
.read
()
.check_consistency
(
&
self
.validators
[
..
],
offline
)
{
return
Box
::
new
(
futures
::
empty
());
return
Box
::
new
(
futures
::
empty
());
}
}
...
...
runtime/src/checked_block.rs
View file @
27ffb816
...
@@ -16,10 +16,10 @@
...
@@ -16,10 +16,10 @@
//! Typesafe block interaction.
//! 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
timestamp
::
Call
as
TimestampCall
;
use
parachains
::
Call
as
ParachainsCall
;
use
parachains
::
Call
as
ParachainsCall
;
use
staking
::
Call
as
Staking
Call
;
use
consensus
::
Call
as
Consensus
Call
;
use
primitives
::
parachain
::
CandidateReceipt
;
use
primitives
::
parachain
::
CandidateReceipt
;
/// Provides a type-safe wrapper around a structurally valid block.
/// Provides a type-safe wrapper around a structurally valid block.
...
@@ -91,9 +91,9 @@ impl CheckedBlock {
...
@@ -91,9 +91,9 @@ impl CheckedBlock {
}
}
/// Extract the noted missed proposal validator indices (if any) from the block.
/// Extract the noted missed proposal validator indices (if any) from the block.
pub
fn
noted_
missed_proposal
(
&
self
)
->
&
[
u32
]
{
pub
fn
noted_
offline
(
&
self
)
->
&
[
u32
]
{
self
.inner.extrinsics
.get
(
NOTE_
MISSED_PROPOSAL
_POSITION
as
usize
)
.and_then
(|
xt
|
match
xt
.extrinsic.function
{
self
.inner.extrinsics
.get
(
NOTE_
OFFLINE
_POSITION
as
usize
)
.and_then
(|
xt
|
match
xt
.extrinsic.function
{
Call
::
Staking
(
StakingCall
::
note_missed_proposal
(
ref
x
))
=>
Some
(
&
x
[
..
]),
Call
::
Consensus
(
ConsensusCall
::
note_offline
(
ref
x
))
=>
Some
(
&
x
[
..
]),
_
=>
None
,
_
=>
None
,
})
.unwrap_or
(
&
[])
})
.unwrap_or
(
&
[])
}
}
...
...
runtime/src/lib.rs
View file @
27ffb816
...
@@ -88,8 +88,8 @@ pub use primitives::Header;
...
@@ -88,8 +88,8 @@ pub use primitives::Header;
pub
const
TIMESTAMP_SET_POSITION
:
u32
=
0
;
pub
const
TIMESTAMP_SET_POSITION
:
u32
=
0
;
/// The position of the parachains set extrinsic.
/// The position of the parachains set extrinsic.
pub
const
PARACHAINS_SET_POSITION
:
u32
=
1
;
pub
const
PARACHAINS_SET_POSITION
:
u32
=
1
;
/// The position of the note_
missed_proposal extrinsic
in the block, if it exists.
/// The position of the note_
offline
in the block, if it exists.
pub
const
NOTE_
MISSED_PROPOSAL
_POSITION
:
u32
=
2
;
pub
const
NOTE_
OFFLINE
_POSITION
:
u32
=
2
;
/// The address format for describing accounts.
/// The address format for describing accounts.
pub
type
Address
=
balances
::
Address
<
Concrete
>
;
pub
type
Address
=
balances
::
Address
<
Concrete
>
;
...
@@ -155,7 +155,9 @@ impl balances::Trait for Concrete {
...
@@ -155,7 +155,9 @@ impl balances::Trait for Concrete {
pub
type
Balances
=
balances
::
Module
<
Concrete
>
;
pub
type
Balances
=
balances
::
Module
<
Concrete
>
;
impl
consensus
::
Trait
for
Concrete
{
impl
consensus
::
Trait
for
Concrete
{
const
NOTE_OFFLINE_POSITION
:
u32
=
NOTE_OFFLINE_POSITION
;
type
SessionKey
=
SessionKey
;
type
SessionKey
=
SessionKey
;
type
OnOfflineValidator
=
Staking
;
}
}
/// Consensus module for this concrete runtime.
/// Consensus module for this concrete runtime.
pub
type
Consensus
=
consensus
::
Module
<
Concrete
>
;
pub
type
Consensus
=
consensus
::
Module
<
Concrete
>
;
...
@@ -184,7 +186,6 @@ impl session::Trait for Concrete {
...
@@ -184,7 +186,6 @@ impl session::Trait for Concrete {
pub
type
Session
=
session
::
Module
<
Concrete
>
;
pub
type
Session
=
session
::
Module
<
Concrete
>
;
impl
staking
::
Trait
for
Concrete
{
impl
staking
::
Trait
for
Concrete
{
const
NOTE_MISSED_PROPOSAL_POSITION
:
u32
=
NOTE_MISSED_PROPOSAL_POSITION
;
type
Event
=
Event
;
type
Event
=
Event
;
}
}
/// Staking module for this concrete runtime.
/// Staking module for this concrete runtime.
...
...
runtime/src/utils.rs
View file @
27ffb816
...
@@ -21,7 +21,7 @@ use super::{Call, UncheckedExtrinsic, Extrinsic, Balances};
...
@@ -21,7 +21,7 @@ use super::{Call, UncheckedExtrinsic, Extrinsic, Balances};
use
runtime_primitives
::
traits
::{
Checkable
,
AuxLookup
};
use
runtime_primitives
::
traits
::{
Checkable
,
AuxLookup
};
use
timestamp
::
Call
as
TimestampCall
;
use
timestamp
::
Call
as
TimestampCall
;
use
parachains
::
Call
as
ParachainsCall
;
use
parachains
::
Call
as
ParachainsCall
;
use
staking
::
Call
as
Staking
Call
;
use
consensus
::
Call
as
Consensus
Call
;
/// Produces the list of inherent extrinsics.
/// Produces the list of inherent extrinsics.
pub
fn
inherent_extrinsics
(
data
:
::
primitives
::
InherentData
)
->
Vec
<
UncheckedExtrinsic
>
{
pub
fn
inherent_extrinsics
(
data
:
::
primitives
::
InherentData
)
->
Vec
<
UncheckedExtrinsic
>
{
...
@@ -41,7 +41,7 @@ pub fn inherent_extrinsics(data: ::primitives::InherentData) -> Vec<UncheckedExt
...
@@ -41,7 +41,7 @@ pub fn inherent_extrinsics(data: ::primitives::InherentData) -> Vec<UncheckedExt
if
!
data
.offline_indices
.is_empty
()
{
if
!
data
.offline_indices
.is_empty
()
{
inherent
.push
(
make_inherent
(
inherent
.push
(
make_inherent
(
Call
::
Staking
(
StakingCall
::
note_missed_proposal
(
data
.offline_indices
))
Call
::
Consensus
(
ConsensusCall
::
note_offline
(
data
.offline_indices
))
));
));
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment