bittensor.core.chain_data.coldkey_swap#
Classes#
Information about a coldkey swap announcement. |
|
Represents runtime constants for coldkey swap operations in the SubtensorModule. |
|
Information about a coldkey swap dispute. |
Module Contents#
- class bittensor.core.chain_data.coldkey_swap.ColdkeySwapAnnouncementInfo#
Information about a coldkey swap announcement.
This class contains information about a pending coldkey swap announcement. Announcements are used when a coldkey wants to declare its intention to swap to a new coldkey address. The announcement must be made before the actual swap can be executed, allowing time for verification and security checks.
- Variables:
coldkey – The SS58 address of the coldkey that made the announcement.
execution_block – The block number when the swap can be executed (after the delay period has passed).
new_coldkey_hash – The BlakeTwo256 hash of the new coldkey AccountId (hex string with 0x prefix). This hash must match the actual new coldkey when the swap is executed.
Notes
The announcement is stored on-chain and can be queried via get_coldkey_swap_announcement().
After making an announcement, all transactions from coldkey are blocked except for swap_coldkey_announced.
The swap can only be executed after the execution_block has been reached.
- classmethod from_query(coldkey_ss58, query)#
Creates a ColdkeySwapAnnouncementInfo object from a Substrate query result.
- Parameters:
coldkey_ss58 (str) – The SS58 address of the coldkey that made the announcement.
query (scalecodec.base.ScaleType) – Query result from Substrate query() call to ColdkeySwapAnnouncements storage function.
- Returns:
ColdkeySwapAnnouncementInfo if announcement exists, None otherwise.
- Return type:
Optional[ColdkeySwapAnnouncementInfo]
- classmethod from_record(record)#
Creates a ColdkeySwapAnnouncementInfo object from a query_map record.
- Parameters:
record (tuple) – Data item from query_map records call to ColdkeySwapAnnouncements storage function. Structure is [key, value] where key is the coldkey AccountId and value contains (BlockNumber, Hash) tuple.
- Returns:
ColdkeySwapAnnouncementInfo object with announcement details for the coldkey from the record.
- Return type:
- class bittensor.core.chain_data.coldkey_swap.ColdkeySwapConstants#
Represents runtime constants for coldkey swap operations in the SubtensorModule.
This class contains runtime constants that define cost requirements for coldkey swap operations. Note: For delay values (ColdkeySwapAnnouncementDelay and ColdkeySwapReannouncementDelay), use the dedicated query methods get_coldkey_swap_announcement_delay() and get_coldkey_swap_reannouncement_delay() instead, as these are storage values, not runtime constants.
- Variables:
KeySwapCost – The cost in RAO required to make a coldkey swap announcement. This cost is charged when making the first announcement (not when reannouncing). This is a runtime constant (queryable via constants).
Notes
All amounts are in RAO.
Values reflect the current chain configuration at the time of retrieval.
- classmethod constants_names()#
Returns the list of all constant field names defined in this dataclass.
- classmethod from_dict(data)#
Creates a ColdkeySwapConstants instance from a dictionary of decoded chain constants.
- Parameters:
data (dict) – Dictionary mapping constant names to their decoded values (returned by Subtensor.query_constant()).
- Returns:
ColdkeySwapConstants object with constants filled in. Fields not found in data will be set to None.
- Return type:
- class bittensor.core.chain_data.coldkey_swap.ColdkeySwapDisputeInfo#
Information about a coldkey swap dispute.
This class contains information about a disputed coldkey swap. When a coldkey swap is disputed, the account is frozen until the triumvirate resolves it via a root-only reset.
- Variables:
coldkey – The SS58 address of the coldkey that was disputed.
disputed_block – The block number when the dispute was recorded.
Notes
The dispute is stored on-chain in ColdkeySwapDisputes storage.
While disputed, the coldkey can only perform announce_coldkey_swap, swap_coldkey_announced, or dispute_coldkey_swap (or MEV-protected calls).
- classmethod from_query(coldkey_ss58, query)#
Creates a ColdkeySwapDisputeInfo object from a Substrate query result.
- Parameters:
coldkey_ss58 (str) – The SS58 address of the coldkey that was disputed.
query (scalecodec.base.ScaleType) – Query result from Substrate query() call to ColdkeySwapDisputes storage function.
- Returns:
ColdkeySwapDisputeInfo if dispute exists, None otherwise.
- Return type:
Optional[ColdkeySwapDisputeInfo]
- classmethod from_record(record)#
Creates a ColdkeySwapDisputeInfo object from a query_map record.
- Parameters:
record (tuple[str, int]) – Data item from query_map records call to ColdkeySwapDisputes storage function. Structure is [key, value] where key is the coldkey AccountId and value is the disputed block number.
- Returns:
ColdkeySwapDisputeInfo object with dispute details for the coldkey from the record.
- Return type: