31 major breaking releases

new 34.0.0 May 24, 2024
33.0.0 May 1, 2024
32.0.0 Apr 9, 2024
31.0.0 Mar 18, 2024
0.0.0 Nov 21, 2022

#1711 in Magic Beans

Download history 25/week @ 2024-02-10 14/week @ 2024-02-17 165/week @ 2024-02-24 19/week @ 2024-03-02 12/week @ 2024-03-09 115/week @ 2024-03-16 11/week @ 2024-03-23 20/week @ 2024-03-30 114/week @ 2024-04-06 11/week @ 2024-04-13 117/week @ 2024-04-27 7/week @ 2024-05-04

124 downloads per month
Used in polkadot-voter-bags

Apache-2.0

2.5MB
43K SLoC

Support code to ease the process of generating bag thresholds.

NOTE: this assume the runtime implements pallet_staking::Config, as it requires an implementation of the traits frame_support::traits::Currency and CurrencyToVote.

The process of adding bags to a runtime requires only four steps.

  1. Update the runtime definition.

    parameter_types!{
         pub const BagThresholds: &'static [u64] = &[];
    }
    
    impl pallet_bags_list::Config for Runtime {
         // <snip>
         type BagThresholds = BagThresholds;
    }
    
  2. Write a little program to generate the definitions. This program exists only to hook together the runtime definitions with the various calculations here. Take a look at utils/frame/generate_bags/node-runtime for an example.

  3. Run that program:

    $ cargo run -p node-runtime-generate-bags -- --total-issuance 1234 --minimum-balance 1
    

output.rs ```

  1. Update the runtime definition.

    + mod output;
    - pub const BagThresholds: &'static [u64] = &[];
    + pub const BagThresholds: &'static [u64] = &output::THRESHOLDS;
    

Dependencies

~20–33MB
~559K SLoC