Skip to content

Testnet Tensor 1.0.1 Parameters #18

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 14, 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
23 changes: 16 additions & 7 deletions pallets/network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,8 @@ pub mod pallet {
// 9 days at 6s blocks
// 129_600

// Testnet && Local 24 blocks
25
// Testnet && Local 150 blocks ||| 15 minutes
150
}
#[pallet::type_value]
pub fn DefaultMaxSubnetRegistrationBlocks() -> u64 {
Expand Down Expand Up @@ -3211,6 +3211,10 @@ pub mod pallet {
start_epoch: epoch,
};

//
// TODO: Only use block for `last_delegate_reward_rate_update` if reward rate is > 0
//

let subnet_node: SubnetNode<T::AccountId> = SubnetNode {
hotkey: hotkey.clone(),
peer_id: peer_id.clone(),
Expand Down Expand Up @@ -3282,12 +3286,16 @@ pub mod pallet {
Err(()) => return Err(Error::<T>::SubnetNotExist.into()),
};

//
// TODO: Allow node to activate if already registered
//

// --- Subnet nodes can only register if within registration period or if it's activated
// --- Ensure the subnet outside of the enactment period or still registering
ensure!(
subnet.activated != 0 || subnet.activated == 0 && block <= subnet.initialized + subnet.registration_blocks,
Error::<T>::SubnetMustBeRegisteringOrActivated
);
// ensure!(
// subnet.activated != 0 || subnet.activated == 0 && block <= subnet.initialized + subnet.registration_blocks,
// Error::<T>::SubnetMustBeRegisteringOrActivated
// );

SubnetNodesData::<T>::try_mutate_exists(
subnet_id,
Expand All @@ -3313,9 +3321,10 @@ pub mod pallet {
// of other nodes that come in post activation
if subnet.activated == 0 {
class = SubnetNodeClass::Validator;
// --- Start node on current epoch for the next era
epoch_increase -= 1;
} else if params.classification.class == SubnetNodeClass::Deactivated {
// --- If coming out od deactivation, start back at Validator on the following epoch
// --- If coming out of deactivation, start back at Validator on the following epoch
class = SubnetNodeClass::Validator;
}

Expand Down
16 changes: 8 additions & 8 deletions pallets/network/src/tests/subnet_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,14 @@ fn test_activate_subnet_node_subnet_registering_or_activated_error() {

System::set_block_number(System::block_number() + registration_blocks + 1);

assert_err!(
Network::activate_subnet_node(
RuntimeOrigin::signed(account(0)),
subnet_id,
subnet_node_id,
),
Error::<Test>::SubnetMustBeRegisteringOrActivated
);
// assert_err!(
// Network::activate_subnet_node(
// RuntimeOrigin::signed(account(0)),
// subnet_id,
// subnet_node_id,
// ),
// Error::<Test>::SubnetMustBeRegisteringOrActivated
// );
})
}

Expand Down
14 changes: 14 additions & 0 deletions pallets/network/src/utilities/era.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ impl<T: Config> Pallet<T> {
let mut subnet_delegate_stake: Vec<(Vec<u8>, u128)> = Vec::new();

for (subnet_id, data) in subnets {

//
//
// TODO: Check Registration and Enactment period separately:
// Registration Period:
// - Can exist no matter what
// Enactment Period:
// - Once out of registration, if must have min nodes and min delegate stake.
// Out of Enactment Period:
// - Remove if not activated, althought should be automatically removed in Enactment if it didn't
// meet HT requirements.
// let max_registration_block = data.initialized + data.registration_blocks;
// let max_enactment_block = max_registration_block + subnet_activation_enactment_period;

// --- Ensure subnet is active is able to submit consensus
let max_registration_block = data.initialized + data.registration_blocks + subnet_activation_enactment_period;
if data.activated == 0 && block <= max_registration_block {
Expand Down
16,859 changes: 0 additions & 16,859 deletions tensorSpec.json

This file was deleted.

Loading
Loading