hedera-json-rpc-relay
hedera-json-rpc-relay copied to clipboard
feat: replaced HbarLimit module with the new HbarLimitService class
trafficstars
Description:
- This PR replaces all usages of the
HbarLimitmodule with the newHbarLimitServiceclass in theSdkClientandMetricServiceclasses. - Removes the
HbarLimitmodule from the codebase. - The
addExpenselogic in the newHbarLimitServicehas been updated to accept a nullableethAddressvalue. Certain queries, such asgetAccountInfo,getBalanceInfo,FileContentsQuery, etc., also add expenses toremainingBalancebut don’t always require anoriginalCaller(ethAddress). Therefore,addExpensecan now handle a nullableethAddressvalue. If eitherethAddressoripAddressis valid, thespendingPlanlogic is applied. Otherwise, it is skipped entirely. - Moved the preemptive rate limit logic to the
sdkClient.createFile()method. - Related tests have been updated to align with the new
HbarLimitServiceclass. - Updated log messages accordingly.
Related issue(s):
Fixes #2896
Notes for reviewer:
Checklist
- [x] Documented (Code comments, README, etc.)
- [x] Tested (unit, integration, etc.)