diff --git a/pallets/jungochain/src/lib.rs b/pallets/jungochain/src/lib.rs index acac0afd..91a0a351 100644 --- a/pallets/jungochain/src/lib.rs +++ b/pallets/jungochain/src/lib.rs @@ -446,9 +446,6 @@ pub mod pallet { #[pallet::type_value] /// Default value for network rate limit. pub fn DefaultNetworkRateLimit() -> u64 { - if cfg!(feature = "pow-faucet") { - return 0; - } T::InitialNetworkRateLimit::get() } #[pallet::type_value] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 39370077..431e6dba 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -119,6 +119,10 @@ type MemberCount = u32; pub type Nonce = u32; +type CU16 = ConstU16; +type CU32 = ConstU32; +type CU64 = ConstU64; + // Method used to calculate the fee of an extrinsic pub const fn deposit(items: u32, bytes: u32) -> Balance { pub const ITEMS_FEE: Balance = 2_000 * 10_000; @@ -908,71 +912,68 @@ impl pallet_jungochain::Config for Runtime { type Preimages = Preimage; type InitialIssuance = ConstU64<0>; // -- Per subnet - type InitialRho = ConstU16<10>; - type InitialKappa = ConstU16<32_767>; // 0.5 = 65535/2 - type InitialBondsMovingAverage = ConstU64<900_000>; - type InitialMaxAllowedUids = ConstU16<4096>; - type InitialMinAllowedWeights = ConstU16<1024>; - type InitialEmissionValue = ConstU16<0>; - type InitialMaxWeightsLimit = ConstU16<1000>; // 1000/2^16 = 0.015 - type InitialValidatorPruneLen = ConstU64<1>; - type InitialScalingLawPower = ConstU16<50>; // 0.5 - type InitialTempo = ConstU16; - type InitialAdjustmentInterval = ConstU16<100>; - type InitialAdjustmentAlpha = ConstU64<0>; // no weight to previous value. - type InitialTargetRegistrationsPerInterval = ConstU16<2>; - type InitialImmunityPeriod = ConstU16<4096>; - type InitialActivityCutoff = ConstU16<5000>; - type InitialMaxRegistrationsPerBlock = ConstU16<1>; - type InitialMaxAllowedValidators = ConstU16<128>; - type InitialPruningScore = ConstU16<{ u16::MAX }>; - type InitialDefaultDelegateTake = ConstU16<11_796>; // 18% honest number. - type InitialDefaultChildKeyTake = ConstU16<0>; // Allow 0% childkey take - type InitialMinDelegateTake = ConstU16<0>; // Allow 0% delegate take - type InitialMinChildKeyTake = ConstU16<0>; // 0 % - type InitialWeightsVersionKey = ConstU64<0>; - type InitialDifficulty = ConstU64<10_000_000>; - type InitialMaxDifficulty = ConstU64<{ u64::MAX / 4 }>; - type InitialMinDifficulty = ConstU64<10_000_000>; - type InitialServingRateLimit = ConstU64<50>; - type InitialBurn = ConstU64<1_000_000_000>; // 1 tao - type InitialMaxBurn = ConstU64<100_000_000_000>; // 100 tao - type InitialMinBurn = ConstU64<1_000_000_000>; // 1 tao + type InitialRho = CU16<10>; + type InitialKappa = CU16<32_767>; // 0.5 = 65535/2 + type InitialBondsMovingAverage = CU64<900_000>; + type InitialMaxAllowedUids = CU16<4096>; + type InitialMinAllowedWeights = CU16<1024>; + type InitialEmissionValue = CU16<0>; + type InitialMaxWeightsLimit = CU16<1000>; // 1000/2^16 = 0.015 + type InitialValidatorPruneLen = CU64<1>; + type InitialScalingLawPower = CU16<50>; // 0.5 + type InitialTempo = CU16; + type InitialAdjustmentInterval = CU16<100>; + type InitialAdjustmentAlpha = CU64<0>; // no weight to previous value. + type InitialTargetRegistrationsPerInterval = CU16<2>; + type InitialImmunityPeriod = CU16<4096>; + type InitialActivityCutoff = CU16<5000>; + type InitialMaxRegistrationsPerBlock = CU16<1>; + type InitialMaxAllowedValidators = CU16<128>; + type InitialPruningScore = CU16<{ u16::MAX }>; + type InitialDefaultDelegateTake = CU16<11_796>; // 18% honest number. + type InitialDefaultChildKeyTake = CU16<0>; // Allow 0% childkey take + type InitialMinDelegateTake = CU16<0>; // Allow 0% delegate take + type InitialMinChildKeyTake = CU16<0>; // 0 % + type InitialWeightsVersionKey = CU64<0>; + type InitialDifficulty = CU64<10_000_000>; + type InitialMaxDifficulty = CU64<{ u64::MAX / 4 }>; + type InitialMinDifficulty = CU64<10_000_000>; + type InitialServingRateLimit = CU64<50>; + type InitialBurn = CU64<{ 1 * JUNGO }>; + type InitialMaxBurn = CU64<{ 100 * JUNGO }>; + type InitialMinBurn = CU64<{ 1 * JUNGO }>; // -- - type KeySwapCost = ConstU64<1_000_000_000>; - type AlphaHigh = ConstU16<58982>; // Represents 0.9 as per the production default - type AlphaLow = ConstU16<45875>; // Represents 0.7 as per the production default + type KeySwapCost = CU64<1_000_000_000>; + type AlphaHigh = CU16<58982>; // Represents 0.9 as per the production default + type AlphaLow = CU16<45875>; // Represents 0.7 as per the production default type LiquidAlphaOn = ConstBool; - type RootTempo = ConstU16; - - type InitialTxRateLimit = ConstU64; - type InitialTxDelegateTakeRateLimit = ConstU64<216000>; // 30 days at 12 seconds per block ? - type InitialTxChildKeyTakeRateLimit = ConstU64; - type InitialMaxChildKeyTake = ConstU16<11_796>; // 18 % - type InitialRAORecycledForRegistration = ConstU64<0>; // 0 rao - type InitialSenateRequiredStakePercentage = ConstU64<1>; // 1 percent of total stake - type InitialNetworkImmunityPeriod = ConstU64<{ 7 * 7200 }>; - type InitialNetworkMinAllowedUids = ConstU16<128>; - type InitialNetworkMinLockCost = ConstU64<1_000_000_000_000>; // 1000 TAO - type InitialNetworkLockReductionInterval = ConstU64<{ 14 * 7200 }>; - type InitialSubnetOwnerCut = ConstU16<11_796>; // 18 percent - type InitialSubnetLimit = ConstU16<1024>; - type InitialFirstReservedNetuids = ConstU16; - type InitialNetworkRateLimit = SubtensorInitialNetworkRateLimit; - type InitialTargetStakesPerInterval = ConstU64<1>; - type InitialHotkeyEmissionTempo = SubtensorInitialHotkeyEmissionTempo; - type InitialNetworkMaxStake = ConstU64<{ u64::MAX }>; // Maximum possible value for u64, this make the make stake infinity - type InitialColdkeySwapScheduleDuration = InitialColdkeySwapScheduleDuration; - type InitialDissolveNetworkScheduleDuration = InitialDissolveNetworkScheduleDuration; - type DefaultStakeInterval = ConstU64; - type DefaultWeightsSetRateLimit = ConstU64; -} -parameter_types! { - pub const SubtensorInitialNetworkRateLimit : u64 = 7200; - pub const SubtensorInitialHotkeyEmissionTempo : u64 = 7200; // Drain every day. - pub const InitialColdkeySwapScheduleDuration : BlockNumber = 5 * DAYS; - pub const InitialDissolveNetworkScheduleDuration : BlockNumber = 5 * DAYS; -} + type RootTempo = CU16; + + type InitialTxRateLimit = CU64; + type InitialTxDelegateTakeRateLimit = CU64<{ 30 * DAYS as u64}>; + type InitialTxChildKeyTakeRateLimit = CU64; + type InitialMaxChildKeyTake = CU16<11_796>; // 18 % + type InitialRAORecycledForRegistration = CU64<0>; // 0 rao + type InitialSenateRequiredStakePercentage = CU64<1>; // 1 percent of total stake + type InitialNetworkImmunityPeriod = CU64<{ 7 * DAYS as u64 }>; + type InitialNetworkMinAllowedUids = CU16<128>; + type InitialNetworkMinLockCost = CU64<{ 1_000 * JUNGO }>; // 1000 JUNGO + type InitialNetworkLockReductionInterval = CU64<{ 14 * DAYS as u64 }>; + type InitialSubnetOwnerCut = CU16<11_796>; // 18 percent + type InitialSubnetLimit = CU16<1024>; + type InitialFirstReservedNetuids = CU16; + type InitialNetworkRateLimit = CU64; + type InitialTargetStakesPerInterval = CU64<1>; + type InitialHotkeyEmissionTempo = CU64<{ 1 * DAYS as u64 }>; + type InitialNetworkMaxStake = CU64<{ u64::MAX }>; // Maximum possible value for u64, this make the make stake infinity + type InitialColdkeySwapScheduleDuration = CU32<{ 5 * DAYS }>; + type InitialDissolveNetworkScheduleDuration = CU32<{ 5 * DAYS }>; + type DefaultStakeInterval = CU64; + type DefaultWeightsSetRateLimit = CU64; +} + +pub const JUNGO: Balance = 1_000_000_000; + #[cfg(not(feature = "fast-blocks"))] pub const ROOT_TEMPO: u16 = 20 * MINUTES as u16; //100; #[cfg(feature = "fast-blocks")] @@ -982,7 +983,7 @@ pub const DEFAULT_SUBNET_TEMPO: u16 = ROOT_TEMPO - 1; pub const DEFAULT_STAKE_INTERVAL: u64 = DEFAULT_SUBNET_TEMPO as u64; #[cfg(not(feature = "fast-blocks"))] -pub const INITIAL_CHILDKEY_TAKE_RATELIMIT: u64 = 216000; // 30 days at 12 seconds per block +pub const INITIAL_CHILDKEY_TAKE_RATELIMIT: u64 = 30 * DAYS as u64; #[cfg(feature = "fast-blocks")] pub const INITIAL_CHILDKEY_TAKE_RATELIMIT: u64 = 5; @@ -1001,6 +1002,11 @@ pub const FIRST_RESERVED_NETUIDS: u16 = 1000; #[cfg(feature = "fast-blocks")] pub const FIRST_RESERVED_NETUIDS: u16 = 1000; +#[cfg(not(feature = "fast-blocks"))] +pub const NETWORK_RATE_LIMIT: u64 = 10 * MINUTES as u64; // bittensor value was 1 * DAYS +#[cfg(feature = "fast-blocks")] +pub const NETWORK_RATE_LIMIT: u64 = 0; + type EnsureMajoritySenate = pallet_collective::EnsureProportionMoreThan;