Skip to content

Conversation

@aceppaluni
Copy link
Contributor

Description:
Add Set_node_account_ids() method to Query and Transaction for retrieving receipts or records.

  • Added methods to both Query and Transaction
  • Added unit test for Query
  • Added unit test for Transaction

Related issue(s):

Fixes #86

Notes for reviewer:
Ran tests for both Query and Transaction

2025-09-08 (2) 2025-09-08

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

aceppaluni and others added 21 commits May 22, 2025 10:26
@aceppaluni aceppaluni marked this pull request as ready for review September 9, 2025 14:24
Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @accepaluni please remember to pre-fix your PR title eg
feat: add set node account id method
additionally, we now have a changelog, which must be updated with each PR

@nadineloepfe
Copy link
Contributor

Hi @aceppaluni,
are you still working on this?
also, would you mind adding a "feat:" in front of your PR title as well as an entry in the CHANGELOG? thanks

@aceppaluni
Copy link
Contributor Author

Hi @nadineloepfe Yes, my apologies.
I have been a bit busier then normal. Of course, will do, thank you!

@aceppaluni aceppaluni changed the title Add set node account id method feat: Add set node account id method Oct 20, 2025
@exploreriii exploreriii self-requested a review October 25, 2025 23:20
@nadineloepfe
Copy link
Contributor

Reviewing this PR made me realise that we currently have a behavioural divergence between Query and Transaction: the former always selects the first node, while the latter uses a round-robin strategy via _last_used_index. whops.

dw, this isn’t introduced by this PR, but it surfaced the inconsistency. I’ll raise a separate issue for this and keep it out of this PR though

@aceppaluni aceppaluni force-pushed the AddSetNodeAccountIdMethod branch from cd30c5d to 395fadf Compare October 27, 2025 21:33
Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @aceppaluni
One of your workflows threw an error
ERROR tests/integration/transfer_transaction_e2e_test.py - NameError: name 'List' is not defined
ERROR tests/integration/utils_for_test.py - NameError: name 'List' is not defined
ERROR tests/unit - NameError: name 'List' is not defined
Please check :)
thanks

@aceppaluni aceppaluni force-pushed the AddSetNodeAccountIdMethod branch from 094195f to 6abf051 Compare October 28, 2025 15:38
@aceppaluni
Copy link
Contributor Author

@exploreriii I believe the error should be corrected now.

@aceppaluni aceppaluni force-pushed the AddSetNodeAccountIdMethod branch from b09233a to 2afb18d Compare October 28, 2025 21:41

def set_node_account_id(self, node_account_id: AccountId):
"""
Selects a node account ID to use for sending a query.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be "sending a transaction"


def _select_node_account_id(self) -> Optional[AccountId]:
"""
Selects a node account ID to use for sending a query.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also should say "sending a transaction"

selected = self.node_account_ids[0]
self._used_node_account_id = selected
return selected
return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we end this file with a new line (python convcention)

CHANGELOG.md Outdated

### Fixed
- Added explicit read permissions to examples.yml (#623)
- fix: spacing after set_node_account_id method (#362)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the changelog entry should be: "added node_account_ids method" or similar, not spacing

@nadineloepfe
Copy link
Contributor

You need to modify the _execute method in executable.py to check if node_account_ids has been set and use _select_node_account_id() if available, otherwise fall back to client.network.current_node. else the
_select_node_account_id() methods you added are never actually
called.

also, please add an integration test (or raise a ticket so someone can pick this up later - executable as well as integration) :)

@aceppaluni aceppaluni force-pushed the AddSetNodeAccountIdMethod branch from 591a4b6 to ab18528 Compare October 29, 2025 15:30
@aceppaluni
Copy link
Contributor Author

@nadineloepfe I will raise a ticket for the integration testing. :)

Copy link
Contributor

@exploreriii exploreriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @aceppaluni note that the workflow has failed due to
ERROR tests/integration/token_pause_transaction_e2e_test.py::test_pause_sets_pause_status_to_paused - AttributeError: 'Network' object has no attribute '_get_node'. Did you mean: '_select_node'?

@aceppaluni aceppaluni force-pushed the AddSetNodeAccountIdMethod branch from ab18528 to df7a63a Compare October 30, 2025 15:40
@nadineloepfe
Copy link
Contributor

@aceppaluni : in executable.py, the code calls node = client.network._select_node(self.node_account_id)

But _select_node() in network.py doesn't accept any parameters yet, thus you see the errors.
I'd suggest to add a _get_node() method to the Network class that accepts an account ID and returns the matching node

@aceppaluni aceppaluni force-pushed the AddSetNodeAccountIdMethod branch from 048ccc5 to 5f694bd Compare November 4, 2025 16:38
@aceppaluni aceppaluni force-pushed the AddSetNodeAccountIdMethod branch from 4d9bd11 to 6e60202 Compare November 4, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add set_node_account_ids() functionality to track executed node

4 participants