Skip to content

Commit 8a34b87

Browse files
authored
Merge branch 'main' into feat/tck-update-topic-2426
2 parents 417a9fc + b9db9d6 commit 8a34b87

11 files changed

Lines changed: 94 additions & 26 deletions

.github/workflows/pr-check-primary-codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
python-version: "3.11"
3838

3939
- name: Install uv
40-
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
40+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
4141

4242
- name: Install dependencies
4343
run: |

.github/workflows/pr-check-primary-codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
egress-policy: audit
4343

4444
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
45+
uses: github/codeql-action/init@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
4646
with:
4747
languages: ${{ matrix.language }}
4848
build-mode: ${{ matrix.build-mode }}
@@ -57,7 +57,7 @@ jobs:
5757

5858
- name: Install uv
5959
if: matrix.language == 'python'
60-
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
60+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
6161
with:
6262
enable-cache: true
6363

@@ -66,6 +66,6 @@ jobs:
6666
run: uv sync --frozen --all-groups --all-packages --all-extras
6767

6868
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@7188fc363630916deb702c7fdcf4e481b751f97a # v4.37.1
69+
uses: github/codeql-action/analyze@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
7070
with:
7171
category: "/language:${{matrix.language}}"

.github/workflows/pr-check-secondary-deps-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
cache: "pip"
3939

4040
- name: Install uv
41-
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
41+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
4242

4343
- name: Create virtual environment
4444
run: uv venv

.github/workflows/pr-check-secondary-examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
working-directory: .github/scripts
5959

6060
- name: Install uv
61-
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
61+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
6262

6363
- name: Install dependencies
6464
run: uv sync --frozen --all-groups --all-packages --all-extras

.github/workflows/pr-check-secondary-tck-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
python-version: "3.14"
4343

4444
- name: Install uv
45-
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
45+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
4646
with:
4747
enable-cache: true
4848

.github/workflows/pr-check-secondary-unit-integration-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
python-version: ${{ matrix.python-version }}
5555

5656
- name: Install uv
57-
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
57+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
5858
with:
5959
enable-cache: true
6060

@@ -117,7 +117,7 @@ jobs:
117117
python-version: ${{ matrix.python-version }}
118118

119119
- name: Install uv
120-
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
120+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
121121
with:
122122
enable-cache: true
123123

.github/workflows/test-scripts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
persist-credentials: false
3333

3434
- name: Install uv
35-
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
35+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
3636

3737
- name: Install dependencies
3838
run: uv sync --frozen --all-groups --all-packages --all-extras

src/hiero_sdk_python/nodes/node_create_transaction.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from hiero_sdk_python.account.account_id import AccountId
88
from hiero_sdk_python.address_book.endpoint import Endpoint
99
from hiero_sdk_python.channels import _Channel
10-
from hiero_sdk_python.crypto.public_key import PublicKey
10+
from hiero_sdk_python.crypto.key import Key
1111
from hiero_sdk_python.executable import _Method
1212
from hiero_sdk_python.hapi.services.node_create_pb2 import NodeCreateTransactionBody
1313
from hiero_sdk_python.hapi.services.schedulable_transaction_body_pb2 import (
@@ -29,7 +29,7 @@ class NodeCreateParams:
2929
service_endpoints (list[Endpoint]): The service endpoints of the node.
3030
gossip_ca_certificate (bytes, optional): The gossip ca certificate of the node.
3131
grpc_certificate_hash (bytes, optional): The grpc certificate hash of the node.
32-
admin_key (PublicKey, optional): The admin key of the node.
32+
admin_key (Key, optional): The admin key of the node.
3333
decline_reward (bool, optional): The decline reward of the node.
3434
grpc_web_proxy_endpoint (Endpoint, optional): The grpc web proxy endpoint of the node.
3535
"""
@@ -40,7 +40,7 @@ class NodeCreateParams:
4040
service_endpoints: list[Endpoint] = field(default_factory=list)
4141
gossip_ca_certificate: bytes | None = None
4242
grpc_certificate_hash: bytes | None = None
43-
admin_key: PublicKey | None = None
43+
admin_key: Key | None = None
4444
decline_reward: bool | None = None
4545
grpc_web_proxy_endpoint: Endpoint | None = None
4646
associated_registered_nodes: list[int] = field(default_factory=list)
@@ -73,7 +73,7 @@ def __init__(self, node_create_params: NodeCreateParams | None = None):
7373
self.service_endpoints: list[Endpoint] = node_create_params.service_endpoints
7474
self.gossip_ca_certificate: bytes | None = node_create_params.gossip_ca_certificate
7575
self.grpc_certificate_hash: bytes | None = node_create_params.grpc_certificate_hash
76-
self.admin_key: PublicKey | None = node_create_params.admin_key
76+
self.admin_key: Key | None = node_create_params.admin_key
7777
self.decline_reward: bool | None = node_create_params.decline_reward
7878
self.grpc_web_proxy_endpoint: Endpoint | None = node_create_params.grpc_web_proxy_endpoint
7979
self.associated_registered_nodes: list[int] = node_create_params.associated_registered_nodes
@@ -168,12 +168,12 @@ def set_grpc_certificate_hash(self, grpc_certificate_hash: bytes | None) -> Node
168168
self.grpc_certificate_hash = grpc_certificate_hash
169169
return self
170170

171-
def set_admin_key(self, admin_key: PublicKey | None) -> NodeCreateTransaction:
171+
def set_admin_key(self, admin_key: Key | None) -> NodeCreateTransaction:
172172
"""
173173
Sets the admin key for this node create transaction.
174174
175175
Args:
176-
admin_key (PublicKey):
176+
admin_key (Key):
177177
The admin key of the node.
178178
179179
Returns:
@@ -255,7 +255,7 @@ def _build_proto_body(self) -> NodeCreateTransactionBody:
255255
service_endpoint=[endpoint._to_proto() for endpoint in self.service_endpoints or []],
256256
gossip_ca_certificate=self.gossip_ca_certificate,
257257
grpc_certificate_hash=self.grpc_certificate_hash,
258-
admin_key=self.admin_key._to_proto() if self.admin_key else None,
258+
admin_key=self.admin_key.to_proto_key() if self.admin_key else None,
259259
decline_reward=self.decline_reward,
260260
grpc_proxy_endpoint=(self.grpc_web_proxy_endpoint._to_proto() if self.grpc_web_proxy_endpoint else None),
261261
associated_registered_node=self.associated_registered_nodes,
@@ -317,7 +317,7 @@ def _from_protobuf(cls, transaction_body, body_bytes: bytes, sig_map):
317317
if pb.grpc_certificate_hash:
318318
transaction.grpc_certificate_hash = pb.grpc_certificate_hash
319319
if pb.HasField("admin_key"):
320-
transaction.admin_key = PublicKey._from_proto(pb.admin_key)
320+
transaction.admin_key = Key.from_proto_key(pb.admin_key)
321321
if pb.decline_reward:
322322
transaction.decline_reward = pb.decline_reward
323323
if pb.HasField("grpc_proxy_endpoint"):

src/hiero_sdk_python/nodes/node_update_transaction.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from hiero_sdk_python.account.account_id import AccountId
1111
from hiero_sdk_python.address_book.endpoint import Endpoint
1212
from hiero_sdk_python.channels import _Channel
13-
from hiero_sdk_python.crypto.public_key import PublicKey
13+
from hiero_sdk_python.crypto.key import Key
1414
from hiero_sdk_python.executable import _Method
1515
from hiero_sdk_python.hapi.services.node_update_pb2 import (
1616
AssociatedRegisteredNodeList,
@@ -36,7 +36,7 @@ class NodeUpdateParams:
3636
service_endpoints (list[Endpoint]): The service endpoints of the node.
3737
gossip_ca_certificate (bytes, None): The gossip ca certificate of the node.
3838
grpc_certificate_hash (bytes, None): The grpc certificate hash of the node.
39-
admin_key (PublicKey, optional): The admin key of the node.
39+
admin_key (Key, optional): The admin key of the node.
4040
decline_reward (bool, optional): The decline reward of the node.
4141
grpc_web_proxy_endpoint (Endpoint, optional): The grpc web proxy endpoint of the node.
4242
"""
@@ -48,7 +48,7 @@ class NodeUpdateParams:
4848
service_endpoints: list[Endpoint] = field(default_factory=list)
4949
gossip_ca_certificate: bytes | None = None
5050
grpc_certificate_hash: bytes | None = None
51-
admin_key: PublicKey | None = None
51+
admin_key: Key | None = None
5252
decline_reward: bool | None = None
5353
grpc_web_proxy_endpoint: Endpoint | None = None
5454
associated_registered_nodes: list[int] | None = None
@@ -82,7 +82,7 @@ def __init__(self, node_update_params: NodeUpdateParams | None = None):
8282
self.service_endpoints: list[Endpoint] = node_update_params.service_endpoints
8383
self.gossip_ca_certificate: bytes | None = node_update_params.gossip_ca_certificate
8484
self.grpc_certificate_hash: bytes | None = node_update_params.grpc_certificate_hash
85-
self.admin_key: PublicKey | None = node_update_params.admin_key
85+
self.admin_key: Key | None = node_update_params.admin_key
8686
self.decline_reward: bool | None = node_update_params.decline_reward
8787
self.grpc_web_proxy_endpoint: Endpoint | None = node_update_params.grpc_web_proxy_endpoint
8888
self.associated_registered_nodes: list[int] | None = node_update_params.associated_registered_nodes
@@ -192,12 +192,12 @@ def set_grpc_certificate_hash(self, grpc_certificate_hash: bytes | None) -> Node
192192
self.grpc_certificate_hash = grpc_certificate_hash
193193
return self
194194

195-
def set_admin_key(self, admin_key: PublicKey | None) -> NodeUpdateTransaction:
195+
def set_admin_key(self, admin_key: Key | None) -> NodeUpdateTransaction:
196196
"""
197197
Sets the admin key for this node update transaction.
198198
199199
Args:
200-
admin_key (PublicKey):
200+
admin_key (Key):
201201
The admin key of the node.
202202
203203
Returns:
@@ -306,7 +306,7 @@ def _build_proto_body(self) -> NodeUpdateTransactionBody:
306306
grpc_certificate_hash=(
307307
BytesValue(value=self.grpc_certificate_hash) if self.grpc_certificate_hash is not None else None
308308
),
309-
admin_key=self._convert_to_proto(self.admin_key),
309+
admin_key=self.admin_key.to_proto_key() if self.admin_key else None,
310310
decline_reward=(BoolValue(value=self.decline_reward) if self.decline_reward is not None else None),
311311
grpc_proxy_endpoint=self._convert_to_proto(self.grpc_web_proxy_endpoint),
312312
)
@@ -377,7 +377,7 @@ def _from_protobuf(cls, transaction_body, body_bytes: bytes, sig_map):
377377
if pb.HasField("grpc_certificate_hash"):
378378
transaction.grpc_certificate_hash = pb.grpc_certificate_hash.value
379379
if pb.HasField("admin_key"):
380-
transaction.admin_key = PublicKey._from_proto(pb.admin_key)
380+
transaction.admin_key = Key.from_proto_key(pb.admin_key)
381381
if pb.HasField("decline_reward"):
382382
transaction.decline_reward = pb.decline_reward.value
383383
if pb.HasField("grpc_proxy_endpoint"):

tests/unit/node_create_transaction_test.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from hiero_sdk_python.hapi.services.schedulable_transaction_body_pb2 import (
1515
SchedulableTransactionBody,
1616
)
17+
from hiero_sdk_python.hapi.services.transaction_pb2 import TransactionBody
1718
from hiero_sdk_python.nodes.node_create_transaction import (
1819
NodeCreateParams,
1920
NodeCreateTransaction,
@@ -330,3 +331,36 @@ def test_to_proto(mock_client):
330331

331332
assert proto.signedTransactionBytes
332333
assert len(proto.signedTransactionBytes) > 0
334+
335+
336+
def test_node_create_transaction_build_with_private_key():
337+
"""NodeCreateTransaction should accept PrivateKey and serialize the PublicKey in the proto."""
338+
private_key = PrivateKey.generate()
339+
public_key = private_key.public_key()
340+
341+
tx = NodeCreateTransaction().set_admin_key(private_key)
342+
343+
body = tx._build_proto_body()
344+
345+
# In the proto we should have the public key not the private one
346+
assert body.admin_key.ed25519 == public_key.to_bytes_raw()
347+
348+
349+
def test_node_create_transaction_from_protobuf_with_admin_key():
350+
"""NodeCreateTransaction should deserialize the admin_key from the proto correctly."""
351+
private_key = PrivateKey.generate()
352+
353+
transaction = NodeCreateTransaction().set_admin_key(private_key)
354+
body = transaction._build_proto_body()
355+
356+
transaction_body = TransactionBody()
357+
transaction_body.nodeCreate.CopyFrom(body)
358+
359+
parsed_transaction = NodeCreateTransaction._from_protobuf(
360+
transaction_body,
361+
b"",
362+
None,
363+
)
364+
365+
assert parsed_transaction.admin_key is not None
366+
assert parsed_transaction.admin_key.to_proto_key() == body.admin_key

0 commit comments

Comments
 (0)