Update to Substrate master (#176)

* Update to master

This introduces a new type `CollatorId`, currently just `SessionKey`
but which would forseeably change to its own thing. It seems to work
like this (despite there being a lot of the new-incompatible
`AccountId` replaced). No idea if it does anything sensible, though.

* Cleanups

* Fix tests

* Remove commented code

* Specify commit hash

* Remove commented code

* Correct version

* Update runtime/Cargo.toml

Co-Authored-By: gavofyork <github@gavwood.com>

* PairT instead of _Pair

* Update lock file

* Remove rev causing upset
This commit is contained in:
Gav Wood
2019-03-18 11:29:39 +01:00
committed by GitHub
parent 448c23dc52
commit 67275abe30
23 changed files with 1128 additions and 792 deletions
+8 -8
View File
@@ -26,18 +26,18 @@ pub mod generic;
pub use generic::Table;
use primitives::parachain::{
Id, CandidateReceipt, CandidateSignature as Signature, Statement as PrimitiveStatement,
Id, CandidateReceipt, Statement as PrimitiveStatement, ValidatorSignature, ValidatorId
};
use primitives::{SessionKey, Hash};
use primitives::Hash;
/// Statements about candidates on the network.
pub type Statement = generic::Statement<CandidateReceipt, Hash>;
/// Signed statements about candidates.
pub type SignedStatement = generic::SignedStatement<CandidateReceipt, Hash, SessionKey, Signature>;
pub type SignedStatement = generic::SignedStatement<CandidateReceipt, Hash, ValidatorId, ValidatorSignature>;
/// Kinds of misbehavior, along with proof.
pub type Misbehavior = generic::Misbehavior<CandidateReceipt, Hash, SessionKey, Signature>;
pub type Misbehavior = generic::Misbehavior<CandidateReceipt, Hash, ValidatorId, ValidatorSignature>;
/// A summary of import of a statement.
pub type Summary = generic::Summary<Hash, Id>;
@@ -46,17 +46,17 @@ pub type Summary = generic::Summary<Hash, Id>;
pub trait Context {
/// Whether a authority is a member of a group.
/// Members are meant to submit candidates and vote on validity.
fn is_member_of(&self, authority: &SessionKey, group: &Id) -> bool;
fn is_member_of(&self, authority: &ValidatorId, group: &Id) -> bool;
// requisite number of votes for validity from a group.
fn requisite_votes(&self, group: &Id) -> usize;
}
impl<C: Context> generic::Context for C {
type AuthorityId = SessionKey;
type AuthorityId = ValidatorId;
type Digest = Hash;
type GroupId = Id;
type Signature = Signature;
type Signature = ValidatorSignature;
type Candidate = CandidateReceipt;
fn candidate_digest(candidate: &CandidateReceipt) -> Hash {
@@ -67,7 +67,7 @@ impl<C: Context> generic::Context for C {
candidate.parachain_index.clone()
}
fn is_member_of(&self, authority: &SessionKey, group: &Id) -> bool {
fn is_member_of(&self, authority: &ValidatorId, group: &Id) -> bool {
Context::is_member_of(self, authority, group)
}