Skip to content

Commit 8d9cde5

Browse files
authored
Merge pull request #1724 from opentensor/clean-up-obsolete-code
Remove obsolete code
2 parents 548f984 + ca0dd6f commit 8d9cde5

File tree

8 files changed

+0
-3018
lines changed

8 files changed

+0
-3018
lines changed

pallets/subtensor/src/benchmarks.rs

Lines changed: 0 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -156,174 +156,6 @@ mod pallet_benchmarks {
156156
);
157157
}
158158

159-
// #[benchmark]
160-
// fn add_stake_aggregate() {
161-
// let netuid: u16 = 1;
162-
// let tempo: u16 = 1;
163-
//
164-
// Subtensor::<T>::init_new_network(netuid, tempo);
165-
// SubtokenEnabled::<T>::insert(netuid, true);
166-
// Subtensor::<T>::set_burn(netuid, 1);
167-
// Subtensor::<T>::set_network_registration_allowed(netuid, true);
168-
// Subtensor::<T>::set_max_allowed_uids(netuid, 4096);
169-
//
170-
// let seed: u32 = 1;
171-
// let coldkey: T::AccountId = account("Test", 0, seed);
172-
// let hotkey: T::AccountId = account("Alice", 0, seed);
173-
// let total_stake: u64 = 1_000_000_000;
174-
// let amount: u64 = 600_000;
175-
//
176-
// Subtensor::<T>::add_balance_to_coldkey_account(&coldkey, total_stake);
177-
// assert_ok!(Subtensor::<T>::do_burned_registration(
178-
// RawOrigin::Signed(coldkey.clone()).into(),
179-
// netuid,
180-
// hotkey.clone()
181-
// ));
182-
//
183-
// #[extrinsic_call]
184-
// _(
185-
// RawOrigin::Signed(coldkey.clone()),
186-
// hotkey.clone(),
187-
// netuid,
188-
// amount,
189-
// );
190-
// }
191-
//
192-
// #[benchmark]
193-
// fn remove_stake_limit_aggregate() {
194-
// let netuid: u16 = 1;
195-
//
196-
// Subtensor::<T>::increase_total_stake(1_000_000_000_000);
197-
// Subtensor::<T>::init_new_network(netuid, 1);
198-
// Subtensor::<T>::set_network_registration_allowed(netuid, true);
199-
// SubtokenEnabled::<T>::insert(netuid, true);
200-
// Subtensor::<T>::set_max_allowed_uids(netuid, 4096);
201-
//
202-
// let seed: u32 = 1;
203-
// let coldkey: T::AccountId = account("Test", 0, seed);
204-
// let hotkey: T::AccountId = account("Alice", 0, seed);
205-
// Subtensor::<T>::set_burn(netuid, 1);
206-
//
207-
// let limit: u64 = 1_000_000_000;
208-
// let tao_reserve: u64 = 150_000_000_000;
209-
// let alpha_in: u64 = 100_000_000_000;
210-
// SubnetTAO::<T>::insert(netuid, tao_reserve);
211-
// SubnetAlphaIn::<T>::insert(netuid, alpha_in);
212-
//
213-
// let wallet_bal: u64 = 1_000_000;
214-
// Subtensor::<T>::add_balance_to_coldkey_account(&coldkey, wallet_bal);
215-
//
216-
// assert_ok!(Subtensor::<T>::do_burned_registration(
217-
// RawOrigin::Signed(coldkey.clone()).into(),
218-
// netuid,
219-
// hotkey.clone()
220-
// ));
221-
//
222-
// Subtensor::<T>::add_balance_to_coldkey_account(&coldkey, 100_000_000_000u64);
223-
// assert_ok!(Subtensor::<T>::add_stake(
224-
// RawOrigin::Signed(coldkey.clone()).into(),
225-
// hotkey.clone(),
226-
// netuid,
227-
// 100_000_000_000u64
228-
// ));
229-
//
230-
// let amount_unstaked: u64 = 30_000_000_000;
231-
//
232-
// #[extrinsic_call]
233-
// _(
234-
// RawOrigin::Signed(coldkey.clone()),
235-
// hotkey.clone(),
236-
// netuid,
237-
// amount_unstaked,
238-
// limit,
239-
// false,
240-
// );
241-
// }
242-
//
243-
// #[benchmark]
244-
// fn remove_stake_aggregate() {
245-
// let netuid: u16 = 1;
246-
//
247-
// Subtensor::<T>::increase_total_stake(1_000_000_000_000);
248-
// Subtensor::<T>::init_new_network(netuid, 1);
249-
// Subtensor::<T>::set_network_registration_allowed(netuid, true);
250-
// SubtokenEnabled::<T>::insert(netuid, true);
251-
// Subtensor::<T>::set_max_allowed_uids(netuid, 4096);
252-
//
253-
// let seed: u32 = 1;
254-
// let coldkey: T::AccountId = account("Test", 0, seed);
255-
// let hotkey: T::AccountId = account("Alice", 0, seed);
256-
// Subtensor::<T>::set_burn(netuid, 1);
257-
//
258-
// let wallet_bal: u64 = 1_000_000;
259-
// Subtensor::<T>::add_balance_to_coldkey_account(&coldkey, wallet_bal);
260-
//
261-
// assert_ok!(Subtensor::<T>::do_burned_registration(
262-
// RawOrigin::Signed(coldkey.clone()).into(),
263-
// netuid,
264-
// hotkey.clone()
265-
// ));
266-
//
267-
// Subtensor::<T>::add_balance_to_coldkey_account(&coldkey, 100_000_000_000u64);
268-
// assert_ok!(Subtensor::<T>::add_stake(
269-
// RawOrigin::Signed(coldkey.clone()).into(),
270-
// hotkey.clone(),
271-
// netuid,
272-
// 100_000_000_000u64
273-
// ));
274-
//
275-
// let amount_unstaked: u64 = 600_000;
276-
//
277-
// #[extrinsic_call]
278-
// _(
279-
// RawOrigin::Signed(coldkey.clone()),
280-
// hotkey.clone(),
281-
// netuid,
282-
// amount_unstaked,
283-
// );
284-
// }
285-
//
286-
// #[benchmark]
287-
// fn add_stake_limit_aggregate() {
288-
// let netuid: u16 = 1;
289-
//
290-
// Subtensor::<T>::init_new_network(netuid, 1);
291-
// SubtokenEnabled::<T>::insert(netuid, true);
292-
// Subtensor::<T>::set_burn(netuid, 1);
293-
// Subtensor::<T>::set_network_registration_allowed(netuid, true);
294-
// Subtensor::<T>::set_max_allowed_uids(netuid, 4096);
295-
//
296-
// let seed: u32 = 1;
297-
// let coldkey: T::AccountId = account("Test", 0, seed);
298-
// let hotkey: T::AccountId = account("Alice", 0, seed);
299-
//
300-
// let amount: u64 = 900_000_000_000;
301-
// let limit: u64 = 6_000_000_000;
302-
// let stake_amt: u64 = 440_000_000_000;
303-
// Subtensor::<T>::add_balance_to_coldkey_account(&coldkey, amount);
304-
//
305-
// let tao_reserve: u64 = 150_000_000_000;
306-
// let alpha_in: u64 = 100_000_000_000;
307-
// SubnetTAO::<T>::insert(netuid, tao_reserve);
308-
// SubnetAlphaIn::<T>::insert(netuid, alpha_in);
309-
//
310-
// assert_ok!(Subtensor::<T>::do_burned_registration(
311-
// RawOrigin::Signed(coldkey.clone()).into(),
312-
// netuid,
313-
// hotkey.clone()
314-
// ));
315-
//
316-
// #[extrinsic_call]
317-
// _(
318-
// RawOrigin::Signed(coldkey.clone()),
319-
// hotkey.clone(),
320-
// netuid,
321-
// stake_amt,
322-
// limit,
323-
// false,
324-
// );
325-
// }
326-
327159
#[benchmark]
328160
fn serve_axon() {
329161
let netuid: u16 = 1;

pallets/subtensor/src/lib.rs

Lines changed: 0 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -270,79 +270,6 @@ pub mod pallet {
270270
pub additional: Vec<u8>,
271271
}
272272

273-
/// Data structure for stake related jobs.
274-
#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Debug)]
275-
pub enum StakeJob<AccountId> {
276-
/// Represents a job for "add_stake" operation
277-
AddStake {
278-
/// Hotkey account
279-
hotkey: AccountId,
280-
/// Coldkey account
281-
coldkey: AccountId,
282-
/// Subnet ID
283-
netuid: u16,
284-
/// The amount of stake to be added to the hotkey staking account.
285-
stake_to_be_added: u64,
286-
},
287-
/// Represents a job for "remove_stake" operation
288-
RemoveStake {
289-
/// Hotkey account
290-
hotkey: AccountId,
291-
/// Coldkey account
292-
coldkey: AccountId,
293-
/// Subnet ID
294-
netuid: u16,
295-
/// Alpha value
296-
alpha_unstaked: u64,
297-
},
298-
/// Represents a job for "add_stake_limit" operation
299-
AddStakeLimit {
300-
/// Coldkey account
301-
coldkey: AccountId,
302-
/// Hotkey account
303-
hotkey: AccountId,
304-
/// Subnet ID
305-
netuid: u16,
306-
/// The amount of stake to be added to the hotkey staking account.
307-
stake_to_be_added: u64,
308-
/// The limit price expressed in units of RAO per one Alpha.
309-
limit_price: u64,
310-
/// Allows partial execution of the amount. If set to false, this becomes
311-
/// fill or kill type or order.
312-
allow_partial: bool,
313-
},
314-
/// Represents a job for "remove_stake_limit" operation
315-
RemoveStakeLimit {
316-
/// Coldkey account
317-
coldkey: AccountId,
318-
/// Hotkey account
319-
hotkey: AccountId,
320-
/// Subnet ID
321-
netuid: u16,
322-
/// The amount of stake to be added to the hotkey staking account.
323-
alpha_unstaked: u64,
324-
/// The limit price
325-
limit_price: u64,
326-
/// Allows partial execution of the amount. If set to false, this becomes
327-
/// fill or kill type or order.
328-
allow_partial: bool,
329-
},
330-
/// Represents a job for "unstake_all" operation
331-
UnstakeAll {
332-
/// Coldkey account
333-
coldkey: AccountId,
334-
/// Hotkey account
335-
hotkey: AccountId,
336-
},
337-
/// Represents a job for "unstake_all_alpha" operation
338-
UnstakeAllAlpha {
339-
/// Coldkey account
340-
coldkey: AccountId,
341-
/// Hotkey account
342-
hotkey: AccountId,
343-
},
344-
}
345-
346273
/// ============================
347274
/// ==== Staking + Accounts ====
348275
/// ============================
@@ -929,17 +856,6 @@ pub mod pallet {
929856
pub type SenateRequiredStakePercentage<T> =
930857
StorageValue<_, u64, ValueQuery, DefaultSenateRequiredStakePercentage<T>>;
931858

932-
#[pallet::storage]
933-
pub type StakeJobs<T: Config> = StorageDoubleMap<
934-
_,
935-
Blake2_128Concat,
936-
BlockNumberFor<T>, // first key: current block number
937-
Twox64Concat,
938-
u64, // second key: unique job ID
939-
StakeJob<T::AccountId>,
940-
OptionQuery,
941-
>;
942-
943859
#[pallet::storage]
944860
/// --- DMap ( netuid, coldkey ) --> blocknumber | last hotkey swap on network.
945861
pub type LastHotkeySwapOnNetuid<T: Config> = StorageDoubleMap<
@@ -2207,112 +2123,6 @@ where
22072123
Self::get_priority_staking(who, hotkey, *amount_unstaked),
22082124
)
22092125
}
2210-
// Some(Call::add_stake_aggregate {
2211-
// hotkey,
2212-
// netuid,
2213-
// amount_staked,
2214-
// }) => {
2215-
// if ColdkeySwapScheduled::<T>::contains_key(who) {
2216-
// return InvalidTransaction::Custom(
2217-
// CustomTransactionError::ColdkeyInSwapSchedule.into(),
2218-
// )
2219-
// .into();
2220-
// }
2221-
// // Fully validate the user input
2222-
// Self::result_to_validity(
2223-
// Pallet::<T>::validate_add_stake(
2224-
// who,
2225-
// hotkey,
2226-
// *netuid,
2227-
// *amount_staked,
2228-
// *amount_staked,
2229-
// false,
2230-
// ),
2231-
// Self::get_priority_staking(who, hotkey, *amount_staked),
2232-
// )
2233-
// }
2234-
// Some(Call::add_stake_limit_aggregate {
2235-
// hotkey,
2236-
// netuid,
2237-
// amount_staked,
2238-
// limit_price,
2239-
// allow_partial,
2240-
// }) => {
2241-
// if ColdkeySwapScheduled::<T>::contains_key(who) {
2242-
// return InvalidTransaction::Custom(
2243-
// CustomTransactionError::ColdkeyInSwapSchedule.into(),
2244-
// )
2245-
// .into();
2246-
// }
2247-
//
2248-
// // Calculate the maximum amount that can be executed with price limit
2249-
// let Ok(max_amount) = Pallet::<T>::get_max_amount_add(*netuid, *limit_price) else {
2250-
// return InvalidTransaction::Custom(
2251-
// CustomTransactionError::ZeroMaxAmount.into(),
2252-
// )
2253-
// .into();
2254-
// };
2255-
//
2256-
// // Fully validate the user input
2257-
// Self::result_to_validity(
2258-
// Pallet::<T>::validate_add_stake(
2259-
// who,
2260-
// hotkey,
2261-
// *netuid,
2262-
// *amount_staked,
2263-
// max_amount,
2264-
// *allow_partial,
2265-
// ),
2266-
// Self::get_priority_staking(who, hotkey, *amount_staked),
2267-
// )
2268-
// }
2269-
// Some(Call::remove_stake_aggregate {
2270-
// hotkey,
2271-
// netuid,
2272-
// amount_unstaked,
2273-
// }) => {
2274-
// // Fully validate the user input
2275-
// Self::result_to_validity(
2276-
// Pallet::<T>::validate_remove_stake(
2277-
// who,
2278-
// hotkey,
2279-
// *netuid,
2280-
// *amount_unstaked,
2281-
// *amount_unstaked,
2282-
// false,
2283-
// ),
2284-
// Self::get_priority_staking(who, hotkey, *amount_unstaked),
2285-
// )
2286-
// }
2287-
// Some(Call::remove_stake_limit_aggregate {
2288-
// hotkey,
2289-
// netuid,
2290-
// amount_unstaked,
2291-
// limit_price,
2292-
// allow_partial,
2293-
// }) => {
2294-
// // Calculate the maximum amount that can be executed with price limit
2295-
// let Ok(max_amount) = Pallet::<T>::get_max_amount_remove(*netuid, *limit_price)
2296-
// else {
2297-
// return InvalidTransaction::Custom(
2298-
// CustomTransactionError::ZeroMaxAmount.into(),
2299-
// )
2300-
// .into();
2301-
// };
2302-
//
2303-
// // Fully validate the user input
2304-
// Self::result_to_validity(
2305-
// Pallet::<T>::validate_remove_stake(
2306-
// who,
2307-
// hotkey,
2308-
// *netuid,
2309-
// *amount_unstaked,
2310-
// max_amount,
2311-
// *allow_partial,
2312-
// ),
2313-
// Self::get_priority_staking(who, hotkey, *amount_unstaked),
2314-
// )
2315-
// }
23162126
Some(Call::unstake_all { hotkey }) => {
23172127
// Fully validate the user input
23182128
Self::result_to_validity(

0 commit comments

Comments
 (0)