mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
Don't pass validators' public keys with attestations (#186)
* Don't pass validators' public keys with attestations * Update statement-table's Misbehaviour typedef * Update network/router * Expand MessageValidationData * Try to fix tests * Extend ApiContext * Remove 'index_mapping' from the SessionParams * Construct index_mapping from authorities * Move index_mapping to TableContext * Add test for index_mapping order
This commit is contained in:
committed by
Robert Habermeier
parent
36dd42523d
commit
e8fcb43fcf
@@ -51,7 +51,7 @@ pub trait Context {
|
||||
/// Members are meant to submit candidates and vote on validity.
|
||||
fn is_member_of(&self, authority: &Self::AuthorityId, group: &Self::GroupId) -> bool;
|
||||
|
||||
// requisite number of votes for validity from a group.
|
||||
/// requisite number of votes for validity from a group.
|
||||
fn requisite_votes(&self, group: &Self::GroupId) -> usize;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ pub mod generic;
|
||||
pub use generic::Table;
|
||||
|
||||
use primitives::parachain::{
|
||||
Id, CandidateReceipt, Statement as PrimitiveStatement, ValidatorSignature, ValidatorId
|
||||
Id, CandidateReceipt, Statement as PrimitiveStatement, ValidatorSignature, ValidatorIndex,
|
||||
};
|
||||
use primitives::Hash;
|
||||
|
||||
@@ -34,10 +34,10 @@ use primitives::Hash;
|
||||
pub type Statement = generic::Statement<CandidateReceipt, Hash>;
|
||||
|
||||
/// Signed statements about candidates.
|
||||
pub type SignedStatement = generic::SignedStatement<CandidateReceipt, Hash, ValidatorId, ValidatorSignature>;
|
||||
pub type SignedStatement = generic::SignedStatement<CandidateReceipt, Hash, ValidatorIndex, ValidatorSignature>;
|
||||
|
||||
/// Kinds of misbehavior, along with proof.
|
||||
pub type Misbehavior = generic::Misbehavior<CandidateReceipt, Hash, ValidatorId, ValidatorSignature>;
|
||||
pub type Misbehavior = generic::Misbehavior<CandidateReceipt, Hash, ValidatorIndex, ValidatorSignature>;
|
||||
|
||||
/// A summary of import of a statement.
|
||||
pub type Summary = generic::Summary<Hash, Id>;
|
||||
@@ -46,14 +46,14 @@ 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: &ValidatorId, group: &Id) -> bool;
|
||||
fn is_member_of(&self, authority: ValidatorIndex, group: &Id) -> bool;
|
||||
|
||||
// requisite number of votes for validity from a group.
|
||||
/// 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 = ValidatorId;
|
||||
type AuthorityId = ValidatorIndex;
|
||||
type Digest = Hash;
|
||||
type GroupId = Id;
|
||||
type Signature = ValidatorSignature;
|
||||
@@ -67,8 +67,8 @@ impl<C: Context> generic::Context for C {
|
||||
candidate.parachain_index.clone()
|
||||
}
|
||||
|
||||
fn is_member_of(&self, authority: &ValidatorId, group: &Id) -> bool {
|
||||
Context::is_member_of(self, authority, group)
|
||||
fn is_member_of(&self, authority: &Self::AuthorityId, group: &Id) -> bool {
|
||||
Context::is_member_of(self, *authority, group)
|
||||
}
|
||||
|
||||
fn requisite_votes(&self, group: &Id) -> usize {
|
||||
|
||||
Reference in New Issue
Block a user