repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -98,9 +98,8 @@ pub mod pallet { // --- Currency type that will be used to place deposits on neurons type Currency: Currency<Self::AccountId> + Send + Sync; - type SenateMembers: crate::MemberManagement<Self::AccountId>; - - type TriumvirateInterface: crate::CollectiveInterface<Self:...
Remove these
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -1913,7 +1912,7 @@ pub mod pallet { return result; } - #[pallet::call_index(55)] + /*#[pallet::call_index(55)]
Remove the extrinsic entirely
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -111,12 +111,12 @@ pub fn migrate_create_root_network<T: Config>() -> Weight { // Empty senate members entirely, they will be filled by by registrations // on the subnet. - for hotkey_i in T::SenateMembers::members().iter() { + /*for hotkey_i in T::SenateMembers::members().iter() {
Remove this portion of the migration code entirely
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -470,7 +470,7 @@ impl<T: Config> Pallet<T> { ); } - let current_stake = Self::get_total_stake_for_hotkey(&hotkey); + /*let current_stake = Self::get_total_stake_for_hotkey(&hotkey);
Remove
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -1088,9 +1088,9 @@ impl<T: Config> Pallet<T> { SenateRequiredStakePercentage::<T>::put(required_percent); } - pub fn is_senate_member( hotkey: &T::AccountId ) -> bool { + /*pub fn is_senate_member( hotkey: &T::AccountId ) -> bool {
Remove
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -14,7 +14,7 @@ use sp_runtime::{ DispatchResult, }; -use pallet_collective::MemberCount; +//use pallet_collective::MemberCount;
Remove this include
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -28,10 +28,10 @@ frame_support::construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, Balances: pallet_balances::{Pallet, Call, Config<T>, Storage, Event<T>}, - Triumvirate: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Con...
Remove these unit test construct_runtime loaders
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -162,6 +162,7 @@ parameter_types! { pub const InitialNetworkRateLimit: u64 = 0; } +/*
Remove these parameter_type calls entirely for Council and Triumvirate
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -159,7 +159,8 @@ fn test_root_register_stake_based_pruning_works() { // Check for unsuccesfull registration. assert!(!SubtensorModule::get_uid_for_net_and_hotkey(root_netuid, &hot).is_ok()); // Check that they are NOT senate members - assert!(!SubtensorModule::is_sen...
Remove the senate related assert, no reason to keep removed code in our files
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -49,8 +49,8 @@ sp-version = { version = "5.0.0", default-features = false, git = "https://githu pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } # Used for sudo decentralization -pallet-collective = { version = "4....
Remove these and other commented out references to these pallets from the cargo.toml file
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -343,7 +344,8 @@ use pallet_collective::{CanPropose, CanVote, GetVotingMembers}; pub struct CanProposeToTriumvirate; impl CanPropose<AccountId> for CanProposeToTriumvirate { fn can_propose(account: &AccountId) -> bool { - Triumvirate::is_member(account) + //Triumvirate::is_member(account)
We should remove these commented out interfaces entirely, along with the parameter_types! macro calls for Council
subtensor
github_2023
others
203
opentensor
Rubberbandits
@@ -696,9 +701,9 @@ construct_runtime!( Balances: pallet_balances, TransactionPayment: pallet_transaction_payment, SubtensorModule: pallet_subtensor, - Triumvirate: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>}, - TriumvirateMembers: pal...
Remove these pallet loaders from construct_runtime call
subtensor
github_2023
others
193
opentensor
ifrit98
@@ -508,7 +508,7 @@ impl<T: Config> Pallet<T> { // --- 13. Force all members on root to become a delegate. if !Self::hotkey_is_delegate(&hotkey) { - Self::delegate_hotkey(&hotkey, 11_796); // 18% cut defaulted.
What is the conversion factor here? Would like to add some guardrails on the python side
subtensor
github_2023
others
242
opentensor
sam0x17
@@ -854,6 +861,7 @@ pub mod pallet { PowRegistrationAllowed(u16, bool), // --- Event created when POW registration is allowed/disallowed for a subnet. TempoSet(u16, u16), // --- Event created when setting tempo on a network RAORecycledForRegistrationSet(u16, u64), // Event created...
comment on this one would be nice. Also doc comments instead of line comments would be nice around here in general so people can see them when they hover stuff in their editor, though I forget if doc comments actually work in this position in substrate's outer macro pattern 🤔
subtensor
github_2023
others
242
opentensor
sam0x17
@@ -1656,13 +1665,44 @@ pub mod pallet { pub fn get_priority_set_weights(hotkey: &T::AccountId, netuid: u16) -> u64 { if Uids::<T>::contains_key(netuid, &hotkey) { let uid = Self::get_uid_for_net_and_hotkey(netuid, &hotkey.clone()).unwrap(); + let stake = Self::get_...
```suggestion true ```
subtensor
github_2023
others
242
opentensor
sam0x17
@@ -1705,11 +1745,13 @@ where } pub fn get_priority_set_weights(who: &T::AccountId, netuid: u16) -> u64 { - // Return the non vanilla priority for a set weights call. - return Pallet::<T>::get_priority_set_weights(who, netuid); } + pub fn check_weights_min_stake( who: &T::AccountId...
```suggestion Pallet::<T>::check_weights_min_stake(who) ```
subtensor
github_2023
others
242
opentensor
sam0x17
@@ -1656,13 +1665,44 @@ pub mod pallet { pub fn get_priority_set_weights(hotkey: &T::AccountId, netuid: u16) -> u64 { if Uids::<T>::contains_key(netuid, &hotkey) { let uid = Self::get_uid_for_net_and_hotkey(netuid, &hotkey.clone()).unwrap(); + let stake = Self::get_...
```suggestion return false; ```
subtensor
github_2023
others
242
opentensor
sam0x17
@@ -1656,13 +1665,44 @@ pub mod pallet { pub fn get_priority_set_weights(hotkey: &T::AccountId, netuid: u16) -> u64 { if Uids::<T>::contains_key(netuid, &hotkey) { let uid = Self::get_uid_for_net_and_hotkey(netuid, &hotkey.clone()).unwrap(); + let stake = Self::get_...
```suggestion return false; ```
subtensor
github_2023
others
242
opentensor
sam0x17
@@ -1656,13 +1665,44 @@ pub mod pallet { pub fn get_priority_set_weights(hotkey: &T::AccountId, netuid: u16) -> u64 { if Uids::<T>::contains_key(netuid, &hotkey) { let uid = Self::get_uid_for_net_and_hotkey(netuid, &hotkey.clone()).unwrap(); + let stake = Self::get_...
```suggestion return false; ```
subtensor
github_2023
others
242
opentensor
sam0x17
@@ -1656,13 +1665,44 @@ pub mod pallet { pub fn get_priority_set_weights(hotkey: &T::AccountId, netuid: u16) -> u64 { if Uids::<T>::contains_key(netuid, &hotkey) { let uid = Self::get_uid_for_net_and_hotkey(netuid, &hotkey.clone()).unwrap(); + let stake = Self::get_...
```suggestion return false; ```
subtensor
github_2023
others
242
opentensor
sam0x17
@@ -1656,13 +1665,44 @@ pub mod pallet { pub fn get_priority_set_weights(hotkey: &T::AccountId, netuid: u16) -> u64 { if Uids::<T>::contains_key(netuid, &hotkey) { let uid = Self::get_uid_for_net_and_hotkey(netuid, &hotkey.clone()).unwrap(); + let stake = Self::get_...
```suggestion return false; ```
subtensor
github_2023
others
242
opentensor
Eugene-hu
@@ -1656,13 +1665,44 @@ pub mod pallet { pub fn get_priority_set_weights(hotkey: &T::AccountId, netuid: u16) -> u64 { if Uids::<T>::contains_key(netuid, &hotkey) { let uid = Self::get_uid_for_net_and_hotkey(netuid, &hotkey.clone()).unwrap(); + let stake = Self::get_...
Should this limit be a hyperparameter? Also is the limit suppose to be 20 million tao?
subtensor
github_2023
others
240
opentensor
sam0x17
@@ -821,9 +822,29 @@ impl<T: Config> Pallet<T> { let _ = Uids::<T>::clear_prefix(netuid, u32::max_value(), None); let _ = Keys::<T>::clear_prefix(netuid, u32::max_value(), None); let _ = Bonds::<T>::clear_prefix(netuid, u32::max_value(), None); - let _ = Weights::<T>::clear_prefix(netu...
This is inefficient for a few reasons: 1. If we use `Vec::new()` every time, but we actually know the final size of the Vec, we are relying on the auto-resizing mechanics of `Vec` when we could just make the whole allocation up-front, resulting in a few intermediate needless allocations 2. It turns out though, we are...
subtensor
github_2023
others
198
opentensor
steffencruz
@@ -533,3 +533,36 @@ fn test_network_pruning() { assert_eq!(SubtensorModule::get_total_issuance(), 585_930_498); }); } + +#[test] +fn test_network_prune_results() { + new_test_ext().execute_with(|| { + migration::migrate_create_root_network::<Test>(); + + SubtensorModule::set_network_imm...
```rust // lowest emission SubtensorModule::set_emission_values(&vec![1u16, 2u16, 3u16], vec![5u64, 4u64, 4u64]); assert_eq!(SubtensorModule::get_subnet_to_prune(), 2u16); ``` ```rust // equal emission, creation date SubtensorModule::set_emission_values(&vec![1u16, 2u16, 3u16], vec![5u64, 5u64, 4u64]); asser...
subtensor
github_2023
others
189
opentensor
eduardogr
@@ -317,7 +317,7 @@ impl<T: Config> Pallet<T> { // --- 3. Ensure the passed network allows registrations. ensure!( - Self::if_subnet_allows_registration(netuid), + Self::get_network_pow_registration_allowed(netuid),
is there some idiomatic reason for this name change? I thjink the previous one has a good naming, maybe something like.... `Self::subnet_allows_registrations(netuid)` which could fit with the context and its semantics. What do you think?
subtensor
github_2023
others
108
opentensor
camfairchild
@@ -1527,12 +1534,20 @@ pub mod pallet { } #[pallet::call_index(46)] + #[pallet::weight((Weight::from_ref_time(13_000_000) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)), DispatchClass::Operational, Pays::No))] + pub fn sudo_set_quadratic_voting_power( origin:...
You should assign the next call index to your new sudo call. We should avoid reassigning call indices, as this is effectively the API call name
subtensor
github_2023
others
149
opentensor
camfairchild
@@ -12,7 +12,7 @@ MaxAllowedUids: u16 = 1024; Issuance: u64 = 0; MinAllowedWeights: u16 = 8; EmissionValue: u64 = 142_223_000; -MaxWeightsLimit: u16 = 32768; // 50% of u16 +MaxWeightsLimit: 655; // 655/2^16 = 0.01
```suggestion MaxWeightsLimit: 455; // 455/2^16 = 0.0069 ``` This is the current chain state
subtensor
github_2023
others
110
opentensor
Rubberbandits
@@ -42,7 +42,7 @@ sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https:/ sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } sp-runtime = { version = "7.0.0", default-features = false, git = "http...
This typo in cargo.toml seems to break everything
subtensor
github_2023
others
110
opentensor
SaMotlagh
@@ -1105,6 +1108,19 @@ pub mod pallet { Self::do_registration(origin, netuid, block_number, nonce, work, hotkey, coldkey) } + /// Associates the hotkey to this coldkey. + /// TODO(const): this call should be costly. + #[pallet::call_index(6)]
- we should not have two calls with same index. we should always add calls at the end of existing calls and increment index. - also, how are we paying for this call?
subtensor
github_2023
others
110
opentensor
S0AndS0
@@ -1105,6 +1108,19 @@ pub mod pallet { Self::do_registration(origin, netuid, block_number, nonce, work, hotkey, coldkey) } + /// Associates the hotkey to this coldkey. + /// TODO(const): this call should be costly. + #[pallet::call_index(6)] + #[pallet::weight((Weight::from_ref_time(2_000_000_000) /// mak...
Triple-slash comments (`///`) are for doc-comments, so either double-slash or (better yet) inline comments (`/* ... */`) should be used instead, eg. ```diff -#[pallet::weight((Weight::from_ref_time(2_000_000_000) /// making this an expensive call? +#[pallet::weight((Weight::from_ref_time(2_000_000_000) /* making t...
subtensor
github_2023
others
110
opentensor
S0AndS0
@@ -169,6 +169,49 @@ impl<T: Config> Pallet<T> { Ok(()) } + pub fn do_associate( + origin: T::RuntimeOrigin, + hotkey: T::AccountId, + ) -> DispatchResult { + // --- 1. Check that the caller has signed the transaction. (the coldkey of the pairing) + let coldkey = ensu...
Missing a coma between `cold`/`hot`-`key` within output ```diff -log::info!("HotkeyAssociated( coldkey:{:?} hotkey:{:?} ) ", coldkey, hotkey ); +log::info!("HotkeyAssociated( coldkey:{:?}, hotkey:{:?} ) ", coldkey, hotkey ); ```
subtensor
github_2023
others
110
opentensor
S0AndS0
@@ -169,6 +169,49 @@ impl<T: Config> Pallet<T> { Ok(()) } + pub fn do_associate( + origin: T::RuntimeOrigin, + hotkey: T::AccountId, + ) -> DispatchResult { + // --- 1. Check that the caller has signed the transaction. (the coldkey of the pairing) + let coldkey = ensu...
Missing a coma between cold/hot-key within output ```diff -log::info!("do_associate( coldkey:{:?} hotkey:{:?} )", coldkey, hotkey ); +log::info!("do_associate( coldkey:{:?}, hotkey:{:?} )", coldkey, hotkey ); ```
subtensor
github_2023
others
110
opentensor
S0AndS0
@@ -169,6 +169,49 @@ impl<T: Config> Pallet<T> { Ok(()) } + pub fn do_associate( + origin: T::RuntimeOrigin, + hotkey: T::AccountId, + ) -> DispatchResult { + // --- 1. Check that the caller has signed the transaction. (the coldkey of the pairing) + let coldkey = ensu...
Mixing tabs and spaces ```diff - /// TODO( rusty ): this will take more care, edge cases if the hotkey ends up not having a coldkey but gets referenced somewhere. + /// TODO( rusty ): this will take more care, edge cases if the hotkey ends up not having a coldkey but gets referenced somewhere. ```
subtensor
github_2023
others
110
opentensor
S0AndS0
@@ -169,6 +169,49 @@ impl<T: Config> Pallet<T> { Ok(()) } + pub fn do_associate( + origin: T::RuntimeOrigin, + hotkey: T::AccountId, + ) -> DispatchResult { + // --- 1. Check that the caller has signed the transaction. (the coldkey of the pairing) + let coldkey = ensu...
Trailing blank space ```diff -Self::remove_association( &coldkey, &hotkey); +-Self::remove_association( &coldkey, &hotkey); ```
subtensor
github_2023
others
110
opentensor
S0AndS0
@@ -169,6 +169,49 @@ impl<T: Config> Pallet<T> { Ok(()) } + pub fn do_associate( + origin: T::RuntimeOrigin, + hotkey: T::AccountId, + ) -> DispatchResult { + // --- 1. Check that the caller has signed the transaction. (the coldkey of the pairing) + let coldkey = ensu...
Missing comma ```diff -log::info!("do_associate( coldkey:{:?} hotkey:{:?} )", coldkey, hotkey ); +log::info!("do_associate( coldkey:{:?}, hotkey:{:?} )", coldkey, hotkey ); ```
subtensor
github_2023
others
110
opentensor
S0AndS0
@@ -169,6 +169,49 @@ impl<T: Config> Pallet<T> { Ok(()) } + pub fn do_associate( + origin: T::RuntimeOrigin, + hotkey: T::AccountId, + ) -> DispatchResult { + // --- 1. Check that the caller has signed the transaction. (the coldkey of the pairing) + let coldkey = ensu...
Missing comma ```diff -log::info!("HotkeyDeAssociated( coldkey:{:?} hotkey:{:?} ) ", coldkey, hotkey ); +log::info!("HotkeyDeAssociated( coldkey:{:?}, hotkey:{:?} ) ", coldkey, hotkey ); ```
subtensor
github_2023
others
110
opentensor
shibshib
@@ -1105,6 +1108,21 @@ pub mod pallet { Self::do_registration(origin, netuid, block_number, nonce, work, hotkey, coldkey) } + /// Associates the hotkey to this coldkey. + /// TODO(const): this call should be costly. + #[pallet::call_index(51)] + + /* Instead of using high arbitrary weight, we need to use i...
How were these weights calculated? Was it benchmarked on one of the validator machines?
subtensor
github_2023
others
110
opentensor
camfairchild
@@ -1105,6 +1108,31 @@ pub mod pallet { Self::do_registration(origin, netuid, block_number, nonce, work, hotkey, coldkey) } + /// Associates the hotkey to this coldkey. + /// TODO(const): this call should be costly. + #[pallet::call_index(51)] + /* Instead of using high arbitrary weight, we need to use inc...
```suggestion pub fn disassociate( origin:OriginFor<T>, hotkey: T::AccountId, ) -> DispatchResult { Self::do_disassociate(origin, hotkey) } ```
subtensor
github_2023
others
110
opentensor
camfairchild
@@ -169,6 +169,77 @@ impl<T: Config> Pallet<T> { Ok(()) } + // ---- The implementation for the extrinsic do_associate: associate a coldkey and a hotkey without registration + // + // # Args: + // * 'origin': (<T as frame_system::Config>RuntimeOrigin): + // - The signature of the callin...
```suggestion pub fn do_disassociate( origin: T::RuntimeOrigin, hotkey: T::AccountId, ) -> DispatchResult { ```
subtensor
github_2023
others
110
opentensor
camfairchild
@@ -169,6 +169,77 @@ impl<T: Config> Pallet<T> { Ok(()) } + // ---- The implementation for the extrinsic do_associate: associate a coldkey and a hotkey without registration + // + // # Args: + // * 'origin': (<T as frame_system::Config>RuntimeOrigin): + // - The signature of the callin...
```suggestion Self::deposit_event( Event::HotkeyDisassociated( coldkey, hotkey ) ); ```
subtensor
github_2023
others
110
opentensor
camfairchild
@@ -530,6 +530,8 @@ pub mod pallet { StakeRemoved( T::AccountId, u64 ), // --- Event created when stake has been removed from the hotkey staking account onto the coldkey account. WeightsSet( u16, u16 ), // ---- Event created when a caller successfully set's their weights on a subnetwork. NeuronRegistered( u16,...
```suggestion HotkeyDisassociated( T::AccountId, T::AccountId ), // --- Event created when a hotkey has been disassociated with a coldkey. ```
subtensor
github_2023
others
110
opentensor
camfairchild
@@ -169,6 +169,77 @@ impl<T: Config> Pallet<T> { Ok(()) } + // ---- The implementation for the extrinsic do_associate: associate a coldkey and a hotkey without registration + // + // # Args: + // * 'origin': (<T as frame_system::Config>RuntimeOrigin): + // - The signature of the callin...
Not sure this makes sense because the hotkey isn't signing the ext
subtensor
github_2023
others
110
opentensor
camfairchild
@@ -0,0 +1,5 @@ +{ + "rust-analyzer.cargo.extraEnv": { + "RUSTUP_TOOLCHAIN": "stable"
Shouldn't this be nightly?
subtensor
github_2023
others
110
opentensor
camfairchild
@@ -169,6 +172,101 @@ impl<T: Config> Pallet<T> { Ok(()) } + // ---- The implementation for the extrinsic associate: associate a coldkey and a hotkey without registration + // + // # Args: + // * 'origin': (<T as frame_system::Config>RuntimeOrigin): + // - The signature of the calling ...
Do we have to make it bytes here first? Can't go straight from `AccountId`?
subtensor
github_2023
others
110
opentensor
SaMotlagh
@@ -1726,6 +1762,12 @@ impl<T: Config + Send + Sync + TypeInfo> SignedExtension for SubtensorSignedExte ..Default::default() }) } + Some(Call::associate{..}) => { + Ok(ValidTransaction { + priority: Self::get_priority_vanill...
Do we need to explicitly set priority for this call?
subtensor
github_2023
others
183
opentensor
camfairchild
@@ -949,6 +949,9 @@ pub mod pallet { // Update total issuance value TotalIssuance::<T>::put(TotalIssuance::<T>::get().saturating_add(*stake)); + // Update total stake value + TotalStake::<T>::put(TotalStake::<T>::get().saturating_add(*sta...
Might be good to leave a comment here mentioning that the genesis block was not produced using this. i.e. this was added afterwards, so the genesis state would be different for a new instance of the chain.
subtensor
github_2023
others
172
opentensor
camfairchild
@@ -553,6 +559,30 @@ impl pallet_preimage::Config for Runtime { type ByteDeposit = PreimageByteDeposit; } +parameter_types! { + pub const BasicDeposit: Balance = (1) as Balance * 2_000 * 10_000_000 + (258 as Balance) * 100 * 1_000_000;
Why is the calculation like this? Is there some documentation that can be added?
subtensor
github_2023
others
172
opentensor
camfairchild
@@ -553,6 +559,30 @@ impl pallet_preimage::Config for Runtime { type ByteDeposit = PreimageByteDeposit; } +parameter_types! { + pub const BasicDeposit: Balance = (1) as Balance * 2_000 * 10_000_000 + (258 as Balance) * 100 * 1_000_000; + pub const FieldDeposit: Balance = (0) as Balance * 2_000 * 10_000_000 + (6...
Same for here
subtensor
github_2023
others
172
opentensor
camfairchild
@@ -553,6 +559,30 @@ impl pallet_preimage::Config for Runtime { type ByteDeposit = PreimageByteDeposit; } +parameter_types! { + pub const BasicDeposit: Balance = (1) as Balance * 2_000 * 10_000_000 + (258 as Balance) * 100 * 1_000_000; + pub const FieldDeposit: Balance = (0) as Balance * 2_000 * 10_000_000 + (6...
So then (currently) adding a registrar is a 2 of 3 from the triumvirate? Wonder if using the Validator set makes more sense? Or perhaps an additional council group can be formed.
subtensor
github_2023
others
148
opentensor
cuteolaf
@@ -1662,161 +2072,155 @@ impl Default for CallType { #[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] pub struct SubtensorSignedExtension<T: Config + Send + Sync + TypeInfo>(pub PhantomData<T>); -impl<T: Config + Send + Sync + TypeInfo> SubtensorSignedExtension<T> where - T::RuntimeCall: Dispatchable<Info...
`priority: priority,` --> `priority,`
subtensor
github_2023
others
105
opentensor
shibshib
@@ -43,6 +46,8 @@ sp-tracing = { git = "https://github.com/paritytech/substrate", default-features parity-util-mem = { version = "0.11.0", features = ['primitive-types'] } rand = "0.8" sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.39" } +# Used for sud...
Not sure if you need it in both test and production dependencies. You likely only need it in the main dependencies. If you need something for testing and not production then you can keep it only in dev dependencies, afaik.
subtensor
github_2023
others
105
opentensor
shibshib
@@ -320,6 +321,42 @@ impl pallet_sudo::Config for Runtime { type RuntimeCall = RuntimeCall; } +// Configure collective pallet for council +parameter_types! { + pub const CouncilMotionDuration: BlockNumber = 3 * MINUTES; + pub const CouncilMaxProposals: u32 = 100; + pub const CouncilMaxMembers: u32 = 100;
I don't think we need that many council members initially, or for testing, can we limit it to 3 for now?
subtensor
github_2023
others
105
opentensor
camfairchild
@@ -0,0 +1,47 @@ +[package] +name = "pallet-collective" +version = "4.0.0-dev" +authors = ["Parity Technologies <admin@parity.io>"]
Should be opentensor? Or at least adding opentensor
subtensor
github_2023
others
105
opentensor
camfairchild
@@ -0,0 +1,148 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License");
Why do we need the migration? Does collective already exist in the chain storage?
subtensor
github_2023
others
164
opentensor
camfairchild
@@ -491,6 +492,64 @@ impl pallet_multisig::Config for Runtime { type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>; } +parameter_types! { + pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * + BlockWeights::get().max_block; + pub const MaxScheduledPerBlock: u32 = 50; + pub const No...
```suggestion OriginCaller::Senate(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), // Equivalent to (l_yes_votes / l_count).cmp(&(r_yes_votes / r_count)) ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), ```
subtensor
github_2023
others
153
opentensor
camfairchild
@@ -363,3 +363,125 @@ fn finney_genesis( }, } } + +pub fn localnet_config() -> Result<ChainSpec, String> { + let path: PathBuf = std::path::PathBuf::from("./snapshot.json"); + let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?; + + // We mmap the file into memory first, as ...
Is this for local development? What key is this?
subtensor
github_2023
others
152
opentensor
shibshib
@@ -178,7 +178,7 @@ pub fn finney_mainnet_config() -> Result<ChainSpec, String> { Some("bittensor"), None, // Properties - None, + Some(properties),
Does changing this still make a difference? I thought `finnet_mainnet_config` is really only relevant for the genesis block
subtensor
github_2023
others
152
opentensor
shibshib
@@ -46,6 +46,9 @@ sp-std = { version = "5.0.0", default-features = false, git = "https://github.co sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } sp-version = { version = "5.0.0", default-features = false, git...
subtensor
github_2023
others
152
opentensor
shibshib
@@ -320,6 +320,24 @@ impl pallet_sudo::Config for Runtime { type RuntimeCall = RuntimeCall; } +parameter_types! { + // One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes. + pub const DepositBase: Balance = (1) as Balance * 2_000 * 10_000_000 + (88 as Balance) * 100 * 1_000_000; + // Additio...
Do we know what these two do? Guessing `DespositBase` is the base amount of currency needed to reserve to create a multisig?
subtensor
github_2023
others
146
opentensor
camfairchild
@@ -32,7 +32,7 @@ ActivityCutoff: u16 = 5000; MaxRegistrationsPerBlock: u16 = 1; PruningScore : u16 = u16::MAX; BondsMovingAverage: u64 = 900_000; -WeightsVersionKey: u64 = 370; +WeightsVersionKey: u64 = 1000;
Should be 510 now?
subtensor
github_2023
others
144
opentensor
eduardogr
@@ -44,8 +50,8 @@ bob_start=( --ws-port 9947 --rpc-port 9935 --validator - --execution native - --bootnodes "/ip4/127.0.0.1/tcp/30334/p2p/12D3KooWBBUaVWE5SYj3UvnoXojfS8fvPorw5biRDaDQV7XXwCXm"
no need for bootnodes anymore?
subtensor
github_2023
others
144
opentensor
eduardogr
@@ -6,6 +6,11 @@ FULL_PATH="$SPEC_PATH$CHAIN.json" +if [ ! -d "$SPEC_PATH" ]; then + echo "*** Creating directory ${SPEC_PATH}..." + mkdir $SPEC_PATH
looks it has diff number of spaces here
subtensor
github_2023
others
145
opentensor
eduardogr
@@ -0,0 +1,18 @@ +#!/bin/sh
this is very nice!! i will add this to some repositories i have! very nice @Rubberbandits out of curiosity, how the final message looks like?
subtensor
github_2023
others
78
opentensor
SaMotlagh
@@ -1296,6 +1301,12 @@ pub mod pallet { Self::do_sudo_set_tx_rate_limit( origin, tx_rate_limit ) } + // Sudo call for setting registration allowed + #[pallet::weight((0, DispatchClass::Operational, Pays::No))] + pub fn sudo_set_registration_allowed( origin:OriginFor<T>, netuid: u16, registration_allowed: bo...
- we need to add index for each call. that would be nice if you add this call at the end and increment index. - Also, you could run benchmark fn for this call and see how many r/w it needs. it must be similar to other calls and need one r/w. If so, I recommend to add similar weights for it.
subtensor
github_2023
others
8
opentensor
shibshib
@@ -153,7 +153,7 @@ struct ColdkeyHotkeys { } pub fn finney_config() -> Result<ChainSpec, String> { - let path: PathBuf = std::path::PathBuf::from("/Users/ec2-user/repos/subtensorv3/nakamoto_gen.json"); + let path: PathBuf = std::path::PathBuf::from("/Users/sam/Documents/GIT/subtensorv3/nakamoto_gen.json");
Careful here, this is your local path right? should keep it as ec2-user
subtensor
github_2023
others
19
opentensor
eduardogr
@@ -198,9 +198,9 @@ pub fn finney_config() -> Result<ChainSpec, String> { Ok(ChainSpec::from_genesis( // Name - "Finney", + "Bittensor", // ID - "Finney", + "bittensor",
Just got my attention, Is the lowercase on purpose? or we should have the ID with the Capital char as we have the Name?
subtensor
github_2023
others
19
opentensor
eduardogr
@@ -246,7 +246,7 @@ pub fn finney_config() -> Result<ChainSpec, String> { // Telemetry None, // Protocol ID - None, + Some("bittensor"),
Could the ID be extracted to a constant? sounds a good practice to keep the value aside and not duplicate it. What do you think about that?
subtensor
github_2023
others
42
opentensor
SaMotlagh
@@ -705,19 +704,18 @@ impl_runtime_apis! { impl subtensor_custom_rpc_runtime_api::SubnetInfoRuntimeApi<Block> for Runtime { fn get_subnet_info(netuid: u16) -> Vec<u8> { - let result = SubtensorModule::get_subnet_info(netuid); - if result.is_some() { - serde_json::to_string(&result).expect("Could not conve...
does this function always return value?
subtensor
github_2023
others
34
opentensor
eduardogr
@@ -1,37 +1,43 @@ -# This is an example build stage for the node subtensor. Here we create the binary in a temporary image. -# This is a base image to build substrate nodes -FROM docker.io/paritytech/ci-linux:production as builder +ARG BASE_IMAGE=ubuntu:20.04 -WORKDIR /node-subtensor +FROM $BASE_IMAGE as builder +S...
do we need git inside of the image?
subtensor
github_2023
others
34
opentensor
eduardogr
@@ -1,37 +1,43 @@ -# This is an example build stage for the node subtensor. Here we create the binary in a temporary image. -# This is a base image to build substrate nodes -FROM docker.io/paritytech/ci-linux:production as builder +ARG BASE_IMAGE=ubuntu:20.04 -WORKDIR /node-subtensor +FROM $BASE_IMAGE as builder +S...
i have a doubt here, is not the name of the stage what we have to reference here?? In our case will be `builder`, is this right?
subtensor
github_2023
others
34
opentensor
eduardogr
@@ -243,7 +244,9 @@ pub fn finney_config() -> Result<ChainSpec, String> { ) }, // Bootnodes - vec![], + vec![ + "/ip4/13.58.175.193/tcp/30333/p2p/12D3KooWEXY393DjTvBip3DnZeJkSAeZrg6edxqu45ywHzzQS2BY".parse().unwrap()
can we place this IP, and the node ID, somewhere that makes it clear for us that is something that could change? Some config file or constants files?
subtensor
github_2023
others
34
opentensor
eduardogr
@@ -1,17 +1,21 @@ version: "3.2" services: - dev: + node-subtensor: container_name: node-subtensor - image: paritytech/ci-linux:production - working_dir: /var/www/node-subtensor + image: opentensor/subtensor:latest + cpu_count: 2 + mem_limit: 4000000000 + memswap_limit: 8000000000 port...
There is a way to write the command in multiple lines for a docker compose file. I was looking for it, but I don't find it. I think will be nice to have it the command in multiple lines, it can make it easier to read
subtensor
github_2023
others
75
opentensor
shibshib
@@ -609,7 +609,6 @@ pub mod pallet { MaxAllowedUidsExceeded, // --- Thrown when number of accounts going to be registered exceed MaxAllowedUids for the network. TooManyUids, // ---- Thrown when the caller attempts to set weights with more uids than allowed. TxRateLimitExceeded, // --- Thrown when a transactor ...
I think @Rubberbandits is working on a sudo registration disabling mechanism, let's keep this enum for now.
subtensor
github_2023
others
89
opentensor
camfairchild
@@ -34,6 +34,6 @@ ServingRateLimit: u64 = 250; // [250 @ 7,166] Burn: u64 = 100_000_000_000; // 100 tao [100 tao @ 26310] MinBurn: u64 = 10_000_000_000; // 10 tao [10 tao @ 26310] MaxBurn: u64 = 21_000_000_000_000_000; // 21M tao [21M tao @ 26310] -TxRateLimit: u64 = 1000; +TxRateLimit: u64 = 50;
```suggestion TxRateLimit: u64 = 1; ``` I suggest lower to 1 or 2 until a different mechanism is in-place for staking/unstaking
subtensor
github_2023
others
93
opentensor
opentaco
@@ -32,7 +32,7 @@ MinDifficulty: u64 = 10_000_000; MaxDifficulty: u64 = u64::MAX / 4; ServingRateLimit: u64 = 250; // [250 @ 7,166] Burn: u64 = 100_000_000_000; // 100 tao [100 tao @ 26,310] -MinBurn: u64 = 10_000_000_000; // 10 tao [10 tao @ 26,310] +MinBurn: u64 = 1_000_000_000; // 1 tao [1 tao @ 26,310]
The idea is to keep the change history in the comment by appending the new change: ```rust MinBurn: u64 = 1_000_000_000; // 1 tao [10 tao @ 26,310] [1 tao @ set_block] ```
subtensor
github_2023
others
103
opentensor
isabella618033
@@ -34,46 +34,46 @@ ServingRateLimit: u64 = 250; // [250 @ 7,166] Burn: u64 = 100_000_000_000; // 100 tao [100 tao @ 26,310] MinBurn: u64 = 1_000_000_000; // 1 tao [1 tao @ 26,310] MaxBurn: u64 = 21_000_000_000_000_000; // 21M tao [21M tao @ 26,310] -TxRateLimit: u64 = 1; // [1 @ 64,888] +TxRateLimit: u64 = 1; // gl...
Are we sure we only want 2 validators on net 1?
subtensor
github_2023
others
80
opentensor
opentaco
@@ -113,6 +113,8 @@ pub mod pallet { type InitialMaxDifficulty: Get<u64>; #[pallet::constant] // Initial Min Difficulty. type InitialMinDifficulty: Get<u64>; + #[pallet::constant] // Initial adjustment interval.
Is the comment accurate here?
subtensor
github_2023
others
113
opentensor
eduardogr
@@ -1,3 +1,4 @@ +
needed extra line?
subtensor
github_2023
others
113
opentensor
eduardogr
@@ -66,19 +67,19 @@ fn test_remove_uid_for_network() { let netuid: u16 = 1; let tempo: u16 = 13; add_network(netuid, tempo, 0); - register_ok_neuron( 1, 55, 66, 0); + register_ok_neuron( 1, U256::from(55), U256::from(66), 0); let neuron_id ; - match SubtensorModule::get_uid_fo...
just a general idea for _potential_ modifications of the same value. If we encapsule this in a function the call this function `U256::from`, e.g: ```rust // take this as pseudocode please fn build_value(value:...) { ... return &U256::from(value) } ``` next changes will impact few lines and this beha...
subtensor
github_2023
others
113
opentensor
eduardogr
@@ -51,37 +51,37 @@ fn test_sudo_registration() { new_test_ext().execute_with(|| { add_network( 0, 0, 0 ); SubtensorModule::set_max_allowed_uids( 0, 10 ); - assert_ok!( SubtensorModule::sudo_register(<<Test as Config>::RuntimeOrigin>::root(), 0, 0, 0, 10, 11) ); - assert_ok!( Subtensor...
out of curiosity... why is this tabbed?
subtensor
github_2023
others
118
opentensor
S0AndS0
@@ -1581,7 +1581,8 @@ pub mod pallet { if Uids::<T>::contains_key( netuid, &hotkey ) { let uid = Self::get_uid_for_net_and_hotkey(netuid, &hotkey.clone()).unwrap(); let current_block_number: u64 = Self::get_current_block_as_u64(); - return current_block_number - Self::get_last_update_for_uid(netuid, ui...
Only bit that makes me pause is; what'll happen if `default_priority` somehow ends up greater than `u32::max_value()`, possible overflow panic? ... Though looking at the math the `current_block_number` would need to be _kinda_ high
subtensor
github_2023
others
133
opentensor
camfairchild
@@ -1536,42 +1536,11 @@ pub mod pallet { Self::do_set_total_issuance(origin, total_issuance) } - #[pallet::call_index(50)] + #[pallet::call_index(47)]
```suggestion #[pallet::call_index(50)] ``` We shouldn't change the call indices for existing calls
subtensor
github_2023
others
94
opentensor
S0AndS0
@@ -1555,7 +1556,15 @@ pub mod pallet { pub fn benchmark_drain_emission( _:OriginFor<T> ) -> DispatchResult { Self::drain_emission( 11 ); Ok(()) - } + } + + #[pallet::call_index(50)]
Mixing tabs and spaces?
subtensor
github_2023
others
119
opentensor
camfairchild
@@ -578,46 +578,46 @@ pub mod pallet { pub enum Error<T> { InvalidConnectionRequirement, // --- Thrown if we are attempting to create an invalid connection requirement. NetworkDoesNotExist, // --- Thrown when the network does not exist. - NetworkExist, // --- Thrown when the network already exist. + NetworkEx...
```suggestion MaxAllowedUidsExceeded, // --- Thrown when number of accounts going to be registered exceeds MaxAllowedUids for the network. ```
subtensor
github_2023
others
140
opentensor
camfairchild
@@ -1,13 +1,13 @@ [package] name = "node-subtensor-runtime" version = "4.0.0-dev" -description = "A fresh FRAME-based Substrate node, ready for hacking." -authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"] -homepage = "https://substrate.io/" +description = "Subtensor network" +authors = ["Op...
```suggestion homepage = "https://opentensor.ai/" ```
subtensor
github_2023
others
140
opentensor
camfairchild
@@ -1,13 +1,13 @@ [package] name = "node-subtensor-runtime" version = "4.0.0-dev" -description = "A fresh FRAME-based Substrate node, ready for hacking." -authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"] -homepage = "https://substrate.io/" +description = "Subtensor network" +authors = ["Op...
```suggestion authors = ["Opentensor Foundation <https://github.com/opentensor/>"] ```
subtensor
github_2023
others
116
opentensor
opentaco
@@ -0,0 +1,83 @@ +use super::*; +use log::{info}; +use frame_support::{ + traits::{Get, StorageVersion, GetStorageVersion}, + weights::Weight, storage_alias, + pallet_prelude::{ + Identity, OptionQuery + }, + inherent::Vec +}; + +// TODO (camfairchild): TEST MIGRATION + +const LOG_TARGET: &str = "loaded...
Where has `on_chain_storage_version()` been defined?
subtensor
github_2023
others
116
opentensor
opentaco
@@ -452,34 +480,58 @@ impl<T: Config> Pallet<T> { // ================================= // Compute normalized emission scores. range: I32F32(0, 1) - let mut normalized_emission: Vec<I32F32> = incentive.iter().zip( dividends.clone() ).map( |(ii, di)| ii + di ).collect(); - inplace_normal...
Rather `normalized_validator_emission = stake.clone();` which will reward those delegating stake as well, and not just the hotkey owner.
subtensor
github_2023
others
116
opentensor
SaMotlagh
@@ -617,4 +617,124 @@ pub fn test_sudo_test_pending_emission_ok() { assert_eq!(SubtensorModule::get_pending_emission(netuid1), 0); // emission drained at block 3 for tempo 5 assert_eq!(SubtensorModule::get_pending_emission(netuid2), 2250000000); // 750000000 + 750000000 + 750000000 }); +} + +#[te...
we have similar tests for setting emissions in tests/networks.rs. could be more organized to keep tests related to the networks in networks test file. not a big deal though :)
subtensor
github_2023
others
135
opentensor
S0AndS0
@@ -263,5 +274,20 @@ impl<T: Config> Pallet<T> { return true; } + pub fn validate_axon_data(axon_info: &AxonInfoOf) -> Result<bool, pallet::Error<T>> { + if axon_info.port <= 0 {
:warning: If the [internet][1] is to be believed, then the highest port supported by IPv4 addresses _should_ be `65_535` While it be true that `port` for `AxonInfo` is correctly defined as `u16` (`pallets/subtensor/src/lib.rs:319`) I'm not fully certain of how things will behave if someone feeds a larger number duri...
subtensor
github_2023
others
131
opentensor
S0AndS0
@@ -583,6 +583,298 @@ fn test_16384_graph_sparse() { }); } +// Test bonds exponential moving average over a sequence of epochs. +#[test] +fn test_bonds() { + new_test_ext().execute_with(|| { + let sparse: bool = true; + let n: u16 = 8;
What is `n`? > I see it being used as a limit for the `for` loop, and as a value for `max_allowed_validators` related stuff too
subtensor
github_2023
others
131
opentensor
S0AndS0
@@ -583,6 +583,298 @@ fn test_16384_graph_sparse() { }); } +// Test bonds exponential moving average over a sequence of epochs. +#[test] +fn test_bonds() { + new_test_ext().execute_with(|| { + let sparse: bool = true; + let n: u16 = 8; + let netuid: u16 = 0; + let tempo: u16 = u16::MAX - 1; // high tempo to s...
:question: Any way to have these new commented bits be asserted as true by tests?
subtensor
github_2023
others
127
opentensor
S0AndS0
@@ -15,15 +15,19 @@ use sp_core::crypto::Ss58Codec; // Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>; +// These functions are unused in production compiles, util functions for unit testing +#[allow(dead_cod...
Would it be possible to instead, or in addition, utilize [conditional compiler][1] trickery? ```rust #[cfg(not(release))] ``` [1]: https://doc.rust-lang.org/reference/conditional-compilation.html
subtensor
github_2023
others
125
opentensor
Rubberbandits
@@ -80,42 +81,42 @@ pub type Hash = sp_core::H256; // of data like extrinsics, allowing for them to continue syncing the network through upgrades // to even the core data structures. pub mod opaque { - use super::*; - - pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; - - // Opaque block header type. - pub...
spec_version needs to be +1 for chain upgrades
subtensor
github_2023
others
79
opentensor
eduardogr
@@ -0,0 +1,136 @@ +name: Rust build, benchmarks, and tests + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +## +on: + ## + # Run automatically for any push that changes Rust file(s) + push: + branches: + - main + - $default-branch + + paths: + - "**.rs" + + ## + # ...
can we enable this also for macos?? That would be great
subtensor
github_2023
others
79
opentensor
eduardogr
@@ -0,0 +1,136 @@ +name: Rust build, benchmarks, and tests + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +## +on: + ## + # Run automatically for any push that changes Rust file(s) + push: + branches: + - main + - $default-branch + + paths: + - "**.rs" + + ## + # ...
do we have a staging branch here?? I am not able to find it We don't use a staging branch in this repository, is that correct?
subtensor
github_2023
others
104
opentensor
eduardogr
@@ -0,0 +1,102 @@ +name: Rust build, benchmarks, and tests + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +## +on: + ## + # Run when a semantic version is tagged + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +## +# Environment variables shared for all targets +env: + CARGO_TERM...
what is this for? It is going to read from that file or to write the github release there aswell??
subtensor
github_2023
others
101
opentensor
S0AndS0
@@ -373,4 +374,23 @@ impl<T: Config> Pallet<T> { }; } + pub fn unstake_all_coldkeys_from_hotkey_account( hotkey: &T::AccountId ) { + // Iterate through all coldkeys that have a stake on this hotkey account. + for ( delegate_coldkey_i, stake_i ) in < Stake<T> as IterableStorageDoubleMap<...
The use of `stake_i_as_balance` here vs `stake_i` further on (at line `391` has be a bit concerned. > Also the order of operations may be better if reversed, though this could be my past JavaScript trauma talking here
subtensor
github_2023
others
101
opentensor
S0AndS0
@@ -993,3 +993,114 @@ fn test_full_with_delegating() { } +/************************************************************
:+1: I really appreciate the comments that break-up sections of tests!
subtensor
github_2023
others
16
opentensor
opentaco
@@ -2254,4 +2254,141 @@ mod tests { assert_vec_compare( &matmul( &w, &vec![ I32F32::from_num(2.0); 3] ), &vec![ I32F32::from_num(6), I32F32::from_num(12), I32F32::from_num(18)], epsilon ); } -} \ No newline at end of file + #[test] + fn test_math_fixed_to_u16() { + let expected = u16::MIN...
`fixed_to_u64` doesn't really appear to be used anywhere in the codebase, and the `I32F32` choice seems to have followed the previous fn templates, but should ideally be `I64F64`.