mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 19:51:05 +00:00
Use a more typesafe approach for managing indexed data (#6150)
* Fix for issue #2403 * Nightly fmt * Quick documentation fixes * Default Implementation * iter() function integrated * Implemented iter functionalities * Fmt * small change * updates node-network * updates in dispute-coordinator * Updates * benchmarking fix * minor fix * test fixes in runtime api * Update primitives/src/v2/mod.rs Co-authored-by: Andronik <write@reusable.software> * Update primitives/src/v2/mod.rs Co-authored-by: Andronik <write@reusable.software> * Update primitives/src/v2/mod.rs Co-authored-by: Andronik <write@reusable.software> * Update primitives/src/v2/mod.rs Co-authored-by: Andronik <write@reusable.software> * Update primitives/src/v2/mod.rs Co-authored-by: Andronik <write@reusable.software> * Removal of [index], shorting of FromIterator, Renaming of GroupValidators to ValidatorGroups * Removal of ops import * documentation fixes for spell check * implementation of generic type * Refactoring * Test and documentation fixes * minor test fix * minor test fix * minor test fix * Update node/network/statement-distribution/src/lib.rs Co-authored-by: Andronik <write@reusable.software> * Update primitives/src/v2/mod.rs Co-authored-by: Andronik <write@reusable.software> * Update primitives/src/v2/mod.rs Co-authored-by: Andronik <write@reusable.software> * removed IterMut * Update node/core/dispute-coordinator/src/import.rs Co-authored-by: Andronik <write@reusable.software> * Update node/core/dispute-coordinator/src/initialized.rs Co-authored-by: Andronik <write@reusable.software> * Update primitives/src/v2/mod.rs Co-authored-by: Andronik <write@reusable.software> * fmt * IterMut * documentation update Co-authored-by: Andronik <write@reusable.software> * minor adjustments and new TypeIndex trait * spelling fix * TypeIndex fix Co-authored-by: Andronik <write@reusable.software>
This commit is contained in:
@@ -47,8 +47,8 @@ use polkadot_node_subsystem::{
|
||||
};
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, CandidateHash, CommittedCandidateReceipt, CompactStatement, Hash,
|
||||
SignedStatement, SigningContext, UncheckedSignedStatement, ValidatorId, ValidatorIndex,
|
||||
ValidatorSignature,
|
||||
IndexedVec, SignedStatement, SigningContext, UncheckedSignedStatement, ValidatorId,
|
||||
ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
|
||||
use futures::{
|
||||
@@ -665,7 +665,7 @@ struct ActiveHeadData {
|
||||
/// Large statements we are waiting for with associated meta data.
|
||||
waiting_large_statements: HashMap<CandidateHash, LargeStatementStatus>,
|
||||
/// The parachain validators at the head's child session index.
|
||||
validators: Vec<ValidatorId>,
|
||||
validators: IndexedVec<ValidatorIndex, ValidatorId>,
|
||||
/// The current session index of this fork.
|
||||
session_index: sp_staking::SessionIndex,
|
||||
/// How many `Seconded` statements we've seen per validator.
|
||||
@@ -676,7 +676,7 @@ struct ActiveHeadData {
|
||||
|
||||
impl ActiveHeadData {
|
||||
fn new(
|
||||
validators: Vec<ValidatorId>,
|
||||
validators: IndexedVec<ValidatorIndex, ValidatorId>,
|
||||
session_index: sp_staking::SessionIndex,
|
||||
span: PerLeafSpan,
|
||||
) -> Self {
|
||||
@@ -878,7 +878,7 @@ fn check_statement_signature(
|
||||
SigningContext { session_index: head.session_index, parent_hash: relay_parent };
|
||||
|
||||
head.validators
|
||||
.get(statement.unchecked_validator_index().0 as usize)
|
||||
.get(statement.unchecked_validator_index())
|
||||
.ok_or_else(|| statement.clone())
|
||||
.and_then(|v| statement.try_into_checked(&signing_context, v))
|
||||
}
|
||||
@@ -2072,7 +2072,10 @@ impl<R: rand::Rng> StatementDistributionSubsystem<R> {
|
||||
// directly:
|
||||
let group_peers = {
|
||||
if let Some(our_group) = validator_info.our_group {
|
||||
let our_group = &session_info.validator_groups[our_group.0 as usize];
|
||||
let our_group = &session_info
|
||||
.validator_groups
|
||||
.get(our_group)
|
||||
.expect("`our_group` is derived from `validator_groups`; qed");
|
||||
|
||||
our_group
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user