Skip to content

Commit

Permalink
subspace
Browse files Browse the repository at this point in the history
  • Loading branch information
latentvector committed May 1, 2024
1 parent 22e51b7 commit b7abac1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion commune/subspace/subspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,12 @@ def query_multi(self, params_batch , substrate=None, module='SubspaceModule', fe
results = substrate.query_multi(multi_query)
return results

def blocks_until_vote(self, netuid=0, **kwargs):
netuid = self.resolve_netuid(netuid)
tempo = self.subnet_params(netuid=netuid, **kwargs)['tempo']
block = self.block
return tempo - ((block + netuid) % tempo)

def subnet_params(self,
netuid=0,
network = 'main',
Expand Down Expand Up @@ -2449,7 +2455,7 @@ def register(

stake = stake or 0
min_register_stake = self.min_register_stake(netuid=netuid, network=network)
stake = min(min_register_stake, stake)
stake = max(min_register_stake, stake)

if c.key_exists(name):
mkey = c.get_key(name)
Expand All @@ -2463,6 +2469,9 @@ def register(
if '0.0.0.0' in address:
address = address.replace('0.0.0.0', c.ip(update=1))

if len(address) > 32:
address = address[-32:]

metadata = c.dict2str(metadata or {})
params = {
'network': subnet.encode('utf-8'),
Expand Down
4 changes: 3 additions & 1 deletion commune/subspace/subspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ urls:
comstats:
http: https://api.comstats.io
ws: wss://api.com
local: null
local:
http: http://0.0.0.0:8080
ws: ws://0.0.0.0:8080
onfinality:
http: https://commune.api.onfinality.io/public-http
ws: wss://commune.api.onfinality.io/public-ws

0 comments on commit b7abac1

Please sign in to comment.