Skip to content

Log engine api calls #503

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

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/op-rbuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ reth-payload-util.workspace = true
reth-transaction-pool.workspace = true
reth-testing-utils.workspace = true
reth-optimism-forks.workspace = true
reth-rpc-eth-api.workspace = true

alloy-primitives.workspace = true
alloy-consensus.workspace = true
alloy-eips.workspace = true
Expand Down
56 changes: 56 additions & 0 deletions crates/op-rbuilder/src/engine_api_ext.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//! Odyssey rpc logic.
//!
//! `eth_` namespace overrides:
//!
//! - `eth_getProof` will _ONLY_ return the storage proofs _WITHOUT_ an account proof _IF_ targeting
//! the withdrawal contract. Otherwise, it fallbacks to default behaviour.

use alloy_eips::BlockId;
use alloy_primitives::{Address, B256};
use alloy_rpc_types_engine::{ExecutionPayloadV3, PayloadStatus};
use alloy_rpc_types_eth::EIP1186AccountProofResponse;
use jsonrpsee::{
core::{async_trait, RpcResult},
proc_macros::rpc,
};
use reth_rpc_eth_api::helpers::FullEthApi;
use tracing::trace;

#[rpc(server, client, namespace = "eth")]
pub trait EthApiOverride {
#[method(name = "newPayloadV3")]
async fn new_payload_v3(
&self,
payload: ExecutionPayloadV3,
versioned_hashes: Vec<B256>,
parent_beacon_block_root: B256,
) -> RpcResult<PayloadStatus>;
}

/// Implementation of the `eth_` namespace override
#[derive(Debug)]
pub struct EthApiExt<Eth> {
eth_api: Eth,
}

impl<E> EthApiExt<E> {
/// Create a new `EthApiExt` module.
pub const fn new(eth_api: E) -> Self {
Self { eth_api }
}
}

#[async_trait]
impl<Eth> EthApiOverrideServer for EthApiExt<Eth>
where
Eth: FullEthApi + Send + Sync + 'static,
{
async fn new_payload_v3(
&self,
payload: ExecutionPayloadV3,
versioned_hashes: Vec<B256>,
parent_beacon_block_root: B256,
) -> RpcResult<PayloadStatus> {
panic!("Not implemented");
}
}
10 changes: 10 additions & 0 deletions crates/op-rbuilder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ use reth_optimism_cli::{chainspec::OpChainSpecParser, Cli};
use reth_optimism_node::node::OpAddOnsBuilder;
use reth_optimism_node::OpNode;

use crate::engine_api_ext::EthApiOverrideServer;
#[cfg(feature = "flashblocks")]
use payload_builder::CustomOpPayloadBuilder;
#[cfg(not(feature = "flashblocks"))]
use payload_builder_vanilla::CustomOpPayloadBuilder;

/// CLI argument parsing.
pub mod args;
mod engine_api_ext;
use engine_api_ext::EthApiExt;
pub mod generator;
#[cfg(test)]
mod integration;
Expand Down Expand Up @@ -60,6 +63,13 @@ fn main() {

Ok(())
})
.extend_rpc_modules(move |ctx| {
ctx.modules.replace_configured(
EthApiExt::new(ctx.registry.eth_api().clone()).into_rpc(),
)?;

Ok(())
})
.launch()
.await?;

Expand Down
Loading