-
Notifications
You must be signed in to change notification settings - Fork 90
feat: introduce READ_ONLY mode
#3896
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
feat: introduce READ_ONLY mode
#3896
Conversation
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Test Results 20 files + 4 278 suites +56 17m 55s ⏱️ + 3m 3s Results for commit 8b3ea3d. ± Comparison against base commit 3684f3c. This pull request removes 1 and adds 154 tests. Note that renamed tests count towards both.♻️ 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]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
Signed-off-by: Luis Mastrangelo <[email protected]>
|
Hi @konstantinabl, it should be ok to merge this now. I wouldn't wait until we merge PR #3918. |
|
We are considering to include one additional requirement as part of this PR. That is, to ensure the operator has positive balance before starting the JSON-RPC Relay/WebSocket. This requirement can be seen as new validation, which is independent of the Read-Only mode feature. This simply change, however, has some implications. Currently, the start of the Relay is sync, i.e., there are no promises running until Koa server starts listening. This means that the validation logic needs to be placed in both Relay and WebSocket's Therefore, we can either
|
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #3896 +/- ##
=======================================
Coverage ? 87.00%
=======================================
Files ? 87
Lines ? 5094
Branches ? 1042
=======================================
Hits ? 4432
Misses ? 387
Partials ? 275
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Description:
This PR introduces a Read-Only execution mode for the JSON-RPC Relay. In Read-Only mode, RPC methods that need the operator settings, i.e.,
OPERATOR_ID_MAINandOPERATOR_KEY_MAIN, are disabled (returningUnsupported operationerror).You can enable Read-Only mode by setting the configuration variable
READ_ONLYtotrue. Note that in Read-Only mode, both configuration variablesOPERATOR_ID_MAINandOPERATOR_KEY_MAINwill not be used and should not be set.Related issue(s):
Fixes #3878.
Notes for reviewer:
Note
eth_callmight call the CN if eitherETH_CALL_CONSENSUS_SELECTORSapplies orETH_CALL_DEFAULT_TO_CONSENSUS_NODEis set. However, these variables are in the process to be removedETH_CALL_DEFAULT_TO_CONSENSUS_NODE,OPERATOR_ID_ETH_SENDRAWTRANSACTIONandOPERATOR_KEY_ETH_SENDRAWTRANSACTION#3918Therefore, these variables are not taken into account when Read-Only mode is activated.
Note
Initially, the logic to check for the
READ_ONLYflag was placed inSDKClient.executeTransaction. However, there was an issue whenUSE_ASYNC_TX_PROCESSINGwas set. In this case, the transaction hash would be returned in Read-Only mode. This is not the desired outcome, as we want the user to getUnsupported operationerror. That's why the logic was placed inTransactionService.sendRawTransaction.Note
Usages of
@ts-ignorewere replaced by@ts-expect-errorin the updated tests. We should prefer@ts-expect-errorso we can detect unused directives. Also, TypeScript error messages were included to be more explicit about the ignored error.Checklist