Skip to content
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

Simplify handling of forwarded RPC methods #62

Closed
ferranbt opened this issue Jan 28, 2025 · 1 comment
Closed

Simplify handling of forwarded RPC methods #62

ferranbt opened this issue Jan 28, 2025 · 1 comment

Comments

@ferranbt
Copy link
Collaborator

We handle three types of RPC calls:

  • Direct fallback: sent only to fallback EL node (e.g., eth_getBlockByNumber)
  • Stateful multiplex: manipulate and forward to both nodes (e.g., engine_*)
  • Forward: same request to both nodes, no processing (e.g., eth_sendRawTransaction, miner_*)

With the recent addition of DA throttling, we've added several miner_ methods that just need forwarding (miner_setExtra, miner_setGasPrice, miner_setGasLimit, miner_setMaxDASize).

Each of these requires the same boilerplate server implementation just to forward requests:

impl<C> MinerApiServer for EthEngineApi<HttpClientWrapper<C>> {
    async fn set_gas_limit(&self, gas_price: U128) -> RpcResult<bool> {
        // Forward to builder
        let builder_client = self.builder_client.client.clone();
        tokio::spawn(async move {
            builder_client.set_gas_limit(gas_price).await
        });

        // Forward to L2
        self.l2_client.client.set_gas_limit(gas_price).await
    }
}

The proposal is to add a new list of FORWARD_METHODS to handle these simple forwarding cases automatically without requiring full server implementations.

@avalonche
Copy link
Collaborator

can't this already be achieved at the proxy layer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants