36 major breaking releases

39.0.0 Jan 14, 2025
38.0.0 Sep 26, 2024
37.0.0 Jul 18, 2024
36.0.0 Jul 12, 2024
0.0.0 Nov 21, 2022

#9 in #bags

Download history 57/week @ 2024-11-27 70/week @ 2024-12-04 80/week @ 2024-12-11 71/week @ 2024-12-18 24/week @ 2024-12-25 23/week @ 2025-01-01 125/week @ 2025-01-08 118/week @ 2025-01-15 126/week @ 2025-01-22 132/week @ 2025-01-29 134/week @ 2025-02-05 65/week @ 2025-02-12 33/week @ 2025-02-19 77/week @ 2025-02-26 23/week @ 2025-03-05 30/week @ 2025-03-12

171 downloads per month
Used in 2 crates

Apache-2.0

2.5MB
46K SLoC

Release

Polkadot SDK Stable 2412


lib.rs:

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

~23–34MB
~583K SLoC