bittensor.utils.axon_utils#

Attributes#

Functions#

allowed_nonce_window_ns(current_time_ns, synapse_timeout)

Calculates the allowed window for a nonce in nanoseconds.

calculate_diff_seconds(current_time, synapse_timeout, ...)

Calculates the difference in seconds between the current time and the synapse nonce,

Module Contents#

bittensor.utils.axon_utils.ALLOWED_DELTA = 4000000000#
bittensor.utils.axon_utils.NANOSECONDS_IN_SECOND = 1000000000#
bittensor.utils.axon_utils.allowed_nonce_window_ns(current_time_ns, synapse_timeout)[source]#

Calculates the allowed window for a nonce in nanoseconds.

Parameters:
  • current_time_ns (int) – The current time in nanoseconds.

  • synapse_timeout (Optional[float]) – The optional timeout for the synapse in seconds. If None, it defaults to 0.

Returns:

The allowed nonce window in nanoseconds.

Return type:

int

bittensor.utils.axon_utils.calculate_diff_seconds(current_time, synapse_timeout, synapse_nonce)[source]#

Calculates the difference in seconds between the current time and the synapse nonce, and also returns the allowed delta in seconds.

Parameters:
  • current_time (int) – The current time in nanoseconds.

  • synapse_timeout (Optional[float]) – The optional timeout for the synapse in seconds.

  • synapse_nonce (int) – The nonce value for the synapse in nanoseconds.

Returns:

A tuple containing the difference in seconds (float) and the allowed delta in seconds (float).

Return type:

tuple