hashgraph / hedera-services

Crypto, token, consensus, file, and smart contract services for the Hedera public ledger
Apache License 2.0
313 stars 136 forks source link

feat: introduce RosterRetriever #15096

Closed anthony-swirldslabs closed 2 months ago

anthony-swirldslabs commented 2 months ago

Description: Introducing the RosterRetriever utility class that allows one to retrieve an active Roster for a given State.

This is a prerequisite to enable refactoring of the Platform code to replace all usages of the AddressBook with using the Roster instead. Places in code that currently fetch the AddressBook directly from the PlatformState will instead call this utility to retrieve the Roster.

Related issue(s):

Fixes #14995

Notes for reviewer: Unit tests pass.

Checklist

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 89.47368% with 8 lines in your changes missing coverage. Please review.

Project coverage is 59.18%. Comparing base (3158b49) to head (f389197). Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
...a/com/swirlds/platform/roster/RosterRetriever.java 91.42% 4 Missing and 2 partials :warning:
...s/platform/roster/InvalidAddressBookException.java 0.00% 2 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/hashgraph/hedera-services/pull/15096/graphs/tree.svg?width=650&height=150&src=pr&token=ZPMV8C93DV&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hashgraph)](https://app.codecov.io/gh/hashgraph/hedera-services/pull/15096?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hashgraph) ```diff @@ Coverage Diff @@ ## develop #15096 +/- ## ============================================= + Coverage 59.15% 59.18% +0.03% - Complexity 22778 22793 +15 ============================================= Files 2908 2910 +2 Lines 112474 112546 +72 Branches 11473 11480 +7 ============================================= + Hits 66531 66610 +79 + Misses 42245 42238 -7 Partials 3698 3698 ``` | [Files with missing lines](https://app.codecov.io/gh/hashgraph/hedera-services/pull/15096?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hashgraph) | Coverage Δ | | |---|---|---| | [.../com/hedera/node/app/roster/RosterServiceImpl.java](https://app.codecov.io/gh/hashgraph/hedera-services/pull/15096?src=pr&el=tree&filepath=hedera-node%2Fhedera-app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fhedera%2Fnode%2Fapp%2Froster%2FRosterServiceImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hashgraph#diff-aGVkZXJhLW5vZGUvaGVkZXJhLWFwcC9zcmMvbWFpbi9qYXZhL2NvbS9oZWRlcmEvbm9kZS9hcHAvcm9zdGVyL1Jvc3RlclNlcnZpY2VJbXBsLmphdmE=) | `100.00% <100.00%> (ø)` | | | [...era/node/app/roster/schemas/V0540RosterSchema.java](https://app.codecov.io/gh/hashgraph/hedera-services/pull/15096?src=pr&el=tree&filepath=hedera-node%2Fhedera-app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fhedera%2Fnode%2Fapp%2Froster%2Fschemas%2FV0540RosterSchema.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hashgraph#diff-aGVkZXJhLW5vZGUvaGVkZXJhLWFwcC9zcmMvbWFpbi9qYXZhL2NvbS9oZWRlcmEvbm9kZS9hcHAvcm9zdGVyL3NjaGVtYXMvVjA1NDBSb3N0ZXJTY2hlbWEuamF2YQ==) | `92.30% <100.00%> (ø)` | | | [...s/platform/roster/InvalidAddressBookException.java](https://app.codecov.io/gh/hashgraph/hedera-services/pull/15096?src=pr&el=tree&filepath=platform-sdk%2Fswirlds-platform-core%2Fsrc%2Fmain%2Fjava%2Fcom%2Fswirlds%2Fplatform%2Froster%2FInvalidAddressBookException.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hashgraph#diff-cGxhdGZvcm0tc2RrL3N3aXJsZHMtcGxhdGZvcm0tY29yZS9zcmMvbWFpbi9qYXZhL2NvbS9zd2lybGRzL3BsYXRmb3JtL3Jvc3Rlci9JbnZhbGlkQWRkcmVzc0Jvb2tFeGNlcHRpb24uamF2YQ==) | `0.00% <0.00%> (ø)` | | | [...a/com/swirlds/platform/roster/RosterRetriever.java](https://app.codecov.io/gh/hashgraph/hedera-services/pull/15096?src=pr&el=tree&filepath=platform-sdk%2Fswirlds-platform-core%2Fsrc%2Fmain%2Fjava%2Fcom%2Fswirlds%2Fplatform%2Froster%2FRosterRetriever.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hashgraph#diff-cGxhdGZvcm0tc2RrL3N3aXJsZHMtcGxhdGZvcm0tY29yZS9zcmMvbWFpbi9qYXZhL2NvbS9zd2lybGRzL3BsYXRmb3JtL3Jvc3Rlci9Sb3N0ZXJSZXRyaWV2ZXIuamF2YQ==) | `91.42% <91.42%> (ø)` | | ... and [20 files with indirect coverage changes](https://app.codecov.io/gh/hashgraph/hedera-services/pull/15096/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hashgraph) [![Impacted file tree graph](https://app.codecov.io/gh/hashgraph/hedera-services/pull/15096/graphs/tree.svg?width=650&height=150&src=pr&token=ZPMV8C93DV&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hashgraph)](https://app.codecov.io/gh/hashgraph/hedera-services/pull/15096?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hashgraph)
codacy-production[bot] commented 2 months ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: +0.03% (target: -1.00%) :white_check_mark: 92.11%
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (3158b499104472a96786e3407c48f2d6a2c21a07) | 112290 | 70117 | 62.44% | | | Head commit (f3891977efe9c7bb98595198ca85d83a047b4556) | 112362 (+72) | 70196 (+79) | 62.47% (**+0.03%**) | **Coverage variation** is the difference between the coverage for the head and common ancestor commits of the pull request branch: ` - `
Diff coverage details | | Coverable lines | Covered lines | Diff coverage | | ------------- | ------------- | ------------- | ------------- | | Pull request (#15096) | 76 | 70 | **92.11%** | **Diff coverage** is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: `/ * 100%`

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more