Skip to content

Commit

Permalink
wip todos
Browse files Browse the repository at this point in the history
  • Loading branch information
functor-flow committed Nov 18, 2024
1 parent b741103 commit 6100738
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
18 changes: 7 additions & 11 deletions pallets/subnet_emission/src/decryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,6 @@ impl<T: Config> Pallet<T> {
netuid
);

// // It is fine to insert the weights directly here as the subnet is obviously using
// weights // encryption, we do not need to bother with additional checks. these
// weights are primarily // just stored for consistency between subnets that use the
// weight encryption and those // that do not
// if let Some((_, weights)) = valid_weights.iter().max_by_key(|&(key, _)| key) {
// for &(uid, ref weights) in weights {
// Weights::<T>::set(netuid, uid, Some(weights.clone()));
// }
// }

Self::update_decrypted_weights(netuid, valid_weights);
match Self::process_decrypted_weights(netuid) {
Ok(()) => {
Expand Down Expand Up @@ -406,6 +396,9 @@ impl<T: Config> Pallet<T> {
}

pub fn cancel_expired_offchain_workers(block_number: u64) {
// TODO: make sure that this is the boundry even for the subnet owner
// / the offchain worker has max lenght this exact interval present in the
// `is_copying_irrational` otherwise we could run into race conditions
let max_inactivity_blocks =
T::PingInterval::get().saturating_mul(T::MaxFailedPings::get() as u64);

Expand All @@ -420,7 +413,10 @@ impl<T: Config> Pallet<T> {
.filter(|(_, info)| {
block_number.saturating_sub(info.last_keep_alive) > max_inactivity_blocks
|| block_number.saturating_sub(info.block_assigned)
> T::MaxEncryptionDuration::get().saturating_add(100)
> T::MaxEncryptionDuration::get().saturating_add(100) // TODO: the buffer
// has to be a
// constant defined in
// the runtime
})
.for_each(|(subnet_id, info)| Self::cancel_offchain_worker(subnet_id, &info));
}
Expand Down
6 changes: 0 additions & 6 deletions pallets/subnet_emission/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ pub mod types;
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;

// #[cfg(feature = "testnet")]
// const VERSION_NUMBER: u16 = 12;
// #[cfg(not(feature = "testnet"))]
// const VERSION_NUMBER: u16 = 0;

#[frame_support::pallet]
pub mod pallet {
use crate::{subnet_consensus::util::params::ConsensusParams, *};
Expand All @@ -41,7 +36,6 @@ pub mod pallet {
sp_runtime::SaturatedConversion,
storage::with_storage_layer,
traits::{ConstU64, Currency},
// Identity,
};
use frame_system::pallet_prelude::BlockNumberFor;
use pallet_subnet_emission_api::SubnetConsensus;
Expand Down

0 comments on commit 6100738

Please sign in to comment.