Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consensus node IP and port in address book is incorrect #807

Open
rwalworth opened this issue Oct 24, 2024 · 0 comments
Open

Consensus node IP and port in address book is incorrect #807

rwalworth opened this issue Oct 24, 2024 · 0 comments

Comments

@rwalworth
Copy link

Description

I'm working on adding a feature to the SDKs that involves populating the SDKs consensus network by querying the mirror node for the address book. Basically would look like:

Client client;
client.setMirrorNetwork("127.0.0.1:5600");
client.populateConsensusNetworkFromAddressBook(); // Initializes the SDKs consensus node network

// Now able to execute transactions
...

This would allow Sphere use cases to not have to bother initializing their apps with the correct IPs and ports and instead and can just maintain an address book from which the apps can get the network information.

When testing this feature with hedera-local-node, it seemed the consensus node endpoint for itself was incorrect. Simply running this with the Java SDK, you can see the reported endpoint is incorrect:

Client client = ClientHelper.forLocalNetwork();

NodeAddressBook addressBook = new AddressBookQuery()
    .setFileId(FileId.ADDRESS_BOOK)
    .execute(client);
List<NodeAddress> addresses = addressBook.getNodeAddresses();
for (int i = 0; i < addresses.size(); ++i)
{
    System.out.println(addresses.get(i).toString());
}
NodeAddress{publicKey=308201a2300d06092a864886f70d01010105000382018f003082018a0282018100a12006f2527242cd7f53b9c4fd5de869c562ff4ed8a4ab3a62963f3f8188be78f258eaf42b9c3e3e8f58697160413bbf77aadfaf0d9ffd86984b3bc4fb5f02e11e8acb6ec67e4264addca13ffde8367578c2792fc6ae326e7b34856d23f02574f5a27481560032d73749daf9d332a7883510e60ea222889a3bfc3bedf350f3a36cada39b94539c74fb8265678bd5c148fbc9169adcacf6719b92ee8d42a9d2f8923cc4fe3b494c467f4e98a2a49e0a0ef5aa433cbec438baa256ae61a0590ce4e67d0b3fe5f2da9ad90c26e229d28d679456978d6573573ebb46239bad4abfab4ffe64ea4a397c6bc5f7175e1ac36488f17c6773b5ed93415e57c41c6cd8866dbd12360062339cb154d85ad1aecd1d760a0941d80e28fe246033a868dbbc8975f3604431fce9af91dc42540ab04b1bbec21f35f75f30af6f05c8986429386e2b439bfd2fd5912c82600801e9c0857f165e887f2233dc2c098ba1267b059db8a2db714fe50668dbf093604a5df3c232146723211ce58552638fae9fc064a7f09b0203010001, accountId=0.0.3, nodeId=0, certHash=, addresses=[1.0.0.0:1], description=, stake=0}

Running this with the C++ SDK as well confirms its not an SDK parsing issue:

Client client;
client.setMirrorNetwork({ "127.0.0.1:5600" });
client.setNetwork({
    {"127.0.0.1:50211", AccountId::fromString("0.0.3")}
});

// Query for the address book using the client.
const NodeAddressBook nodeAddressBook = AddressBookQuery().setFileId(FileId::ADDRESS_BOOK).execute(client);

// Print off the received addresses contained in the address book.
for (const auto& nodeAddress : nodeAddressBook.getNodeAddresses())
{
    std::cout << nodeAddress.toString() << std::endl;
}
NodeId: 0
AccountId: 0.0.3
Description: 
RSA Public Key: 308201a2300d06092a864886f70d01010105000382018f003082018a0282018100a12006f2527242cd7f53b9c4fd5de869c562ff4ed8a4ab3a62963f3f8188be78f258eaf42b9c3e3e8f58697160413bbf77aadfaf0d9ffd86984b3bc4fb5f02e11e8acb6ec67e4264addca13ffde8367578c2792fc6ae326e7b34856d23f02574f5a27481560032d73749daf9d332a7883510e60ea222889a3bfc3bedf350f3a36cada39b94539c74fb8265678bd5c148fbc9169adcacf6719b92ee8d42a9d2f8923cc4fe3b494c467f4e98a2a49e0a0ef5aa433cbec438baa256ae61a0590ce4e67d0b3fe5f2da9ad90c26e229d28d679456978d6573573ebb46239bad4abfab4ffe64ea4a397c6bc5f7175e1ac36488f17c6773b5ed93415e57c41c6cd8866dbd12360062339cb154d85ad1aecd1d760a0941d80e28fe246033a868dbbc8975f3604431fce9af91dc42540ab04b1bbec21f35f75f30af6f05c8986429386e2b439bfd2fd5912c82600801e9c0857f165e887f2233dc2c098ba1267b059db8a2db714fe50668dbf093604a5df3c232146723211ce58552638fae9fc064a7f09b0203010001
Certificate Hash: 
Endpoints: 1.0.0.0:1

I know the default IP and port used for hedera-local-node is "127.0.0.1:50211", so I would think it'd want to properly report its own endpoint.

Steps to reproduce

  1. Run code above.
  2. Observe incorrect endpoint.

Additional context

No response

Hedera network

other

Version

v2.31.0

Operating system

macOS

@rwalworth rwalworth changed the title hedera-local-node IP and port in mirror node address book is incorrect Consensus node IP and port in address book is incorrect Oct 24, 2024
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

No branches or pull requests

1 participant