Skip to content

Commit

Permalink
https://github.com/pendulum-chain/spacewalk/actions/runs/6482197215/j…
Browse files Browse the repository at this point in the history
…ob/17610217546?pr=385#step:12:560
  • Loading branch information
b-yap committed Oct 12, 2023
1 parent 7589b69 commit c51d07b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions pallets/stellar-relay/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use frame_support::BoundedVec;
use crate::{
traits::{Organization, Validator},
Config,
Expand All @@ -6,3 +7,6 @@ use crate::{
pub type OrganizationIdOf<T> = <T as Config>::OrganizationId;
pub type ValidatorOf<T> = Validator<OrganizationIdOf<T>>;
pub type OrganizationOf<T> = Organization<OrganizationIdOf<T>>;

pub type ValidatorsList<T> = BoundedVec<ValidatorOf<T>, <T as Config>::ValidatorLimit>;
pub type OrganizationsList<T> = BoundedVec<OrganizationOf<T>, <T as Config>::OrganizationLimit>;
10 changes: 5 additions & 5 deletions pallets/stellar-relay/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ use primitives::stellar::{

use crate::{
pallet::{verify_signature, Config},
types::{OrganizationOf, ValidatorOf},
Error, NewValidatorsEnactmentBlockHeight, OldOrganizations, OldValidators, Organizations,
Pallet, Validators,
};
use crate::types::{OrganizationsList, ValidatorOf, ValidatorsList};

/// Returns a map of organizationID to the number of validators that belongs to it
fn validator_count_per_org<T: Config>(
validators: &BoundedVec<ValidatorOf<T>, T::ValidatorLimit>,
validators: &ValidatorsList<T>,
) -> BTreeMap<T::OrganizationId, u32> {
let mut validator_count_per_organization_map = BTreeMap::<T::OrganizationId, u32>::new();

Expand All @@ -36,7 +36,7 @@ fn validator_count_per_org<T: Config>(
/// Builds a map used to identify the targeted organizations
fn targeted_organization_map<T: Config>(
envelopes: &UnlimitedVarArray<ScpEnvelope>,
validators: &BoundedVec<ValidatorOf<T>, T::ValidatorLimit>,
validators: &ValidatorsList<T>,
) -> BTreeMap<T::OrganizationId, u32> {
// Find the validators that are targeted by the SCP messages
let targeted_validators = validators
Expand Down Expand Up @@ -191,8 +191,8 @@ pub fn find_externalized_envelope<T: Config>(

pub fn validators_and_orgs<T: Config>() -> Result<
(
BoundedVec<ValidatorOf<T>, T::ValidatorLimit>,
BoundedVec<OrganizationOf<T>, T::OrganizationLimit>,
ValidatorsList<T>,
OrganizationsList<T>,
),
Error<T>,
> {
Expand Down

0 comments on commit c51d07b

Please sign in to comment.