Skip to content

Commit

Permalink
Tee pull public key support (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
volod-vana authored Oct 17, 2024
1 parent e57e769 commit 1f65c09
Show file tree
Hide file tree
Showing 8 changed files with 239 additions and 56 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "vana"
version = "0.19.0"
version = "0.20.0"
description = ""
authors = ["Tim Nunamaker <[email protected]>", "Volodymyr Isai <[email protected]>", "Kahtaf Alam <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion vana/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

__version__ = "0.19.0"
__version__ = "0.20.0"

import rich

Expand Down
7 changes: 4 additions & 3 deletions vana/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ def get_tee(self, address: str):
return None
return tee

def register_tee(self, url: str):
def register_tee(self, url: str, public_key: str):
"""
Register a TEE compute node with the TEE Pool contract.
:param url:
:param url: URL where the TEE is reachable
:param public_key: Public key of the TEE node
:return: Transaction hex, Transaction receipt
"""
register_fn = self.tee_pool_contract.functions.addTee(self.wallet.hotkey.address, url)
register_fn = self.tee_pool_contract.functions.addTee(self.wallet.hotkey.address, url, public_key)
return self.chain_manager.send_transaction(register_fn, self.wallet.hotkey)

def add_proof(self, proof_data: ProofData, file_id: int | None = None, job_id: int | None = None):
Expand Down
7 changes: 3 additions & 4 deletions vana/commands/satya.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class RegisterCommand(BaseCommand):
wallet (str): The name of the wallet to use for registration.
Example usage:
vanacli satya register --url=https://teenode.com --wallet.name=dlp-owner --chain.network=satori
vanacli satya register --url=https://teenode.com --wallet.name=dlp-owner --chain.network=moksha
"""

@staticmethod
Expand All @@ -52,11 +52,10 @@ def run(cli: "vana.cli"):
vana_client = vana.Client(config=cli.config)
wallet = vana.Wallet(config=cli.config if cli.config.wallet else None)

tx_hash, tx_receipt = vana_client.register_tee(cli.config.url)

tx_hash, tx_receipt = vana_client.register_tee(cli.config.url, wallet.get_hotkey_public_key())
if tx_receipt['status'] == 1:
vana.__console__.print(
f"[bold green]Successfully registered validator node with URL '{cli.config.url} and address {wallet.hotkey.address}'[/bold green]")
f"[bold green]Successfully registered validator node with URL '{cli.config.url}', address '{wallet.hotkey.address}' and public key '{wallet.get_hotkey_public_key()}'[/bold green]")
vana.__console__.print(f"Transaction hash: {tx_hash.hex()}")
else:
vana.__console__.print(
Expand Down
41 changes: 41 additions & 0 deletions vana/contracts/DataRegistry.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,47 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "url",
"type": "string"
},
{
"internalType": "address",
"name": "ownerAddress",
"type": "address"
},
{
"components": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "string",
"name": "key",
"type": "string"
}
],
"internalType": "struct IDataRegistry.Permission[]",
"name": "permissions",
"type": "tuple[]"
}
],
"name": "addFileWithPermissions",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down
48 changes: 48 additions & 0 deletions vana/contracts/RootNetworkContract.json
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,30 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "dlpId",
"type": "uint256"
}
],
"name": "estimatedDlpReward",
"outputs": [
{
"internalType": "uint256",
"name": "historyRewardEstimation",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "stakeRewardEstimation",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -1554,6 +1578,30 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "stakerAddress",
"type": "address"
},
{
"internalType": "uint256",
"name": "dlpId",
"type": "uint256"
}
],
"name": "unstakebleAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
Expand Down
Loading

0 comments on commit 1f65c09

Please sign in to comment.