paradigmxyz / reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
https://reth.rs/
Apache License 2.0
3.8k stars 1.04k forks source link

ExEx starts up and exits afterwards without any error/warning #10227

Open 0xcirxle opened 1 month ago

0xcirxle commented 1 month ago

Describe the bug

I ran into an issue while trying to learn and work with ExExes

As of right now i am unable to understand what is going wrong with my implementation.

Steps to reproduce

  1. Follow the steps given on this page and setup the hello world exex.
  2. run this command cargo run -- init --chain holesky --datadir "db" with a suitable directory in place of db.

Node logs

2024-08-07T05:21:04.045702Z  INFO reth::cli: Initialized tracing, debug log directory: /Users/aniruddh/Library/Caches/reth/logs/holesky
2024-08-07T05:21:04.048332Z  INFO reth::cli: reth init starting
2024-08-07T05:21:04.051719Z  INFO reth::cli: Opening storage db_path="/Volumes/Aniruddh\'s T7 Shield/node/holeskyy/execution/db" sf_path="/Volumes/Aniruddh\'s T7 Shield/node/holeskyy/execution/static_files"
2024-08-07T05:21:04.249022Z DEBUG storage::db::mdbx: Commit total_duration=177.947375ms commit_latency=Some(CommitLatency(MDBX_commit_latency { preparation: 0, gc_wallclock: 21, audit: 0, write: 0, sync: 11637, ending: 0, whole: 11659, gc_cputime: 889, gc_prof: MDBX_commit_latency__bindgen_ty_1 { wloops: 1, coalescences: 1, wipes: 0, flushes: 0, kicks: 0, 
work_counter: 1, work_rtime_monotonic: 13, work_xtime_cpu: 218, work_rsteps: 4, work_xpages: 0, work_majflt: 0, self_counter: 0, self_rtime_monotonic: 0, self_xtime_cpu: 376, self_rsteps: 0, self_xpages: 0, self_majflt: 0 } })) is_read_only=false
2024-08-07T05:21:04.266103Z  INFO reth::cli: Verifying storage consistency.
2024-08-07T05:21:04.361313Z DEBUG reth::cli: Initializing genesis chain=holesky genesis=0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4
2024-08-07T05:21:04.362927Z DEBUG reth_db_common::init: Genesis already written, skipping.
2024-08-07T05:21:04.363033Z  INFO reth::cli: Genesis block written hash=0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4

Platform(s)

Mac (Apple Silicon)

What version/commit are you on?

1.0.1

What database version are you on?

command not working. getting this in return :


Initialized tracing, debug log directory: /Users/aniruddh/Library/Caches/reth/logs/mainnet
Error: Datadir does not exist: "/Users/aniruddh/Library/Application Support/reth/mainnet"

Location:
    /Users/aniruddh/Downloads/reth/crates/cli/commands/src/db/mod.rs:71:9

### Which chain / network are you on?

holesky

### What type of node are you running?

Archive (default)

### What prune config do you use, if any?

_No response_

### If you've built Reth from source, provide the full command you used

_No response_

### Code of Conduct

- [X] I agree to follow the Code of Conduct
shekhirin commented 1 month ago

Can you show your code that you've used to run ExEx? Also, please attach debug logs from ~/.cache/reth/logs/mainnet/reth.log.

0xcirxle commented 1 month ago

Sure! Here's the code i ran for this ExEx :

use reth::api::FullNodeComponents;
use reth_exex::{ExExContext, ExExEvent, ExExNotification};
use reth_node_ethereum::EthereumNode;
use reth_tracing::tracing::info;

async fn my_exex<Node: FullNodeComponents>(mut ctx: ExExContext<Node>) -> eyre::Result<()> {
    while let Some(notification) = ctx.notifications.recv().await {
        match &notification {
            ExExNotification::ChainCommitted { new } => {
                info!(committed_chain = ?new.range(), "Received commit");
            }
            ExExNotification::ChainReorged { old, new } => {
                info!(from_chain = ?old.range(), to_chain = ?new.range(), "Received reorg");
            }
            ExExNotification::ChainReverted { old } => {
                info!(reverted_chain = ?old.range(), "Received revert");
            }
        };

        if let Some(committed_chain) = notification.committed_chain() {
            ctx.events
                .send(ExExEvent::FinishedHeight(committed_chain.tip().number))?;
        }
    }

    Ok(())
}

fn main() -> eyre::Result<()> {
    reth::cli::Cli::parse_args().run(|builder, _| async move {
        let handle = builder
            .node(EthereumNode::default())
            .install_exex("my-exex", |ctx| async move { Ok(my_exex(ctx)) })
            .launch()
            .await?;

        handle.wait_for_node_exit().await
    })
}

I assume you mean the logs on holesky and not mainnet

here are the debug logs for both the times i tried to run this ExEx :

2024-08-07T05:21:04.045702Z  INFO reth::cli: Initialized tracing, debug log directory: /Users/aniruddh/Library/Caches/reth/logs/holesky
2024-08-07T05:21:04.048332Z  INFO reth::cli: reth init starting
2024-08-07T05:21:04.051719Z  INFO reth::cli: Opening storage db_path="/Volumes/Aniruddh\'s T7 Shield/node/holeskyy/execution/db" sf_path="/Volumes/Aniruddh\'s T7 Shield/node/holeskyy/execution/static_files"
2024-08-07T05:21:04.249022Z DEBUG storage::db::mdbx: Commit total_duration=177.947375ms commit_latency=Some(CommitLatency(MDBX_commit_latency { preparation: 0, gc_wallclock: 21, audit: 0, write: 0, sync: 11637, ending: 0, whole: 11659, gc_cputime: 889, gc_prof: MDBX_commit_latency__bindgen_ty_1 { wloops: 1, coalescences: 1, wipes: 0, flushes: 0, kicks: 0, work_counter: 1, work_rtime_monotonic: 13, work_xtime_cpu: 218, work_rsteps: 4, work_xpages: 0, work_majflt: 0, self_counter: 0, self_rtime_monotonic: 0, self_xtime_cpu: 376, self_rsteps: 0, self_xpages: 0, self_majflt: 0 } })) is_read_only=false
2024-08-07T05:21:04.266103Z  INFO reth::cli: Verifying storage consistency.
2024-08-07T05:21:04.361313Z DEBUG reth::cli: Initializing genesis chain=holesky genesis=0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4
2024-08-07T05:21:04.362927Z DEBUG reth_db_common::init: Genesis already written, skipping.
2024-08-07T05:21:04.363033Z  INFO reth::cli: Genesis block written hash=0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4

and

2024-08-08T22:53:07.391574Z  INFO reth::cli: Initialized tracing, debug log directory: /Users/aniruddh/Library/Caches/reth/logs/holesky
2024-08-08T22:53:07.394209Z  INFO reth::cli: reth init starting
2024-08-08T22:53:07.467389Z  INFO reth::cli: Opening storage db_path="/Volumes/Aniruddh\'s T7 Shield/node/holeskyy/execution/db" sf_path="/Volumes/Aniruddh\'s T7 Shield/node/holeskyy/execution/static_files"
2024-08-08T22:53:07.505349Z  INFO reth::cli: Verifying storage consistency.
2024-08-08T22:53:07.700979Z DEBUG reth::cli: Initializing genesis chain=holesky genesis=0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4
2024-08-08T22:53:07.703464Z DEBUG reth_db_common::init: Genesis already written, skipping.
2024-08-08T22:53:07.703582Z  INFO reth::cli: Genesis block written hash=0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4

Please let me know if you require anything else.

shekhirin commented 2 weeks ago

@0xcirxle sorry for being silent on this, did you manage to resolve this issue? If not, we can look into it deeper and try to repro.

0xcirxle commented 2 weeks ago

Hi! No problems, I was actually just exploring the ExEx features at that time and I did not try to fix this. I moved on to do something else entirely. I guess you may close the issue, will try to use ExExes sometimes later on.

Thanks