Skip to content

Add Commit-Reveal Events #1488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pallets/subtensor/src/coinbase/run_coinbase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,8 @@ impl<T: Config> Pallet<T> {
e
);
continue;
} else {
Self::deposit_event(Event::CRV3WeightsRevealed(netuid, who));
};
}

Expand Down
18 changes: 18 additions & 0 deletions pallets/subtensor/src/macros/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,5 +293,23 @@ mod events {
/// Parameters:
/// (coldkey, hotkey, amount, subnet_id)
AlphaBurned(T::AccountId, T::AccountId, u64, u16),

/// CRV3 Weights have been successfully revealed.
///
/// - **netuid**: The network identifier.
/// - **who**: The account ID of the user revealing the weights.
CRV3WeightsRevealed(u16, T::AccountId),

/// Commit-Reveal periods has been successfully set.
///
/// - **netuid**: The network identifier.
/// - **periods**: The number of epochs before the reveal.
CommitRevealPeriodsSet(u16, u64),

/// Commit-Reveal has been successfully toggled.
///
/// - **netuid**: The network identifier.
/// - **Enabled**: Is Commit-Reveal enabled.
CommitRevealEnabled(u16, bool),
}
}
1 change: 1 addition & 0 deletions pallets/subtensor/src/subnets/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,7 @@ impl<T: Config> Pallet<T> {

pub fn set_reveal_period(netuid: u16, reveal_period: u64) {
RevealPeriodEpochs::<T>::insert(netuid, reveal_period);
Self::deposit_event(Event::CommitRevealPeriodsSet(netuid, reveal_period));
}
pub fn get_reveal_period(netuid: u16) -> u64 {
RevealPeriodEpochs::<T>::get(netuid)
Expand Down
1 change: 1 addition & 0 deletions pallets/subtensor/src/utils/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ impl<T: Config> Pallet<T> {
}
pub fn set_commit_reveal_weights_enabled(netuid: u16, enabled: bool) {
CommitRevealWeightsEnabled::<T>::set(netuid, enabled);
Self::deposit_event(Event::CommitRevealEnabled(netuid, enabled));
}

pub fn get_rho(netuid: u16) -> u16 {
Expand Down
Loading