Skip to content

Commit

Permalink
Merge pull request #28 from cybercongress/setting-subnet-metadata
Browse files Browse the repository at this point in the history
Add setting a subnet metadata (particle)
  • Loading branch information
Snedashkovsky authored Jun 13, 2024
2 parents 57fb4ae + 140c27f commit d52fe51
Show file tree
Hide file tree
Showing 10 changed files with 305 additions and 42 deletions.
21 changes: 18 additions & 3 deletions cybertensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
nest_asyncio.apply()

# Cybertensor code and protocol version.
__version__ = "0.2.2"
__version__ = "0.2.3"
version_split = __version__.split(".")
__version_as_int__ = (
(100 * int(version_split[0]))
Expand Down Expand Up @@ -112,7 +112,7 @@ def __init__(
__boot_symbol__: str = "PUSSY"
__giga_boot_symbol__: str = "GPUSSY"

__networks__ = ["local", "bostrom", "space-pussy"]
__networks__ = ["local", "bostrom", "space-pussy", "space-pussy-graph"]

__default_network__ = "space-pussy"

Expand Down Expand Up @@ -158,7 +158,22 @@ def __init__(
giga_token_symbol="GPUSSY",
network_explorer="https://cyb.ai",
address_prefix="pussy",
contract_address="pussy1ddwq8rxgdsm27pvpxqdy2ep9enuen6t2yhrqujvj9qwl4dtukx0s8hpka9",
contract_address="pussy1guj27rm0uj2mhwnnsr8j7cz6uvsz2d759kpalgqs60jahfzwgjcs4l28cw",
)

__space_pussy_graph_network__ = NetworkConfigCwTensor(
chain_id="space-pussy",
url="grpc+https://grpc.space-pussy.cybernode.ai:1443",
fee_minimum_gas_price=0.01,
fee_denomination="pussy",
staking_denomination="pussy",
faucet_url="",
token="pussy",
token_symbol="PUSSY",
giga_token_symbol="GPUSSY",
network_explorer="https://cyb.ai",
address_prefix="pussy",
contract_address="pussy1j9qku20ssfjdzgl3y5hl0vfxzsjwzwn7d7us2t2n4ejgc6pesqcqhnxsz0",
)

__contract_path__ = None
Expand Down
6 changes: 3 additions & 3 deletions cybertensor/chain_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class DelegateInfo:
int
] # List of subnets that the delegate is allowed to validate on
registrations: List[int] # List of subnets that the delegate is registered on
return_per_1000: Balance # Return per 1000 gboot of the delegate over a day
return_per_giga: Balance # Return per 1 gboot of the delegate over a day
total_daily_return: Balance # Total daily return of the delegate

@classmethod
Expand All @@ -469,8 +469,8 @@ def fix_decoded_values(cls, decoded: Any) -> "DelegateInfo":
),
validator_permits=decoded["validator_permits"],
registrations=decoded["registrations"],
return_per_1000=Balance.from_boot(decoded["return_per_1000"]),
total_daily_return=Balance.from_boot(decoded["total_daily_return"]),
return_per_giga=Balance.from_boot(int(decoded["return_per_giga"]["amount"])),
total_daily_return=Balance.from_boot(int(decoded["total_daily_return"]["amount"])),
)

@classmethod
Expand Down
5 changes: 3 additions & 2 deletions cybertensor/commands/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ def add_args(parser: argparse.ArgumentParser):
"min_burn": "sudo_set_min_burn",
"max_burn": "sudo_set_max_burn",
"max_allowed_validators": "sudo_set_max_allowed_validators",
"metadata": "sudo_set_subnet_metadata",
}


Expand Down Expand Up @@ -420,7 +421,7 @@ class SubnetHyperparamsCommand:
Example usage:
>>> ctcli subnets hyperparameters --netuid 1
Subnet Hyperparameters - NETUID: 1 - finney
Subnet Hyperparameters - NETUID: 1 - space-pussy
HYPERPARAMETER VALUE
rho 10
kappa 32767
Expand Down Expand Up @@ -518,7 +519,7 @@ class SubnetGetHyperparamsCommand:
Example usage:
>>> ctcli sudo get --netuid 1
Subnet Hyperparameters - NETUID: 1 - finney
Subnet Hyperparameters - NETUID: 1 - space-pussy
HYPERPARAMETER VALUE
rho 10
kappa 32767
Expand Down
173 changes: 171 additions & 2 deletions cybertensor/contract/schema/execute.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,31 @@
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"set_delegate_commission"
],
"properties": {
"set_delegate_commission": {
"type": "object",
"required": [
"commission",
"hotkey"
],
"properties": {
"commission": {
"type": "string"
},
"hotkey": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
Expand Down Expand Up @@ -1425,28 +1450,172 @@
],
"properties": {
"sudo_set_subnet_metadata": {
"type": "object",
"required": [
"metadata",
"netuid"
],
"properties": {
"metadata": {
"$ref": "#/definitions/Metadata"
},
"netuid": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"sudo_set_subnet_owner"
],
"properties": {
"sudo_set_subnet_owner": {
"type": "object",
"required": [
"netuid",
"particle"
"new_owner"
],
"properties": {
"netuid": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
},
"particle": {
"new_owner": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"sudo_set_root"
],
"properties": {
"sudo_set_root": {
"type": "object",
"required": [
"new_root"
],
"properties": {
"new_root": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"sudo_set_verse_metadata"
],
"properties": {
"sudo_set_verse_metadata": {
"type": "object",
"required": [
"metadata"
],
"properties": {
"metadata": {
"$ref": "#/definitions/Metadata"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"sudo_unstake_all"
],
"properties": {
"sudo_unstake_all": {
"type": "object",
"properties": {
"limit": {
"type": [
"integer",
"null"
],
"format": "uint32",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"sudo_set_commission_change"
],
"properties": {
"sudo_set_commission_change": {
"type": "object",
"required": [
"change"
],
"properties": {
"change": {
"type": "boolean"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
],
"definitions": {
"Metadata": {
"type": "object",
"required": [
"description",
"extra",
"logo",
"name",
"particle",
"types"
],
"properties": {
"description": {
"type": "string"
},
"extra": {
"type": "string"
},
"logo": {
"type": "string"
},
"name": {
"type": "string"
},
"particle": {
"type": "string"
},
"types": {
"type": "string"
}
}
},
"Uint128": {
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
"type": "string"
Expand Down
Loading

0 comments on commit d52fe51

Please sign in to comment.