[go: up one dir, main page]

EVM Node: Introduce sequencer rpc_server family and restrict sequencer rpcs

What

This Merge Request enhances the differentiation of RPC services across node types:

  • Sequencer Node: Provides RPC services relevant to both multi-chain and single-chain contexts, restricting available methods to those necessary for sequencers.
  • Non-Sequencer Node: Supports RPC services exclusively within single-chain contexts, further specialized by chain family. This category includes:
    • Observer Nodes
    • Proxy Nodes

Additionally, it limits the sequencer RPCs to the following:

Rollup RPCs:

  • eth_blockNumber: Now computed independently of a specific chain, using the predecessor of the next blueprint number.
  • /evm/smart_rollup_address
  • /evm/time_between_blocks

Blueprint RPCs:

  • /evm/blueprint/<n>: Query parameter extended with an optional chain_id field.
  • /evm/blueprints: Same update as above.
  • /evm/messages: Same update as above.

L2 Chain RPCs:

  • eth_sendRawTransaction: The transaction parameter already includes a chain_id, allowing correct routing to the appropriate tx-pool.

Private RPCs:

We do not restric any of the private RPCs.

How

This MR creates a rpc_server_family type. It then updates all node main functions to pass it as a parameter to the rpc_server. Notice that this parameter is None if the enable_multichain feature flag is disabled, and does not change the behaviour of the current node.

The chain_family is then propagated through the execution stack until method resolution occurs, where supported and unsupported methods are filtered based on rpc_server_family. This approach ensures that:

  • Sequencer methods are properly restricted.
  • The method lists for evm and michelson nodes remain intact.

Manually testing this MR

Trying to execute a test such as Alpha: RPC method getBalance uses block parameter (sequencer, latest, without dal, multichain) fails on master before !17058 (merged) is merged as it calls a restricted RPC on the sequencer.

By applying the commits from !17058 (merged) as follows git cherry-pick 488c43a56de56c909bb91181b24149c9e7aadd43^..99d6c08533fc44f099e00389613efe8b93e303f4 it passes again, as the RPC call is now redirected to an RPC node wrapping the sequencer.

Edited by Luciano Freitas

Merge request reports

Loading