Skip to content

Commit fdc4732

Browse files
committed
Commit missing merged files
1 parent 16bbbdb commit fdc4732

File tree

2 files changed

+1
-79
lines changed

2 files changed

+1
-79
lines changed

pallets/subtensor/src/root.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,7 @@ impl<T: Config> Pallet<T> {
643643

644644
// --- 2. Calculate and lock the required tokens.
645645
let lock_amount: u64 = Self::get_network_lock_cost();
646-
<<<<<<< HEAD
647-
=======
648646
log::debug!("network lock_amount: {:?}", lock_amount);
649-
>>>>>>> origin/development
650647
ensure!(
651648
Self::can_remove_balance_from_coldkey_account(&coldkey, lock_amount),
652649
Error::<T>::NotEnoughBalanceToStake

pallets/subtensor/src/staking.rs

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -141,53 +141,33 @@ impl<T: Config> Pallet<T> {
141141
stake_to_be_added
142142
);
143143

144-
<<<<<<< HEAD
145-
// --- 2. Ensure the callers coldkey has enough stake to perform the transaction.
146-
=======
147144
// Ensure the callers coldkey has enough stake to perform the transaction.
148-
>>>>>>> origin/development
149145
ensure!(
150146
Self::can_remove_balance_from_coldkey_account(&coldkey, stake_to_be_added),
151147
Error::<T>::NotEnoughBalanceToStake
152148
);
153149

154-
<<<<<<< HEAD
155-
// --- 3. Ensure that the hotkey account exists this is only possible through registration.
156-
=======
157150
// Ensure that the hotkey account exists this is only possible through registration.
158-
>>>>>>> origin/development
159151
ensure!(
160152
Self::hotkey_account_exists(&hotkey),
161153
Error::<T>::NotRegistered
162154
);
163155

164-
<<<<<<< HEAD
165-
// --- 4. Ensure that the hotkey allows delegation or that the hotkey is owned by the calling coldkey.
166-
=======
167156
// Ensure that the hotkey allows delegation or that the hotkey is owned by the calling coldkey.
168-
>>>>>>> origin/development
169157
ensure!(
170158
Self::hotkey_is_delegate(&hotkey) || Self::coldkey_owns_hotkey(&coldkey, &hotkey),
171159
Error::<T>::NonAssociatedColdKey
172160
);
173161

174-
<<<<<<< HEAD
175-
// --- 5. Ensure we don't exceed stake rate limit
176-
=======
177162
// Ensure we don't exceed stake rate limit
178-
>>>>>>> origin/development
179163
let stakes_this_interval =
180164
Self::get_stakes_this_interval_for_coldkey_hotkey(&coldkey, &hotkey);
181165
ensure!(
182166
stakes_this_interval < Self::get_target_stakes_per_interval(),
183167
Error::<T>::StakeRateLimitExceeded
184168
);
185169

186-
<<<<<<< HEAD
187-
// --- 6. If this is a nomination stake, check if total stake after adding will be above
188-
=======
189170
// If this is a nomination stake, check if total stake after adding will be above
190-
>>>>>>> origin/development
191171
// the minimum required stake.
192172

193173
// If coldkey is not owner of the hotkey, it's a nomination stake.
@@ -201,30 +181,18 @@ impl<T: Config> Pallet<T> {
201181
);
202182
}
203183

204-
<<<<<<< HEAD
205-
// --- 7. Ensure the remove operation from the coldkey is a success.
206-
let actual_amount_to_stake =
207-
Self::remove_balance_from_coldkey_account(&coldkey, stake_to_be_added)?;
208-
209-
// --- 8. If we reach here, add the balance to the hotkey.
210-
=======
211184
// Ensure the remove operation from the coldkey is a success.
212185
let actual_amount_to_stake =
213186
Self::remove_balance_from_coldkey_account(&coldkey, stake_to_be_added)?;
214187

215188
// If we reach here, add the balance to the hotkey.
216-
>>>>>>> origin/development
217189
Self::increase_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, actual_amount_to_stake);
218190

219191
// Set last block for rate limiting
220192
let block: u64 = Self::get_current_block_as_u64();
221193
Self::set_last_tx_block(&coldkey, block);
222194

223-
<<<<<<< HEAD
224-
// --- 9. Emit the staking event.
225-
=======
226195
// Emit the staking event.
227-
>>>>>>> origin/development
228196
Self::set_stakes_this_interval_for_coldkey_hotkey(
229197
&coldkey,
230198
&hotkey,
@@ -238,11 +206,7 @@ impl<T: Config> Pallet<T> {
238206
);
239207
Self::deposit_event(Event::StakeAdded(hotkey, actual_amount_to_stake));
240208

241-
<<<<<<< HEAD
242-
// --- 10. Ok and return.
243-
=======
244209
// Ok and return.
245-
>>>>>>> origin/development
246210
Ok(())
247211
}
248212

@@ -317,23 +281,15 @@ impl<T: Config> Pallet<T> {
317281
Error::<T>::NotEnoughStaketoWithdraw
318282
);
319283

320-
<<<<<<< HEAD
321-
// --- 5. Ensure we don't exceed stake rate limit
322-
=======
323284
// Ensure we don't exceed stake rate limit
324-
>>>>>>> origin/development
325285
let unstakes_this_interval =
326286
Self::get_stakes_this_interval_for_coldkey_hotkey(&coldkey, &hotkey);
327287
ensure!(
328288
unstakes_this_interval < Self::get_target_stakes_per_interval(),
329289
Error::<T>::UnstakeRateLimitExceeded
330290
);
331291

332-
<<<<<<< HEAD
333-
// --- 6. If this is a nomination stake, check if total stake after removing will be above
334-
=======
335292
// If this is a nomination stake, check if total stake after removing will be above
336-
>>>>>>> origin/development
337293
// the minimum required stake.
338294

339295
// If coldkey is not owner of the hotkey, it's a nomination stake.
@@ -347,28 +303,17 @@ impl<T: Config> Pallet<T> {
347303
);
348304
}
349305

350-
<<<<<<< HEAD
351-
// --- 7. We remove the balance from the hotkey.
352-
Self::decrease_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, stake_to_be_removed);
353-
354-
// --- 8. We add the balancer to the coldkey. If the above fails we will not credit this coldkey.
355-
=======
356306
// We remove the balance from the hotkey.
357307
Self::decrease_stake_on_coldkey_hotkey_account(&coldkey, &hotkey, stake_to_be_removed);
358308

359309
// We add the balancer to the coldkey. If the above fails we will not credit this coldkey.
360-
>>>>>>> origin/development
361310
Self::add_balance_to_coldkey_account(&coldkey, stake_to_be_removed);
362311

363312
// Set last block for rate limiting
364313
let block: u64 = Self::get_current_block_as_u64();
365314
Self::set_last_tx_block(&coldkey, block);
366315

367-
<<<<<<< HEAD
368-
// --- 9. Emit the unstaking event.
369-
=======
370316
// Emit the unstaking event.
371-
>>>>>>> origin/development
372317
Self::set_stakes_this_interval_for_coldkey_hotkey(
373318
&coldkey,
374319
&hotkey,
@@ -382,11 +327,7 @@ impl<T: Config> Pallet<T> {
382327
);
383328
Self::deposit_event(Event::StakeRemoved(hotkey, stake_to_be_removed));
384329

385-
<<<<<<< HEAD
386-
// --- 10. Done and ok.
387-
=======
388330
// Done and ok.
389-
>>>>>>> origin/development
390331
Ok(())
391332
}
392333

@@ -610,15 +551,9 @@ impl<T: Config> Pallet<T> {
610551
if stake < Self::get_nominator_min_required_stake() {
611552
// Remove the stake from the nominator account. (this is a more forceful unstake operation which )
612553
// Actually deletes the staking account.
613-
<<<<<<< HEAD
614-
Self::empty_stake_on_coldkey_hotkey_account(&coldkey, &hotkey);
615-
// Add the stake to the coldkey account.
616-
Self::add_balance_to_coldkey_account(&coldkey, stake);
617-
=======
618554
Self::empty_stake_on_coldkey_hotkey_account(coldkey, hotkey);
619-
// Convert the removed stake back to balance and add it to the coldkey account.
555+
// Add the stake to the coldkey account.
620556
Self::add_balance_to_coldkey_account(coldkey, stake);
621-
>>>>>>> origin/development
622557
}
623558
}
624559
}
@@ -705,7 +640,6 @@ impl<T: Config> Pallet<T> {
705640
hotkey,
706641
)
707642
{
708-
<<<<<<< HEAD
709643
// Remove the stake from the coldkey - hotkey pairing.
710644
Self::decrease_stake_on_coldkey_hotkey_account(
711645
&delegate_coldkey_i,
@@ -718,15 +652,6 @@ impl<T: Config> Pallet<T> {
718652
&delegate_coldkey_i,
719653
stake_i,
720654
);
721-
=======
722-
// Stake is successfully converted to balance.
723-
724-
// Remove the stake from the coldkey - hotkey pairing.
725-
Self::decrease_stake_on_coldkey_hotkey_account(&delegate_coldkey_i, hotkey, stake_i);
726-
727-
// Add the balance to the coldkey account.
728-
Self::add_balance_to_coldkey_account(&delegate_coldkey_i, stake_i);
729-
>>>>>>> origin/development
730655
}
731656
}
732657
}

0 commit comments

Comments
 (0)