Activation

Every subnet must have a way for subnet nodes to activate on-chain using the Hypertensor extrinsic:

pub fn activate_subnet_node(
    origin: OriginFor<T>, 
    subnet_id: u32, 
)

For example, in the Hypertensor DSN standard, once a node is authenticated into the subnet by other peers and has done its required computations, such as loading the model transformer blocks, the node is then expected to activate itself using the CLI within the subnet.

After registering, the subnet node has up to the MaxSubnetNodeRegistrationEpochsto activate.

For example, in Python:

def activate_subnet_node(
  substrate: SubstrateInterface,
  keypair: Keypair,
  subnet_id: int,
) -> ExtrinsicReceipt:
  call = substrate.compose_call(
    call_module='Network',
    call_function='activate_subnet_node',
    call_params={
      'subnet_id': subnet_id,
    }
  )

  extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)

  @retry(wait=wait_exponential(multiplier=1, min=4, max=10), stop=stop_after_attempt(4))
  def submit_extrinsic():
    try:
      receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
      return receipt
    except SubstrateRequestException as e:
      print("Failed to send: {}".format(e))

  return submit_extrinsic()

Last updated