Skip to content

Commit

Permalink
- bump version
Browse files Browse the repository at this point in the history
- update contract schema (cybernet v0.3.0)
- change metadata type from string to dictionary (cybernet v0.3.0)
  • Loading branch information
Snedashkovsky committed Jun 12, 2024
1 parent 7bfbb4d commit 982078c
Show file tree
Hide file tree
Showing 5 changed files with 269 additions and 29 deletions.
2 changes: 1 addition & 1 deletion 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
2 changes: 1 addition & 1 deletion cybertensor/commands/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +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",
"particle": "sudo_set_subnet_metadata",
"metadata": "sudo_set_subnet_metadata",
}


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
116 changes: 93 additions & 23 deletions cybertensor/contract/schema/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -648,29 +648,6 @@
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"get_subnetwork_n"
],
"properties": {
"get_subnetwork_n": {
"type": "object",
"required": [
"netuid"
],
"properties": {
"netuid": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
Expand Down Expand Up @@ -862,6 +839,99 @@
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"get_block_rewards"
],
"properties": {
"get_block_rewards": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"get_subnet_metadata"
],
"properties": {
"get_subnet_metadata": {
"type": "object",
"required": [
"netuid"
],
"properties": {
"netuid": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"get_subnets_metadata"
],
"properties": {
"get_subnets_metadata": {
"type": "object",
"properties": {
"limit": {
"type": [
"integer",
"null"
],
"format": "uint16",
"minimum": 0.0
},
"start_after": {
"type": [
"integer",
"null"
],
"format": "uint16",
"minimum": 0.0
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"get_verse_metadata"
],
"properties": {
"get_verse_metadata": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"get_economy"
],
"properties": {
"get_economy": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
Expand Down
5 changes: 3 additions & 2 deletions cybertensor/messages/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# DEALINGS IN THE SOFTWARE.

import time
import json

from cosmpy.aerial.wallet import LocalWallet
from cosmpy.crypto.keypairs import PrivateKey
Expand Down Expand Up @@ -173,7 +174,7 @@ def set_hyperparameter_message(
with console.status(
f":satellite: Setting hyperparameter {parameter} to {value} on subnet: {netuid} ..."
):
_value = int(value) if parameter != 'particle' else str(value)
_value = int(value) if parameter != 'metadata' else json.loads(value)
sudo_msg = {
str(message): {"netuid": netuid, str(parameter): _value},
}
Expand All @@ -188,7 +189,7 @@ def set_hyperparameter_message(
f":exclamation_mark: [yellow]Warning[/yellow]: TX {tx.tx_hash} broadcasted without confirmation..."
)
else:
tx = cwtensor.contract.execute(sudo_msg, signer_wallet, gas)
tx = cwtensor.contract.execute(sudo_msg, sender=signer_wallet, gas_limit=gas)
console.print(
f":satellite: [green]Processing..[/green]: TX {tx.tx_hash} waiting to complete..."
)
Expand Down

0 comments on commit 982078c

Please sign in to comment.