Skip to content

Commit 5dbe102

Browse files
authored
Merge pull request #1991 from opentensor/not-support-commit-reveal-v3
not support commit reveal v3
2 parents a7904e0 + bdde256 commit 5dbe102

File tree

4 files changed

+2
-90
lines changed

4 files changed

+2
-90
lines changed

pallets/subtensor/src/benchmarks.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,38 +1066,6 @@ mod pallet_benchmarks {
10661066
);
10671067
}
10681068

1069-
#[benchmark]
1070-
fn commit_crv3_weights() {
1071-
let hotkey: T::AccountId = whitelisted_caller();
1072-
let netuid = NetUid::from(1);
1073-
let vec_commit: Vec<u8> = vec![0; MAX_CRV3_COMMIT_SIZE_BYTES as usize];
1074-
let commit: BoundedVec<_, _> = vec_commit.try_into().unwrap();
1075-
let round: u64 = 0;
1076-
1077-
Subtensor::<T>::init_new_network(netuid, 1);
1078-
Subtensor::<T>::set_network_pow_registration_allowed(netuid, true);
1079-
SubtokenEnabled::<T>::insert(netuid, true);
1080-
1081-
let reg_fee = Subtensor::<T>::get_burn(netuid);
1082-
Subtensor::<T>::add_balance_to_coldkey_account(&hotkey, reg_fee.to_u64().saturating_mul(2));
1083-
1084-
assert_ok!(Subtensor::<T>::burned_register(
1085-
RawOrigin::Signed(hotkey.clone()).into(),
1086-
netuid,
1087-
hotkey.clone()
1088-
));
1089-
1090-
Subtensor::<T>::set_commit_reveal_weights_enabled(netuid, true);
1091-
1092-
#[extrinsic_call]
1093-
_(
1094-
RawOrigin::Signed(hotkey.clone()),
1095-
netuid,
1096-
commit.clone(),
1097-
round,
1098-
);
1099-
}
1100-
11011069
#[benchmark]
11021070
fn decrease_take() {
11031071
let coldkey: T::AccountId = whitelisted_caller();

pallets/subtensor/src/macros/dispatches.rs

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -249,48 +249,6 @@ mod dispatches {
249249
Self::do_reveal_weights(origin, netuid, uids, values, salt, version_key)
250250
}
251251

252-
/// ---- Used to commit encrypted commit-reveal v3 weight values to later be revealed.
253-
///
254-
/// # Args:
255-
/// * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`):
256-
/// - The committing hotkey.
257-
///
258-
/// * `netuid` (`u16`):
259-
/// - The u16 network identifier.
260-
///
261-
/// * `commit` (`Vec<u8>`):
262-
/// - The encrypted compressed commit.
263-
/// The steps for this are:
264-
/// 1. Instantiate [`WeightsTlockPayload`]
265-
/// 2. Serialize it using the `parity_scale_codec::Encode` trait
266-
/// 3. Encrypt it following the steps (here)[https://github.com/ideal-lab5/tle/blob/f8e6019f0fb02c380ebfa6b30efb61786dede07b/timelock/src/tlock.rs#L283-L336]
267-
/// to produce a [`TLECiphertext<TinyBLS381>`] type.
268-
/// 4. Serialize and compress using the `ark-serialize` `CanonicalSerialize` trait.
269-
///
270-
/// * reveal_round (`u64`):
271-
/// - The drand reveal round which will be avaliable during epoch `n+1` from the current
272-
/// epoch.
273-
///
274-
/// # Raises:
275-
/// * `CommitRevealV3Disabled`:
276-
/// - Attempting to commit when the commit-reveal mechanism is disabled.
277-
///
278-
/// * `TooManyUnrevealedCommits`:
279-
/// - Attempting to commit when the user has more than the allowed limit of unrevealed commits.
280-
///
281-
#[pallet::call_index(99)]
282-
#[pallet::weight((Weight::from_parts(77_750_000, 0)
283-
.saturating_add(T::DbWeight::get().reads(7_u64))
284-
.saturating_add(T::DbWeight::get().writes(2)), DispatchClass::Normal, Pays::No))]
285-
pub fn commit_crv3_weights(
286-
origin: T::RuntimeOrigin,
287-
netuid: NetUid,
288-
commit: BoundedVec<u8, ConstU32<MAX_CRV3_COMMIT_SIZE_BYTES>>,
289-
reveal_round: u64,
290-
) -> DispatchResult {
291-
Self::do_commit_timelocked_weights(origin, netuid, commit, reveal_round, 4)
292-
}
293-
294252
/// ---- The implementation for batch revealing committed weights.
295253
///
296254
/// # Args:
@@ -803,7 +761,7 @@ mod dispatches {
803761

804762
/// Attempt to adjust the senate membership to include a hotkey
805763
#[pallet::call_index(63)]
806-
#[pallet::weight((Weight::from_parts(60_720_000, 0)
764+
#[pallet::weight((Weight::from_parts(75_430_000, 0)
807765
.saturating_add(T::DbWeight::get().reads(7))
808766
.saturating_add(T::DbWeight::get().writes(4)), DispatchClass::Normal, Pays::Yes))]
809767
pub fn adjust_senate(origin: OriginFor<T>, hotkey: T::AccountId) -> DispatchResult {

pallets/subtensor/src/transaction_extension.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,20 +223,6 @@ where
223223
Err(CustomTransactionError::StakeAmountTooLow.into())
224224
}
225225
}
226-
Some(Call::commit_crv3_weights {
227-
netuid,
228-
reveal_round,
229-
..
230-
}) => {
231-
if Self::check_weights_min_stake(who, *netuid) {
232-
if *reveal_round < pallet_drand::LastStoredRound::<T>::get() {
233-
return Err(CustomTransactionError::InvalidRevealRound.into());
234-
}
235-
Ok((Default::default(), Some(who.clone()), origin))
236-
} else {
237-
Err(CustomTransactionError::StakeAmountTooLow.into())
238-
}
239-
}
240226
Some(Call::commit_timelocked_weights {
241227
netuid,
242228
reveal_round,

runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
220220
// `spec_version`, and `authoring_version` are the same between Wasm and native.
221221
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
222222
// the compatible custom types.
223-
spec_version: 309,
223+
spec_version: 310,
224224
impl_version: 1,
225225
apis: RUNTIME_API_VERSIONS,
226226
transaction_version: 1,

0 commit comments

Comments
 (0)