Skip to content
32 changes: 0 additions & 32 deletions pallets/subtensor/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,38 +1066,6 @@ mod pallet_benchmarks {
);
}

#[benchmark]
fn commit_crv3_weights() {
let hotkey: T::AccountId = whitelisted_caller();
let netuid = NetUid::from(1);
let vec_commit: Vec<u8> = vec![0; MAX_CRV3_COMMIT_SIZE_BYTES as usize];
let commit: BoundedVec<_, _> = vec_commit.try_into().unwrap();
let round: u64 = 0;

Subtensor::<T>::init_new_network(netuid, 1);
Subtensor::<T>::set_network_pow_registration_allowed(netuid, true);
SubtokenEnabled::<T>::insert(netuid, true);

let reg_fee = Subtensor::<T>::get_burn(netuid);
Subtensor::<T>::add_balance_to_coldkey_account(&hotkey, reg_fee.to_u64().saturating_mul(2));

assert_ok!(Subtensor::<T>::burned_register(
RawOrigin::Signed(hotkey.clone()).into(),
netuid,
hotkey.clone()
));

Subtensor::<T>::set_commit_reveal_weights_enabled(netuid, true);

#[extrinsic_call]
_(
RawOrigin::Signed(hotkey.clone()),
netuid,
commit.clone(),
round,
);
}

#[benchmark]
fn decrease_take() {
let coldkey: T::AccountId = whitelisted_caller();
Expand Down
44 changes: 1 addition & 43 deletions pallets/subtensor/src/macros/dispatches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,48 +249,6 @@ mod dispatches {
Self::do_reveal_weights(origin, netuid, uids, values, salt, version_key)
}

/// ---- Used to commit encrypted commit-reveal v3 weight values to later be revealed.
///
/// # Args:
/// * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`):
/// - The committing hotkey.
///
/// * `netuid` (`u16`):
/// - The u16 network identifier.
///
/// * `commit` (`Vec<u8>`):
/// - The encrypted compressed commit.
/// The steps for this are:
/// 1. Instantiate [`WeightsTlockPayload`]
/// 2. Serialize it using the `parity_scale_codec::Encode` trait
/// 3. Encrypt it following the steps (here)[https://github.com/ideal-lab5/tle/blob/f8e6019f0fb02c380ebfa6b30efb61786dede07b/timelock/src/tlock.rs#L283-L336]
/// to produce a [`TLECiphertext<TinyBLS381>`] type.
/// 4. Serialize and compress using the `ark-serialize` `CanonicalSerialize` trait.
///
/// * reveal_round (`u64`):
/// - The drand reveal round which will be avaliable during epoch `n+1` from the current
/// epoch.
///
/// # Raises:
/// * `CommitRevealV3Disabled`:
/// - Attempting to commit when the commit-reveal mechanism is disabled.
///
/// * `TooManyUnrevealedCommits`:
/// - Attempting to commit when the user has more than the allowed limit of unrevealed commits.
///
#[pallet::call_index(99)]
#[pallet::weight((Weight::from_parts(77_750_000, 0)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
pub fn commit_crv3_weights(
origin: T::RuntimeOrigin,
netuid: NetUid,
commit: BoundedVec<u8, ConstU32<MAX_CRV3_COMMIT_SIZE_BYTES>>,
reveal_round: u64,
) -> DispatchResult {
Self::do_commit_timelocked_weights(origin, netuid, commit, reveal_round, 4)
}

/// ---- The implementation for batch revealing committed weights.
///
/// # Args:
Expand Down Expand Up @@ -803,7 +761,7 @@ mod dispatches {

/// Attempt to adjust the senate membership to include a hotkey
#[pallet::call_index(63)]
#[pallet::weight((Weight::from_parts(60_720_000, 0)
#[pallet::weight((Weight::from_parts(75_430_000, 0)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4)), DispatchClass::Normal, Pays::Yes))]
pub fn adjust_senate(origin: OriginFor<T>, hotkey: T::AccountId) -> DispatchResult {
Expand Down
14 changes: 0 additions & 14 deletions pallets/subtensor/src/transaction_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,20 +223,6 @@ where
Err(CustomTransactionError::StakeAmountTooLow.into())
}
}
Some(Call::commit_crv3_weights {
netuid,
reveal_round,
..
}) => {
if Self::check_weights_min_stake(who, *netuid) {
if *reveal_round < pallet_drand::LastStoredRound::<T>::get() {
return Err(CustomTransactionError::InvalidRevealRound.into());
}
Ok((Default::default(), Some(who.clone()), origin))
} else {
Err(CustomTransactionError::StakeAmountTooLow.into())
}
}
Some(Call::commit_timelocked_weights {
netuid,
reveal_round,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 309,
spec_version: 310,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down