Skip to content
Snippets Groups Projects
Select Git revision
  • c5d6c8e53e33a0d62a554a2b924e8bfa2576b221
  • master default protected
  • network/gdev-800 protected
  • cgeek/issue-297-cpu
  • gdev-800-tests
  • update-docker-compose-rpc-squid-names
  • fix-252
  • 1000i100-test
  • hugo/tmp-0.9.1
  • network/gdev-803 protected
  • hugo/endpoint-gossip
  • network/gdev-802 protected
  • hugo/distance-precompute
  • network/gdev-900 protected
  • tuxmain/anonymous-tx
  • debug/podman
  • hugo/195-doc
  • hugo/195-graphql-schema
  • hugo-tmp-dockerfile-cache
  • release/client-800.2 protected
  • release/runtime-800 protected
  • gdev-900-0.10.1 protected
  • gdev-900-0.10.0 protected
  • gdev-900-0.9.2 protected
  • gdev-800-0.8.0 protected
  • gdev-900-0.9.1 protected
  • gdev-900-0.9.0 protected
  • gdev-803 protected
  • gdev-802 protected
  • runtime-801 protected
  • gdev-800 protected
  • runtime-800-bis protected
  • runtime-800 protected
  • runtime-800-backup protected
  • runtime-701 protected
  • runtime-700 protected
  • runtime-600 protected
  • runtime-500 protected
  • v0.4.1 protected
  • runtime-401 protected
  • v0.4.0 protected
41 results

constants.rs

Blame
    • Benjamin Gallois's avatar
      cf605c4e
      Upgrade polkadot v1.17.0 (!312) · cf605c4e
      Benjamin Gallois authored and Hugo Trentesaux's avatar Hugo Trentesaux committed
      * remove duplicate
      
      * fix benchmark extrinsic creation
      
      * move offchain config to common
      
      * move benchmarks to common runtime
      
      * formatting
      
      * regenerate weight and metadata
      
      * follow-up to !295
      
      * add metadata hash check extension
      
      * fix tests
      
      * upgrade node
      
      * add autogenerated weights build test
      
      * update txextensions
      
      * update crates
      cf605c4e
      History
      Upgrade polkadot v1.17.0 (!312)
      Benjamin Gallois authored and Hugo Trentesaux's avatar Hugo Trentesaux committed
      * remove duplicate
      
      * fix benchmark extrinsic creation
      
      * move offchain config to common
      
      * move benchmarks to common runtime
      
      * formatting
      
      * regenerate weight and metadata
      
      * follow-up to !295
      
      * add metadata hash check extension
      
      * fix tests
      
      * upgrade node
      
      * add autogenerated weights build test
      
      * update txextensions
      
      * update crates
    constants.rs 2.61 KiB
    // Copyright 2021 Axiom-Team
    //
    // This file is part of Duniter-v2S.
    //
    // Duniter-v2S is free software: you can redistribute it and/or modify
    // it under the terms of the GNU Affero General Public License as published by
    // the Free Software Foundation, version 3 of the License.
    //
    // Duniter-v2S is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    // GNU Affero General Public License for more details.
    //
    // You should have received a copy of the GNU Affero General Public License
    // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
    
    use crate::{Balance, BlockNumber};
    use sp_runtime::Perbill;
    
    /// This determines the average expected block time that we are targeting.
    // Blocks will be produced at a minimum duration defined by `SLOT_DURATION`.
    // `SLOT_DURATION` is picked up by `pallet_timestamp` which is in turn picked
    // up by `pallet_babe` to implement `fn slot_duration()`.
    // Change this to adjust the block time.
    pub const MILLISECS_PER_BLOCK: u64 = 6000;
    pub const SECS_PER_BLOCK: u64 = MILLISECS_PER_BLOCK / 1_000;
    
    // NOTE: Currently it is not possible to change the slot duration after the chain has started.
    //       Attempting to do so will brick block production.
    pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
    
    // Time is measured by number of blocks.
    pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
    pub const HOURS: BlockNumber = MINUTES * 60;
    pub const DAYS: BlockNumber = HOURS * 24;
    const SECS_PER_YEAR: u64 = 31_557_600; // (365.25 * 24 * 60 * 60)
    pub const MONTHS: BlockNumber = (SECS_PER_YEAR / (12 * SECS_PER_BLOCK)) as BlockNumber;
    pub const YEARS: BlockNumber = (SECS_PER_YEAR / SECS_PER_BLOCK) as BlockNumber;
    
    // 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
    pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
    
    // The BABE epoch configuration at genesis.
    pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration =
        sp_consensus_babe::BabeEpochConfiguration {
            c: PRIMARY_PROBABILITY,
            allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryVRFSlots,
        };
    
    pub const DEPOSIT_PER_BYTE: Balance = 1;
    pub const DEPOSIT_PER_ITEM: Balance = 100;
    
    // Compute storage deposit per items and bytes
    pub const fn deposit(items: u32, bytes: u32) -> Balance {
        items as Balance * DEPOSIT_PER_ITEM + (bytes as Balance * DEPOSIT_PER_BYTE)
    }
    
    // Maximal weight proportion of normal extrinsics per block
    pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);