Skip to content

Commit 654ee8b

Browse files
authored
Merge pull request #1488 from opentensor/add-missing-commit-reveal-events
Add Commit-Reveal Events
2 parents 8f1de13 + b6b4531 commit 654ee8b

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

pallets/subtensor/src/coinbase/run_coinbase.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,8 @@ impl<T: Config> Pallet<T> {
961961
e
962962
);
963963
continue;
964+
} else {
965+
Self::deposit_event(Event::CRV3WeightsRevealed(netuid, who));
964966
};
965967
}
966968

pallets/subtensor/src/macros/events.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,5 +293,23 @@ mod events {
293293
/// Parameters:
294294
/// (coldkey, hotkey, amount, subnet_id)
295295
AlphaBurned(T::AccountId, T::AccountId, u64, u16),
296+
297+
/// CRV3 Weights have been successfully revealed.
298+
///
299+
/// - **netuid**: The network identifier.
300+
/// - **who**: The account ID of the user revealing the weights.
301+
CRV3WeightsRevealed(u16, T::AccountId),
302+
303+
/// Commit-Reveal periods has been successfully set.
304+
///
305+
/// - **netuid**: The network identifier.
306+
/// - **periods**: The number of epochs before the reveal.
307+
CommitRevealPeriodsSet(u16, u64),
308+
309+
/// Commit-Reveal has been successfully toggled.
310+
///
311+
/// - **netuid**: The network identifier.
312+
/// - **Enabled**: Is Commit-Reveal enabled.
313+
CommitRevealEnabled(u16, bool),
296314
}
297315
}

pallets/subtensor/src/subnets/weights.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,7 @@ impl<T: Config> Pallet<T> {
10921092

10931093
pub fn set_reveal_period(netuid: u16, reveal_period: u64) {
10941094
RevealPeriodEpochs::<T>::insert(netuid, reveal_period);
1095+
Self::deposit_event(Event::CommitRevealPeriodsSet(netuid, reveal_period));
10951096
}
10961097
pub fn get_reveal_period(netuid: u16) -> u64 {
10971098
RevealPeriodEpochs::<T>::get(netuid)

pallets/subtensor/src/utils/misc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ impl<T: Config> Pallet<T> {
475475
}
476476
pub fn set_commit_reveal_weights_enabled(netuid: u16, enabled: bool) {
477477
CommitRevealWeightsEnabled::<T>::set(netuid, enabled);
478+
Self::deposit_event(Event::CommitRevealEnabled(netuid, enabled));
478479
}
479480

480481
pub fn get_rho(netuid: u16) -> u16 {

0 commit comments

Comments
 (0)