hiero-ledger / hiero-ledger/hiero-sdk-cpp
[Beginner]: Add `operator==` to `Endpoint`
- Dominant language
- C++
- Stars
- 42
- Forks
- 108
- Avg merge
- 11h 45m
- Merged PRs (30d)
- 2
Description
### 🐥 Beginner Friendly
This issue is a great fit for contributors who are ready to explore the Hiero C++ codebase a little more and take on slightly more independent work.
Beginner Issues often involve reading existing C++ code, understanding how different parts of the SDK fit together, and making small, thoughtful updates that follow established patterns.
The goal is to support skill growth while keeping the experience approachable, well-scoped, and enjoyable.
> [!IMPORTANT]
> ### 🐥 About Beginner Issues
>
> Beginner Issues are a great next step for contributors who feel comfortable with the basic project workflow and want to explore the codebase a little more.
>
> These issues often involve:
> - Reading existing C++ code
> - Understanding how different parts of the SDK fit together
> - Making small, thoughtful updates that follow established patterns
>
> You'll usually see Beginner Issues focused on things like:
> - Small, well-scoped improvements to existing tests
> - Narrow updates to `src` functionality (e.g. refining helpers or improving readability)
> - Documentation or comment clarity
> - Enhancements to existing examples
>
> Other types of contributions — such as brand-new features, broader system changes, or deeper technical work — are just as valuable and may use different labels.
### 👾 Description of the Issue
The `Endpoint` class is missing an `operator==` implementation.
Relevant files:
```
src/sdk/main/include/Endpoint.h
src/sdk/main/src/Endpoint.cc
```
Without `operator==`, callers must compare endpoint objects field-by-field. Other SDK value types (e.g. `AccountId`, `PendingAirdropId`) already implement `operator==` as a pattern — `Endpoint` should follow suit.
Note: `Endpoint` uses **private member variables** with public getter methods (unlike most other SDK value types that use public members). The `operator==` implementation will use the getters rather than accessing fields directly, or can be declared as a `friend` function to access private members — either approach is acceptable.
### 💡 Proposed Solution
Add `operator==` to `Endpoint` following the same pattern used by `PendingAirdropId` (a recently added, clean example), adapted for private members:
- Declare a `[[nodiscard]] friend bool operator==(const Endpoint&, const Endpoint&)` in the header
- Implement it in `Endpoint.cc`, comparing all meaningful member fields:
- `mAddress`, `mPort`, `mDomainName`
- Add or extend the unit test file in `src/sdk/tests/unit/EndpointTest.cc`
The change should not affect any existing behavior or public API.
### 👩💻 Implementation Steps
- [ ] Read `src/sdk/main/include/PendingAirdropId.h` and `src/sdk/main/src/PendingAirdropId.cc` to understand the pattern
- [ ] Open `src/sdk/main/include/Endpoint.h` and review the private members and public getter methods
- [ ] Add the `friend` declaration for `operator==` inside the class body
- [ ] Open `src/sdk/main/src/Endpoint.cc` and implement `operator==` comparing `mAddress`, `mPort`, and `mDomainName`
- [ ] Open `src/sdk/tests/unit/EndpointTest.cc` and add equality tests:
- Two default-constructed instances are equal
- Two identically-constructed instances are equal
- Instances differing in each field are not equal
- [ ] Build the SDK and confirm all tests pass
### ✅ Acceptance Criteria
- [ ] **Scope:** Changes are limited to `Endpoint.h`, `Endpoint.cc`, and its unit test
- [ ] **Behavior:** No other SDK behavior or API changes
- [ ] **Tests:** Existing and new equality tests pass
- [ ] **Review:** All code review feedback addressed
---
### 📋 Step-by-Step Contribution Guide
To help keep contributions consistent and easy to review, we recommend following these steps:
- [ ] Comment `/assign` to request the issue
- [ ] Wait for assignment
- [ ] Fork the repository and create a branch
- [ ] Set up the project using the instructions in `README.md`
- [ ] Make the requested changes
- [ ] Sign each commit using `-s -S`
- [ ] Push your branch and open a pull request
Read [Workflow Guide](https://github.com/hiero-ledger/hiero-sdk-cpp/blob/main/docs/training/workflow.md) for step-by-step workflow guidance.
Read [README.md](https://github.com/hiero-ledger/hiero-sdk-cpp/blob/main/README.md) for setup instructions.
❗ Pull requests **cannot be merged** without `S` and `s` signed commits.
See the [Signing Guide](https://github.com/hiero-ledger/hiero-sdk-cpp/blob/main/docs/training/signing.md).
### 🤔 Additional Information
Reference implementation to follow:
- `src/sdk/main/include/PendingAirdropId.h`
- `src/sdk/main/src/PendingAirdropId.cc`
If you have questions while working on this issue, feel free to ask! [Hiero-SDK-C++ Discord](https://discord.com/channels/905194001349627914/1337424839761465364)
Contributor guide
Research direction
Read src/sdk/main/include/PendingAirdropId.h and src/sdk/main/src/PendingAirdropId.cc for the equality pattern, then inspect Endpoint.h and Endpoint.cc. Add equality coverage in src/sdk/tests/unit/EndpointTest.cc for default, identical, and differing values, and build the SDK to confirm the tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100