-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fix: Resolve Type Warnings for ConfigService.get() #3350
Fix: Resolve Type Warnings for ConfigService.get() #3350
Conversation
@Nana-EC @ebadiere @quiet-node I've submitted a PR addressing issue #3142 to resolve type warnings for ConfigService.get(). It ensures type consistency across test cases by refining type usage and adding/removing the necessary casting. Let me know if further changes are needed. Thank you for reviewing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution.
packages/relay/tests/lib/config/hbarSpendingPlanConfigService.spec.ts
Outdated
Show resolved
Hide resolved
27253f5
to
7f440e4
Compare
@Nana-EC @acuarica @quiet-node, Could you please review my updates and let me know if further adjustments are needed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @belloibrahv, thanks for taking the time to send this, it's looking good. Left a couple of suggestions we can continue iterating on to improve the config.
packages/config-service/tests/src/services/configService.spec.ts
Outdated
Show resolved
Hide resolved
packages/config-service/tests/src/services/configService.spec.ts
Outdated
Show resolved
Hide resolved
Also @belloibrahv please take a look at #3350 (comment). |
7f440e4
to
c7e6a08
Compare
@quiet-node @acuarica @Nana-EC @shemnon , thank you for the suggestion. I've implemented the following changes based on your feedback:
Let me know if there's anything else you'd like me to address! |
@acuarica, Thank you for the suggestion! I think adding a Would you suggest we implement these methods for this task or address it as a follow-up? Also, should these methods throw errors for mismatched types, or return defaults like |
Let's do it in a separate PR after this. Also appreciate the patience. |
Hi @quiet-node, @acuarica, @Nana-EC, @shemnon, Hope you all had a wonderful holiday! When you have a moment, please review and provide feedback on the requested changes to the PR. Thank you for your understanding! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @belloibrahv, hope you had a wonderful holiday too! It's looking good, left some comments.
We appreciate your patience on this. Next week the full team will be back from holidays, so you'll get more reviews.
packages/relay/tests/lib/config/hbarSpendingPlanConfigService.spec.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Logan Nguyen <[email protected]>
Signed-off-by: Logan Nguyen <[email protected]>
Signed-off-by: Logan Nguyen <[email protected]>
Signed-off-by: Logan Nguyen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @belloibrahv and @quiet-node for putting the effort to get this done. Great stuff!
…h config value Signed-off-by: Logan Nguyen <[email protected]>
…ith config Signed-off-by: Logan Nguyen <[email protected]>
Signed-off-by: Logan Nguyen <[email protected]>
…h config Signed-off-by: Logan Nguyen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work!
@quiet-node @acuarica @natanasow @Nana-EC 🚀 🚀🚀 Thank You all |
Codecov ReportAttention: Patch coverage is
❌ Your project check has failed because the head coverage (53.61%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.
Additional details and impacted files@@ Coverage Diff @@
## main #3350 +/- ##
===========================================
- Coverage 85.58% 53.61% -31.98%
===========================================
Files 69 65 -4
Lines 4753 4525 -228
Branches 1059 979 -80
===========================================
- Hits 4068 2426 -1642
- Misses 393 1700 +1307
- Partials 292 399 +107
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: Logan Nguyen <[email protected]> Revert "fix(ci): fixed ci test with fallback log level" This reverts commit 9af4396. Reapply "fix(ci): fixed ci test with fallback log level" This reverts commit bd81c5729ffa7e4e20cf07cccbec718aff61af9b. Revert "fix(ci): fixed ci test with fallback log level" This reverts commit 981cad0a66a4e487d6e396dfcc0fa1123f19296f. Reapply "fix(ci): fixed ci test with fallback log level" This reverts commit 87eb44fd5fcd09156210cd431d7a0d00e9f8e720.
fa189dd
to
67a8e75
Compare
Signed-off-by: Logan Nguyen <[email protected]>
|
Thanks, team, for the great responses and feedback! Congrats on the merge, @belloibrahv! Appreciate your effort and patience—looking forward to more of your contributions in the future! |
Thank You all for helping out, I look forward to working and collaborating on more work. |
* fix: resolve type warnings for ConfigService.get() - Ensured type consistency in all affected test cases. - Removed unnecessary type casting or added necessary casting. Signed-off-by: belloibrahv <[email protected]> * fix: resolve type warnings for ConfigService.get() - Ensured type consistency in all affected test cases. - Removed unnecessary type casting or added necessary casting. Signed-off-by: belloibrahv <[email protected]> * Refactor GlobalConfig and revert header changes as per feedback Signed-off-by: belloibrahv <[email protected]> * Reverting License Header Changes Signed-off-by: belloibrahv <[email protected]> * Refinment of ConfigService.get() (to conform to newly suggested changes) Signed-off-by: belloibrahv <[email protected]> * Refactor ConfigService.get to enhance type safety and remove manual casting Signed-off-by: belloibrahv <[email protected]> * fix bugs in workflow Signed-off-by: belloibrahv <[email protected]> * Remove assesrtion Signed-off-by: belloibrahv <[email protected]> * Remove assesrtion Signed-off-by: belloibrahv <[email protected]> * Add assertion to _CONFIG (in the globalConfig.ts file) Signed-off-by: belloibrahv <[email protected]> * chore: renamed types and added explanation Signed-off-by: Logan Nguyen <[email protected]> * fix: loosen strict type checking for array types in config variables Signed-off-by: Logan Nguyen <[email protected]> * fix: modified GetTypeOfConfigKey to resolve to better types Signed-off-by: Logan Nguyen <[email protected]> * fix: updated properly default values to all global configs Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed ConfigService unit test Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed LocalLRUCache suite Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed HbarSpendingPlanConfigService suite Signed-off-by: Logan Nguyen <[email protected]> * chore: updated type explanation Signed-off-by: Logan Nguyen <[email protected]> Revert "chore: updated type explanation" This reverts commit ecd8d6e. Reapply "chore: updated type explanation" This reverts commit 6756ecb1ee558c7d20fb8f7a71e2fbee70bb75ad. * fix: modified typeCasting to always convert CHAIN_ID to hexadecimal value Signed-off-by: Logan Nguyen <[email protected]> * fix: further tighten ConfigService.get() Signed-off-by: Logan Nguyen <[email protected]> * Update web3.ts Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed test in net Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed test in web3 Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed eth_feeHistory Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed filter API Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed HbarLimitService unit test Signed-off-by: Logan Nguyen <[email protected]> Revert "fixed shouldLimit v1" This reverts commit 2f745e6f6188d7c4d84da931793544200420d073. Reapply "fixed shouldLimit v1" This reverts commit f280bbf311a4e407ed2c158d372581e2b8b36e25. s Signed-off-by: Logan Nguyen <[email protected]> Revert "fix: fixed HbarLimitService unit test" This reverts commit ec28eee. Reapply "fix: fixed HbarLimitService unit test" This reverts commit e27bae25cb51f5a49db525c5e66e08b3da2c3c15. Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed utils.spec.ts Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed BATCH_REQUESTS_ENABLED enabled by default Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed ws-server unit Signed-off-by: Logan Nguyen <[email protected]> * chore: switch MULTI_SET to false Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed newHeads test Signed-off-by: Logan Nguyen <[email protected]> * fix: removed type array in GlobalConfig Signed-off-by: Logan Nguyen <[email protected]> * fix: reverted Copyright Signed-off-by: Logan Nguyen <[email protected]> * chore: converted JSDoc to TSDoc Signed-off-by: Logan Nguyen <[email protected]> * chore: replaced constant CACHE_MAX with config Signed-off-by: Logan Nguyen <[email protected]> * chore: replaced constant CACHE_TTL.ONEHOUR with config 'CACHE_TTL' Signed-off-by: Logan Nguyen <[email protected]> * chore: replaced constants.SEND_RAW_TRANSACTION_SIZE_LIMIT with config Signed-off-by: Logan Nguyen <[email protected]> * chore: replaced constants. DEFAULT_ETH_GET_LOGS_BLOCK_RANGE_LIMIT with config value Signed-off-by: Logan Nguyen <[email protected]> * chore: replaced constants.ETH_GET_TRANSACTION_COUNT_MAX_BLOCK_RANGE with config Signed-off-by: Logan Nguyen <[email protected]> * chore: replaced constants.MIRROR_NODE_RETRY_DELAY_DEFAULT with config Signed-off-by: Logan Nguyen <[email protected]> * chore: replaced constants.MIRROR_NODE_REQUEST_RETRY_COUNT_DEFAULT with config Signed-off-by: Logan Nguyen <[email protected]> * fix(ci): fixed ci test with fallback log level Signed-off-by: Logan Nguyen <[email protected]> Revert "fix(ci): fixed ci test with fallback log level" This reverts commit 9af4396. Reapply "fix(ci): fixed ci test with fallback log level" This reverts commit bd81c5729ffa7e4e20cf07cccbec718aff61af9b. Revert "fix(ci): fixed ci test with fallback log level" This reverts commit 981cad0a66a4e487d6e396dfcc0fa1123f19296f. Reapply "fix(ci): fixed ci test with fallback log level" This reverts commit 87eb44fd5fcd09156210cd431d7a0d00e9f8e720. * fix: alphabeticalized configuration tables Signed-off-by: Logan Nguyen <[email protected]> --------- Signed-off-by: belloibrahv <[email protected]> Signed-off-by: Logan Nguyen <[email protected]> Co-authored-by: Logan Nguyen <[email protected]>
Description:
TL;DR; Enhancing Type Inference, Config Consistency, and Establishing a Single Source of Truth in ConfigService
This PR significantly improves type inference in
ConfigService.get()
, ensuring more reliable and explicit type resolution across configurations.It also updates the entire codebase to adhere to a single source of truth for configuration management, enhancing consistency, reliability, and maintainability.
Key improvements include:
ConfigService.get()
, introducing explicit TypeScript types and interfaces that precisely map config keys to their expected types, reducing manual casting and type mismatches.configurations.md
, enhancing correctness and consistency.configurations.md
, ensuring proper documentation and organization.These enhancements improve type safety, reliability, and maintainability, making the configuration system more robust and easier to manage across the entire codebase.
Related issue(s):
Fixes #3142
Checklist: