Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add CollatorsCount storage and fix linters
Signed-off-by: Georgi Zlatarev <georgi.zlatarev@manta.network>
  • Loading branch information
ghzlatarev committed Jul 27, 2022
commit 7f6f6a7040061ce8a94b6db1531bffbaebf364e3
9 changes: 7 additions & 2 deletions pallets/collator-selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ pub mod pallet {
#[pallet::getter(fn candidacy_bond)]
pub type CandidacyBond<T> = StorageValue<_, BalanceOf<T>, ValueQuery>;

/// The collators count.
#[pallet::storage]
#[pallet::getter(fn collators_count)]
pub type CollatorsCount<T: Config> = StorageValue<_, u32, ValueQuery>;

#[pallet::genesis_config]
pub struct GenesisConfig<T: Config> {
pub invulnerables: Vec<T::AccountId>,
Expand Down Expand Up @@ -635,7 +640,7 @@ pub mod pallet {

/// Reset the performance map to the currently active validators at 0 blocks
pub fn reset_collator_performance() {
let _ = <BlocksPerCollatorThisSession<T>>::clear(<DesiredCandidates<T>>::get(), None);
let _ = <BlocksPerCollatorThisSession<T>>::clear(<CollatorsCount<T>>::get(), None);
let validators = T::ValidatorRegistration::validators();
for validator_id in validators {
let account_id = T::AccountIdOf::convert(validator_id.clone().into());
Expand Down Expand Up @@ -699,7 +704,7 @@ pub mod pallet {
})
.collect::<Vec<_>>();
let result = Self::assemble_collators(active_candidate_ids);

<CollatorsCount<T>>::set(result.len() as u32);
frame_system::Pallet::<T>::register_extra_weight_unchecked(
T::WeightInfo::new_session(candidates_len_before as u32),
DispatchClass::Mandatory,
Expand Down
4 changes: 2 additions & 2 deletions runtime/calamari/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ xcm-builder = { git = 'https://github.com/paritytech/polkadot.git', default-feat
xcm-executor = { git = 'https://github.com/paritytech/polkadot.git', default-features = false, branch = "release-v0.9.26" }

# Third party (vendored) dependencies
orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.26" }
orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.26" }
orml-traits = { git = 'https://github.com/open-web3-stack/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.26" }
orml-xtokens = { git = 'https://github.com/open-web3-stack/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.26" }

# Self dependencies
calamari-vesting = { path = '../../pallets/vesting', default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions runtime/dolphin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ runtime-common = { path = '../common', default-features = false }
session-key-primitives = { path = '../../primitives/session-keys', default-features = false }

# Third party (vendored) dependencies
orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.26" }
orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", default-features = false, branch = "polkadot-v0.9.26" }
orml-traits = { git = 'https://github.com/open-web3-stack/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.26" }
orml-xtokens = { git = 'https://github.com/open-web3-stack/open-runtime-module-library.git', default-features = false, branch = "polkadot-v0.9.26" }

[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
Expand Down