From cfaa417788df026df5920cedb3213377bd191379 Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin Date: Thu, 11 Apr 2024 16:15:01 +0100 Subject: [PATCH] optimism -> op_bridge --- Cargo.toml | 2 +- examples/exex/{optimism => op_bridge}/Cargo.toml | 0 .../l1_standard_bridge_abi.json | 0 examples/exex/{optimism => op_bridge}/src/main.rs | 14 ++++++++------ 4 files changed, 9 insertions(+), 7 deletions(-) rename examples/exex/{optimism => op_bridge}/Cargo.toml (100%) rename examples/exex/{optimism => op_bridge}/l1_standard_bridge_abi.json (100%) rename examples/exex/{optimism => op_bridge}/src/main.rs (95%) diff --git a/Cargo.toml b/Cargo.toml index fede2d290dbdb..7255a7afe5be7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,7 +77,7 @@ members = [ "examples/trace-transaction-cli/", "examples/polygon-p2p/", "examples/custom-inspector/", - "examples/exex/optimism/", + "examples/exex/op_bridge/", "testing/ef-tests/", ] default-members = ["bin/reth"] diff --git a/examples/exex/optimism/Cargo.toml b/examples/exex/op_bridge/Cargo.toml similarity index 100% rename from examples/exex/optimism/Cargo.toml rename to examples/exex/op_bridge/Cargo.toml diff --git a/examples/exex/optimism/l1_standard_bridge_abi.json b/examples/exex/op_bridge/l1_standard_bridge_abi.json similarity index 100% rename from examples/exex/optimism/l1_standard_bridge_abi.json rename to examples/exex/op_bridge/l1_standard_bridge_abi.json diff --git a/examples/exex/optimism/src/main.rs b/examples/exex/op_bridge/src/main.rs similarity index 95% rename from examples/exex/optimism/src/main.rs rename to examples/exex/op_bridge/src/main.rs index d1a8b9ce78897..afa47b4981bb6 100644 --- a/examples/exex/optimism/src/main.rs +++ b/examples/exex/op_bridge/src/main.rs @@ -16,12 +16,12 @@ use rusqlite::Connection; sol!(L1StandardBridge, "l1_standard_bridge_abi.json"); use crate::L1StandardBridge::{ETHBridgeFinalized, ETHBridgeInitiated, L1StandardBridgeEvents}; -struct OptimismExEx { +struct OPBridgeExEx { ctx: ExExContext, connection: Connection, } -impl OptimismExEx { +impl OPBridgeExEx { fn new(ctx: ExExContext, connection: Connection) -> eyre::Result { // Create deposits and withdrawals tables connection.execute( @@ -85,7 +85,7 @@ impl OptimismExEx { } } -impl Future for OptimismExEx { +impl Future for OPBridgeExEx { type Output = eyre::Result<()>; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { @@ -189,6 +189,8 @@ impl Future for OptimismExEx { } } +/// Decode chain of blocks into a flattened list of receipt logs, and filter only +/// [L1StandardBridgeEvents]. fn decode_chain_into_events( chain: &Chain, ) -> impl Iterator @@ -218,9 +220,9 @@ fn main() -> eyre::Result<()> { reth::cli::Cli::parse_args().run(|builder, _| async move { let handle = builder .node(EthereumNode::default()) - .install_exex("Optimism", move |ctx| async { - let connection = Connection::open("optimism.db")?; - OptimismExEx::new(ctx, connection) + .install_exex("OPBridge", move |ctx| async { + let connection = Connection::open("op_bridge.db")?; + OPBridgeExEx::new(ctx, connection) }) .launch() .await?;