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

feat(da-throttling): Introduce DA throttling via the MinerAPI #69

Merged
merged 103 commits into from
Feb 6, 2025

Conversation

0xKitsune
Copy link
Contributor

@0xKitsune 0xKitsune commented Jan 31, 2025

This PR introduces DA throttling to rollup-boost as well as fixes RPC module initialization. Note that this PR builds on #61, incorporating its changes.

Closes #48

This PR introduces DA throttling by implementing the MinerApiExtServer as an RPC module. Additionally, a MinerApi trait has been implemented for the remaining miner_ RPC endpoints. Tests were added for all newly introduced RPC modules.

While Reth provides a MinerApi, it is synchronous where rollup-boost requires an async implementation. To address this we recreated the trait within rollup-boost and can upstream this to Reth, allowing us to switch to reth-rpc-api once an async version is available.

Since the auth_rpc does not expose the Miner API, we introduced a new ExecutionClient struct to orchestrate requests to either the authenticated Engine API (via auth_client) or the JSON-RPC API (via client).

/// Client interface for interacting with an execution layer node.
///
/// - **Engine API** calls are faciliated via the `auth_client` (requires JWT authentication).
/// -  All other API calls including the **Eth & Miner APIs** are faciliated via the `client` (optional JWT authentication).
///
#[derive(Clone)]
pub struct ExecutionClient<C: ClientT = HttpClient<HttpBackend>> {
    /// Handles requests to Eth, Miner, and other execution layer APIs (optional JWT authentication)
    pub client: Arc<C>,
    /// Address of the RPC server for execution layer API calls, excluding the Engine API
    pub http_socket: SocketAddr,
    /// Handles requests to the authenticated Engine API (requires JWT authentication)
    pub auth_client: Arc<HttpClient<AuthClientService<HttpBackend>>>,
    /// Address of the RPC server for authenticated Engine API calls
    pub auth_socket: SocketAddr,
}

Fixes #63

Previously,the only RPC methods initialized were from the Engine API. This has been updated to ensure that EthApiServer, MinerApiServer, and MinerApiExtServer are properly merged into the RPC module.

// --snip--
fn try_into(self) -> Result<RpcModule<()>, Self::Error> {
    let mut module: RpcModule<()> = RpcModule::new(());
    module.merge(EngineApiServer::into_rpc(self.clone()))?;
    module.merge(EthApiServer::into_rpc(self.clone()))?;
    module.merge(MinerApiServer::into_rpc(self.clone()))?;
    module.merge(MinerApiExtServer::into_rpc(self))?;

    Ok(module)
}

Addresses #65

Since we introduced a client and auth_client for each execution client, we made a small update to the proxy logic to ensure that all non-multiplexed methods are routed to the auth RPC of the default L2 client with the proper authorization header.

0xOsiris and others added 12 commits February 2, 2025 11:44
@0xKitsune 0xKitsune requested a review from avalonche February 3, 2025 05:18
@ferranbt ferranbt merged commit 8a8cf88 into flashbots:main Feb 6, 2025
3 checks passed
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

Successfully merging this pull request may close these issues.

Bug: Only Engine API server modules are initialized in the Binary DA throttling
4 participants