From d40b5da04dfc59a74d462789fced77eaaab53b0c Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Wed, 12 Mar 2025 14:03:24 -0700 Subject: [PATCH 1/3] feat: include leader's public key when adding funds --- .../nillion/payments/v1/balance/__init__.py | 10 +++++++++- nilvm | 2 +- src/nillion_client/client.py | 4 +++- uv.lock | 9 ++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/client-proto/src/nillion_client_proto/nillion/payments/v1/balance/__init__.py b/client-proto/src/nillion_client_proto/nillion/payments/v1/balance/__init__.py index 1def321..468be62 100644 --- a/client-proto/src/nillion_client_proto/nillion/payments/v1/balance/__init__.py +++ b/client-proto/src/nillion_client_proto/nillion/payments/v1/balance/__init__.py @@ -8,7 +8,10 @@ import betterproto -from ....auth.v1 import user as ___auth_v1_user__ +from ....auth.v1 import ( + public_key as ___auth_v1_public_key__, + user as ___auth_v1_user__, +) @dataclass(eq=False, repr=False) @@ -47,3 +50,8 @@ class AddFundsPayload(betterproto.Message): """ A 32 byte nonce that is used to add entropy to the hash of this message and to prevent duplicate spending. """ + + leader_public_key: "___auth_v1_public_key__.PublicKey" = betterproto.message_field( + 3 + ) + """The public key of the leader node that funds are being sent to.""" diff --git a/nilvm b/nilvm index d53b729..5bcbfc4 160000 --- a/nilvm +++ b/nilvm @@ -1 +1 @@ -Subproject commit d53b7295b7cdb3376af1186aa96915768a01223c +Subproject commit 5bcbfc464eab01b0dbb83a0c01317e70aa7a9e79 diff --git a/src/nillion_client/client.py b/src/nillion_client/client.py index 019cd99..9b63618 100644 --- a/src/nillion_client/client.py +++ b/src/nillion_client/client.py @@ -1415,7 +1415,9 @@ async def add_funds(self, amount_unil: int, target_user: UserId | None = None): ) nonce = secrets.token_bytes(32) payload = AddFundsPayload( - recipient=(target_user or self.user_id).to_proto(), nonce=nonce + recipient=(target_user or self.user_id).to_proto(), + nonce=nonce, + leader_public_key=self.cluster.leader.public_key, ).SerializeToString() payload_hash = hashlib.sha256(payload).digest() tx_hash = await self._payer.submit_payment(amount_unil, payload_hash) diff --git a/uv.lock b/uv.lock index 93d2b62..09b0110 100644 --- a/uv.lock +++ b/uv.lock @@ -1,4 +1,5 @@ version = 1 +revision = 1 requires-python = ">=3.10" [manifest] @@ -1198,7 +1199,7 @@ wheels = [ [[package]] name = "nillion-client" -version = "0.2.1rc1" +version = "0.2.1rc2" source = { editable = "." } dependencies = [ { name = "base58" }, @@ -1271,7 +1272,7 @@ dev = [ [[package]] name = "nillion-client-core" -version = "0.2.1rc1" +version = "0.2.1rc2" source = { editable = "client-core" } [package.optional-dependencies] @@ -1285,10 +1286,11 @@ requires-dist = [ { name = "maturin", extras = ["zig"], marker = "extra == 'dev'", specifier = "==1.7.4" }, { name = "pip", marker = "extra == 'dev'", specifier = "==24.2" }, ] +provides-extras = ["dev"] [[package]] name = "nillion-client-proto" -version = "0.2.1rc1" +version = "0.2.1rc2" source = { editable = "client-proto" } dependencies = [ { name = "betterproto" }, @@ -1308,6 +1310,7 @@ requires-dist = [ { name = "googleapis-common-protos", specifier = "==1.66.0" }, { name = "grpcio-tools", marker = "extra == 'dev'", specifier = "==1.62.3" }, ] +provides-extras = ["dev"] [[package]] name = "nodeenv" From b93907a3f293d5dc37f5c424173fd9dea28fbd12 Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Wed, 12 Mar 2025 14:04:12 -0700 Subject: [PATCH 2/3] chore: use https for submodule --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index ea0c8dd..9d4c721 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "nilvm"] path = nilvm - url = git@github.com:NillionNetwork/nilvm.git + url = https://github.com/NillionNetwork/nilvm From de7d1d2f89bf100916f00908de9be27d3666acba Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Wed, 12 Mar 2025 14:20:04 -0700 Subject: [PATCH 3/3] chore: bump ci sdk version --- .nil-sdk.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nil-sdk.toml b/.nil-sdk.toml index 1d6ec7b..40a67ed 100644 --- a/.nil-sdk.toml +++ b/.nil-sdk.toml @@ -1 +1 @@ -version = "v0.10.0-rc.23" \ No newline at end of file +version = "v0.10.0-rc.39"