Skip to content

Commit ef17ae6

Browse files
committed
undo move epoch
1 parent b683362 commit ef17ae6

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

pallets/subtensor/src/coinbase/run_coinbase.rs

+46-46
Original file line numberDiff line numberDiff line change
@@ -100,52 +100,6 @@ impl<T: Config> Pallet<T> {
100100
log::debug!("alpha_in: {:?}", alpha_in);
101101
log::debug!("alpha_out: {:?}", alpha_out);
102102

103-
// --- 7. Drain pending emission through the subnet based on tempo.
104-
for &netuid in subnets.iter() {
105-
// Pass on subnets that have not reached their tempo.
106-
if Self::should_run_epoch(netuid, current_block) {
107-
if let Err(e) = Self::reveal_crv3_commits(netuid) {
108-
log::warn!(
109-
"Failed to reveal commits for subnet {} due to error: {:?}",
110-
netuid,
111-
e
112-
);
113-
};
114-
115-
// Restart counters.
116-
BlocksSinceLastStep::<T>::insert(netuid, 0);
117-
LastMechansimStepBlock::<T>::insert(netuid, current_block);
118-
119-
// Get and drain the subnet pending emission.
120-
let pending_alpha: u64 = PendingEmission::<T>::get(netuid);
121-
PendingEmission::<T>::insert(netuid, 0);
122-
123-
// Get and drain the subnet pending root divs.
124-
let pending_tao: u64 = PendingRootDivs::<T>::get(netuid);
125-
PendingRootDivs::<T>::insert(netuid, 0);
126-
127-
// Get this amount as alpha that was swapped for pending root divs.
128-
let pending_swapped: u64 = PendingAlphaSwapped::<T>::get(netuid);
129-
PendingAlphaSwapped::<T>::insert(netuid, 0);
130-
131-
// Get owner cut and drain.
132-
let owner_cut: u64 = PendingOwnerCut::<T>::get(netuid);
133-
PendingOwnerCut::<T>::insert(netuid, 0);
134-
135-
// Drain pending root divs, alpha emission, and owner cut.
136-
Self::drain_pending_emission(
137-
netuid,
138-
pending_alpha,
139-
pending_tao,
140-
pending_swapped,
141-
owner_cut,
142-
);
143-
} else {
144-
// Increment
145-
BlocksSinceLastStep::<T>::mutate(netuid, |total| *total = total.saturating_add(1));
146-
}
147-
}
148-
149103
// --- 4. Injection.
150104
// Actually perform the injection of alpha_in, alpha_out and tao_in into the subnet pool.
151105
// This operation changes the pool liquidity each block.
@@ -249,6 +203,52 @@ impl<T: Config> Pallet<T> {
249203
// Update moving prices after using them above.
250204
Self::update_moving_price(*netuid_i);
251205
}
206+
207+
// --- 7. Drain pending emission through the subnet based on tempo.
208+
for &netuid in subnets.iter() {
209+
// Pass on subnets that have not reached their tempo.
210+
if Self::should_run_epoch(netuid, current_block) {
211+
if let Err(e) = Self::reveal_crv3_commits(netuid) {
212+
log::warn!(
213+
"Failed to reveal commits for subnet {} due to error: {:?}",
214+
netuid,
215+
e
216+
);
217+
};
218+
219+
// Restart counters.
220+
BlocksSinceLastStep::<T>::insert(netuid, 0);
221+
LastMechansimStepBlock::<T>::insert(netuid, current_block);
222+
223+
// Get and drain the subnet pending emission.
224+
let pending_alpha: u64 = PendingEmission::<T>::get(netuid);
225+
PendingEmission::<T>::insert(netuid, 0);
226+
227+
// Get and drain the subnet pending root divs.
228+
let pending_tao: u64 = PendingRootDivs::<T>::get(netuid);
229+
PendingRootDivs::<T>::insert(netuid, 0);
230+
231+
// Get this amount as alpha that was swapped for pending root divs.
232+
let pending_swapped: u64 = PendingAlphaSwapped::<T>::get(netuid);
233+
PendingAlphaSwapped::<T>::insert(netuid, 0);
234+
235+
// Get owner cut and drain.
236+
let owner_cut: u64 = PendingOwnerCut::<T>::get(netuid);
237+
PendingOwnerCut::<T>::insert(netuid, 0);
238+
239+
// Drain pending root divs, alpha emission, and owner cut.
240+
Self::drain_pending_emission(
241+
netuid,
242+
pending_alpha,
243+
pending_tao,
244+
pending_swapped,
245+
owner_cut,
246+
);
247+
} else {
248+
// Increment
249+
BlocksSinceLastStep::<T>::mutate(netuid, |total| *total = total.saturating_add(1));
250+
}
251+
}
252252
}
253253

254254
pub fn drain_pending_emission(

0 commit comments

Comments
 (0)