From 6100738f559d8bf004ef617160446f92d9b7f6b3 Mon Sep 17 00:00:00 2001 From: Honza <115138297+Supremesource@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:15:58 -0300 Subject: [PATCH] wip todos --- pallets/subnet_emission/src/decryption.rs | 18 +++++++----------- pallets/subnet_emission/src/lib.rs | 6 ------ 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/pallets/subnet_emission/src/decryption.rs b/pallets/subnet_emission/src/decryption.rs index 2039e242a..eb7984e8a 100644 --- a/pallets/subnet_emission/src/decryption.rs +++ b/pallets/subnet_emission/src/decryption.rs @@ -136,16 +136,6 @@ impl Pallet { 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::::set(netuid, uid, Some(weights.clone())); - // } - // } - Self::update_decrypted_weights(netuid, valid_weights); match Self::process_decrypted_weights(netuid) { Ok(()) => { @@ -406,6 +396,9 @@ impl Pallet { } 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); @@ -420,7 +413,10 @@ impl Pallet { .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)); } diff --git a/pallets/subnet_emission/src/lib.rs b/pallets/subnet_emission/src/lib.rs index 351f5f574..452c38683 100644 --- a/pallets/subnet_emission/src/lib.rs +++ b/pallets/subnet_emission/src/lib.rs @@ -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, *}; @@ -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;