mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-26 08:51:06 +00:00
60e537b95f
First step in implementing https://github.com/paritytech/polkadot-sdk/issues/3144 ### Summary of changes - switch statement `Table` candidate mapping from `ParaId` to `CoreIndex` - introduce experimental `InjectCoreIndex` node feature. - determine and assume a `CoreIndex` for a candidate based on statement validator index. If the signature is valid it means validator controls the validator that index and we can easily map it to a validator group/core. - introduce a temporary provisioner fix until we fully enable elastic scaling in the subystem. The fix ensures we don't fetch the same backable candidate when calling `get_backable_candidate` for each core. TODO: - [x] fix backing tests - [x] fix statement table tests - [x] add new test --------- Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> Signed-off-by: alindima <alin@parity.io> Co-authored-by: alindima <alin@parity.io>
73 lines
2.4 KiB
Rust
73 lines
2.4 KiB
Rust
// Copyright (C) Parity Technologies (UK) Ltd.
|
|
// This file is part of Polkadot.
|
|
|
|
// Polkadot is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
|
|
// Polkadot is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//! The statement table.
|
|
//!
|
|
//! This stores messages other authorities issue about candidates.
|
|
//!
|
|
//! These messages are used to create a proposal submitted to a BFT consensus process.
|
|
//!
|
|
//! Proposals are formed of sets of candidates which have the requisite number of
|
|
//! validity and availability votes.
|
|
//!
|
|
//! Each parachain is associated with two sets of authorities: those which can
|
|
//! propose and attest to validity of candidates, and those who can only attest
|
|
//! to availability.
|
|
|
|
pub mod generic;
|
|
|
|
pub use generic::{Config, Context, Table};
|
|
|
|
/// Concrete instantiations suitable for v2 primitives.
|
|
pub mod v2 {
|
|
use crate::generic;
|
|
use primitives::{
|
|
CandidateHash, CommittedCandidateReceipt, CompactStatement as PrimitiveStatement,
|
|
CoreIndex, ValidatorIndex, ValidatorSignature,
|
|
};
|
|
|
|
/// Statements about candidates on the network.
|
|
pub type Statement = generic::Statement<CommittedCandidateReceipt, CandidateHash>;
|
|
|
|
/// Signed statements about candidates.
|
|
pub type SignedStatement = generic::SignedStatement<
|
|
CommittedCandidateReceipt,
|
|
CandidateHash,
|
|
ValidatorIndex,
|
|
ValidatorSignature,
|
|
>;
|
|
|
|
/// Kinds of misbehavior, along with proof.
|
|
pub type Misbehavior = generic::Misbehavior<
|
|
CommittedCandidateReceipt,
|
|
CandidateHash,
|
|
ValidatorIndex,
|
|
ValidatorSignature,
|
|
>;
|
|
|
|
/// A summary of import of a statement.
|
|
pub type Summary = generic::Summary<CandidateHash, CoreIndex>;
|
|
|
|
impl<'a> From<&'a Statement> for PrimitiveStatement {
|
|
fn from(s: &'a Statement) -> PrimitiveStatement {
|
|
match *s {
|
|
generic::Statement::Valid(s) => PrimitiveStatement::Valid(s),
|
|
generic::Statement::Seconded(ref s) => PrimitiveStatement::Seconded(s.hash()),
|
|
}
|
|
}
|
|
}
|
|
}
|