mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 00:17:56 +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:
@@ -448,10 +448,8 @@ async fn determine_our_validators<Context>(
|
||||
let rotation_info = get_group_rotation_info(ctx.sender(), relay_parent).await?;
|
||||
|
||||
let current_group_index = rotation_info.group_for_core(core_index, cores);
|
||||
let current_validators = groups
|
||||
.get(current_group_index.0 as usize)
|
||||
.map(|v| v.as_slice())
|
||||
.unwrap_or_default();
|
||||
let current_validators =
|
||||
groups.get(current_group_index).map(|v| v.as_slice()).unwrap_or_default();
|
||||
|
||||
let validators = &info.discovery_keys;
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ use polkadot_node_subsystem::{
|
||||
use polkadot_node_subsystem_test_helpers as test_helpers;
|
||||
use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, CollatorPair, GroupRotationInfo, ScheduledCore, SessionIndex,
|
||||
SessionInfo, ValidatorId, ValidatorIndex,
|
||||
AuthorityDiscoveryId, CollatorPair, GroupIndex, GroupRotationInfo, IndexedVec, ScheduledCore,
|
||||
SessionIndex, SessionInfo, ValidatorId, ValidatorIndex,
|
||||
};
|
||||
use polkadot_primitives_test_helpers::TestCandidateBuilder;
|
||||
|
||||
@@ -62,7 +62,7 @@ struct TestState {
|
||||
session_index: SessionIndex,
|
||||
}
|
||||
|
||||
fn validator_pubkeys(val_ids: &[Sr25519Keyring]) -> Vec<ValidatorId> {
|
||||
fn validator_pubkeys(val_ids: &[Sr25519Keyring]) -> IndexedVec<ValidatorIndex, ValidatorId> {
|
||||
val_ids.iter().map(|v| v.public().into()).collect()
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ impl TestState {
|
||||
fn current_group_validator_indices(&self) -> &[ValidatorIndex] {
|
||||
let core_num = self.availability_cores.len();
|
||||
let GroupIndex(group_idx) = self.group_rotation_info.group_for_core(CoreIndex(0), core_num);
|
||||
&self.session_info.validator_groups[group_idx as usize]
|
||||
&self.session_info.validator_groups.get(GroupIndex::from(group_idx)).unwrap()
|
||||
}
|
||||
|
||||
fn current_session_index(&self) -> SessionIndex {
|
||||
@@ -367,7 +367,7 @@ async fn distribute_collation(
|
||||
)) => {
|
||||
assert_eq!(relay_parent, test_state.relay_parent);
|
||||
tx.send(Ok((
|
||||
test_state.session_info.validator_groups.clone(),
|
||||
test_state.session_info.validator_groups.to_vec(),
|
||||
test_state.group_rotation_info.clone(),
|
||||
)))
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user