-
Notifications
You must be signed in to change notification settings - Fork 91
feat: validate that operator account has positive balance #3930
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
Conversation
Test Results 20 files ±0 277 suites ±0 18m 2s ⏱️ +5s Results for commit c1224f4. ± Comparison against base commit f82f220. This pull request removes 1 test.♻️ This comment has been updated with latest results. |
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
8fa49fb to
c1224f4
Compare
quiet-node
left a comment
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.
LG left some thought
quiet-node
left a comment
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.
LGTM! Great work as always!
|
After an offline discussion with the team, we came to the conclusion that the start up validation shouldn't be in the
Moreover, there is already an
hiero-json-rpc-relay/packages/relay/src/lib/relay.ts Lines 250 to 259 in c1224f4
so having |
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## main #3930 +/- ##
==========================================
- Coverage 86.86% 86.75% -0.11%
==========================================
Files 87 87
Lines 5039 5045 +6
Branches 1020 1022 +2
==========================================
Hits 4377 4377
- Misses 400 407 +7
+ Partials 262 261 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
Description:
This PR validates that the operator account
OPERATOR_ID_MAINhas positive balance when starting up the Relay/WebSocket server in Read-Write mode. If the operator account has no balance (or does not exist), the Relay/WebSocket will fail on start up.Related issue(s):
Fixes #3929.
Notes for reviewer:
Note
This PR introduces an
asyncstart up check. It needs to beasyncbecause it needs to make a request to the Mirror Node to get the operator's balance. This check needs to be placed directly inmain(for both Relay and WebSocket) because theConfigServiceloading process is sync (noPromises involved). It cannot be placed in theRelay's constructor either because this will lead to anasyncconstructor.Note
Initial discussion can be found here #3896 (comment).
Note
In
packages/relay/tests/lib/eth/eth-helpers.ts, some@ts-ignorecomments were removed because they were not exercised. We should use@ts-expect-errorinstead.Note
In
packages/relay/tests/lib/eth/eth_getBalance.spec.ts, code related toSDKClientwas removed because it's not used anymore.Checklist