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.
- It moves the
tx_container(transaction pool access) directly into theMode.tvariant forSequencer,Proxy, andObservermodes. - It removes the
Forward_containerimplementation. - It updates the
Rpcmode to forward requests (likeeth_sendRawTransaction) directly using theInjectormodule 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.ttype definition inmode.mlhas been updated.Sequencer,Proxy, andObserverconstructors now carry thetx_container. TheRpcconstructor now carries theevm_node_private_endpoint. -
Services Signature: Functions in
services.ml(likedispatch_handler,dispatch_public, etc.) no longer taketx_containeras a separate argument, as it is now extracted from themodewhen available. -
Removal of Forwarder: The
Forward_containermodule inrpc.mlhas been deleted. -
Direct Injection: In
services.ml, methods likesend_raw_transactionandget_transaction_countnow pattern match on themode:- If
Rpc: It forwards the call to the configured local endpoint. - If
Sequencer/Proxy/Observer: It uses the localtx_containerattached to the mode.
- If
Manually testing the MR
- Launch a Sequencer/Sandbox: Start an EVM node in sequencer.
-
Launch an RPC Node: Start a second EVM node in
rpcmode. -
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.
-
Read State: query
eth_getTransactionCountoreth_getTransactionByHashon 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.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Sylvain R.