Skip to content
Snippets Groups Projects
Select Git revision
  • aadee12c989481e034b49d38b2e8c26cb227cc0b
  • master default protected
  • fix_picked_up_file_in_runtime_release
  • network/gtest-1000 protected
  • upgradable-multisig
  • runtime/gtest-1000
  • 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
  • gtest-1000-0.11.1 protected
  • gtest-1000-0.11.0 protected
  • gtest-1000 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
41 results

git-conventions.md

Blame
    • Hugo Trentesaux's avatar
      ef73a0d0
      improve documentation (!101) · ef73a0d0
      Hugo Trentesaux authored and Éloïs's avatar Éloïs committed
      * fix
      
      * doc(end2end): detail test users
      
      * doc(all): update docker tag
      
      update docker image name from 0.2.0 to 0.3.0
      use "docker compose" everywhere instead of "docker-compose"
      improve table of content
      fix layout
      
      * doc(all): improve docs
      
      add logo to readme
      add table of content
      rewording
      complete
      
      * doc(all): fix typos
      ef73a0d0
      History
      improve documentation (!101)
      Hugo Trentesaux authored and Éloïs's avatar Éloïs committed
      * fix
      
      * doc(end2end): detail test users
      
      * doc(all): update docker tag
      
      update docker image name from 0.2.0 to 0.3.0
      use "docker compose" everywhere instead of "docker-compose"
      improve table of content
      fix layout
      
      * doc(all): improve docs
      
      add logo to readme
      add table of content
      rewording
      complete
      
      * doc(all): fix typos
    lib.rs 3.92 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/>.
    
    //! # Duniter Test Parameters Pallet
    //!
    //! This pallet allows ĞDev runtime to tweak parameter values instead of having it as runtime constants.
    
    #![cfg_attr(not(feature = "std"), no_std)]
    
    pub use pallet::*;
    pub use types::*;
    
    pub mod types {
        use super::{Config, Pallet};
        use codec::{Decode, Encode};
        use frame_support::pallet_prelude::*;
        use pallet_duniter_test_parameters_macro::generate_fields_getters;
    
        #[generate_fields_getters]
        #[derive(
            Default,
            Encode,
            Decode,
            Clone,
            PartialEq,
            serde::Serialize,
            serde::Deserialize,
            scale_info::TypeInfo,
        )]
        pub struct Parameters<
            BlockNumber: Default + Parameter,
            CertCount: Default + Parameter,
            PeriodCount: Default + Parameter,
            SessionCount: Default + Parameter,
        > {
            pub babe_epoch_duration: PeriodCount,
            pub cert_period: BlockNumber,
            pub cert_max_by_issuer: CertCount,
            pub cert_min_received_cert_to_issue_cert: CertCount,
            pub cert_validity_period: BlockNumber,
            pub idty_confirm_period: BlockNumber,
            pub idty_creation_period: BlockNumber,
            pub membership_period: BlockNumber,
            pub membership_renewal_period: BlockNumber,
            pub ud_creation_period: PeriodCount,
            pub ud_reeval_period: PeriodCount,
            pub smith_cert_max_by_issuer: CertCount,
            pub smith_wot_min_cert_for_membership: CertCount,
            pub smith_inactivity_max_duration: SessionCount,
            pub wot_first_cert_issuable_on: BlockNumber,
            pub wot_min_cert_for_create_idty_right: CertCount,
            pub wot_min_cert_for_membership: CertCount,
        }
    }
    
    #[allow(unreachable_patterns)]
    #[frame_support::pallet]
    pub mod pallet {
        use super::*;
        use frame_support::{pallet_prelude::*, traits::StorageVersion};
    
        /// The current storage version.
        const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
    
        #[pallet::pallet]
        #[pallet::storage_version(STORAGE_VERSION)]
        #[pallet::without_storage_info]
        pub struct Pallet<T>(_);
    
        // CONFIG //
    
        #[pallet::config]
        pub trait Config: frame_system::Config {
            type BlockNumber: Default + MaybeSerializeDeserialize + Parameter;
            type CertCount: Default + MaybeSerializeDeserialize + Parameter;
            type PeriodCount: Default + MaybeSerializeDeserialize + Parameter;
            type SessionCount: Default + MaybeSerializeDeserialize + Parameter;
        }
    
        // STORAGE //
    
        #[pallet::storage]
        #[pallet::getter(fn parameters)]
        pub type ParametersStorage<T: Config> = StorageValue<
            _,
            Parameters<T::BlockNumber, T::CertCount, T::PeriodCount, T::SessionCount>,
            ValueQuery,
        >;
    
        // GENESIS
    
        #[pallet::genesis_config]
        pub struct GenesisConfig<T: Config> {
            pub parameters: Parameters<T::BlockNumber, T::CertCount, T::PeriodCount, T::SessionCount>,
        }
    
        impl<T: Config> Default for GenesisConfig<T> {
            fn default() -> Self {
                Self {
                    parameters: Default::default(),
                }
            }
        }
    
        #[pallet::genesis_build]
        impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
            fn build(&self) {
                <ParametersStorage<T>>::put(self.parameters.clone());
            }
        }
    }