Skip to content

Json RPC Relay READ ONLY OR READ-WRITE mode #3878

@Ferparishuertas

Description

@Ferparishuertas

Context

When I run the json rpc-relay I want to be able to start either on read-only mode or read-write mode, specifying the mode on the config file.
When I configured it on read-only mode, no CN call can be done, and any rpc call that is CN related should raise an error as "RPC method not allowed on read-only mode". When I have read only mode Hbar limiter should be deactivated
When i run on write-mode, operator account should specified, and if not, relay shoul be unable to startup.
When i run on write-mode, Hbar Rate limiter can be enabled

Acceptance criteria

  • A new Config entry should be added called JSON:RPC_RELAY_MODE, which values read-only| read-write ( by default)
  • Config endpoint should reflect the new mode entry
  • Startup log should clearly specify " Starting Json Rpc Relay in ? mode
  • If read-only

-- I operator account is set we will warn that is set, but will not be used, a it is on read mode.

-- Hbar rate limiter cannot be enabled and a Warning message will indicate that Hbar limiter will be not enabled, if it is enabled by config

-- If eth_sendtransaction or other rpc method that invoke the CN are requestrf. relay should give and error response should be given with the associated code, saying "RPC method not allowed on read-only mode"

-- ETH_CALL_DEFAULT_TO_CONSENSUS_NODE cannot be enabled and a Warning message will indicate that ethcall will be not be sent to CN, an fail on every request

-- ETH_CALL_CONSENSUS_SELECTORS will not be applicable

  • If read-write

-- If no operator account is set, Relay should halt on startup, with a clear message "Read-Write mode enforces to have an operator account set"
-- On read write mode, HBAR rate limiter can be enabled, if its enabled

Pending Items

-Error Codes definitions

Tech Detaiils

  • ConfigService
    -- add the new flags
    -- ValidationService in the ConfigService: Check the config and override, warn/fail based on values and mode
    -- ? Server

--- Fail on sendRawTx if o

  • Documentation

Sub-issues

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions