[go: up one dir, main page]

EVM node: remove the forwarder transaction container

What

close L2-646

This MR refactors how the EVM node handles transaction containers and the RPC mode.

  1. It moves the tx_container (transaction pool access) directly into the Mode.t variant for Sequencer, Proxy, and Observer modes.
  2. It removes the Forward_container implementation.
  3. It updates the Rpc mode to forward requests (like eth_sendRawTransaction) directly using the Injector module via HTTP, rather than wrapping them in a pseudo-container.

Why

Previously, the Rpc mode utilized a Forward_container to mimic a tx container interface while actually just forwarding requests to an upstream node. This abstraction added unnecessary complexity.

By attaching the tx_container only to modes that actually manage a pool (Sequencer, Proxy, Observer) and making the Rpc mode explicitly use the HTTP Injector for forwarding, we simplify the codebase, remove the Forward_container boilerplate, and make the distinction between stateful nodes and forwarding nodes clearer.

How

  • Mode Refactor: The Mode.t type definition in mode.ml has been updated. Sequencer, Proxy, and Observer constructors now carry the tx_container. The Rpc constructor now carries the evm_node_private_endpoint.
  • Services Signature: Functions in services.ml (like dispatch_handler, dispatch_public, etc.) no longer take tx_container as a separate argument, as it is now extracted from the mode when available.
  • Removal of Forwarder: The Forward_container module in rpc.ml has been deleted.
  • Direct Injection: In services.ml, methods like send_raw_transaction and get_transaction_count now pattern match on the mode:
    • If Rpc: It forwards the call to the configured local endpoint.
    • If Sequencer/Proxy/Observer: It uses the local tx_container attached to the mode.

Manually testing the MR

  1. Launch a Sequencer/Sandbox: Start an EVM node in sequencer.
  2. Launch an RPC Node: Start a second EVM node in rpc mode.
  3. Send Transaction: Send a transaction (e.g., a transfer) to the RPC node.
    • Verify that the RPC node successfully forwards it.
    • Verify the Sequencer receives it and includes it in a block.
  4. Read State: query eth_getTransactionCount or eth_getTransactionByHash on the RPC node to ensure read forwarding works correctly.

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Sylvain R.

Merge request reports

Loading