Skip to content

[Bug] IPC URL Parsing Fails with URL Scheme in config.toml #6204

@0x19dG87

Description

@0x19dG87

Bug report

Description

When configuring an IPC provider in config.toml, the URL parser rejects valid URI formats like ipc:///path/to/socket.ipc, file:///path/to/socket.ipc or /path/to/socket.ipc forcing users to use CLI arguments instead.

Steps to Reproduce

  1. Create a config.toml with IPC provider:
....
[chains.N]
shard = "primary"
provider = [
    { label = "archive-N", details = { type = "web3", transport="ipc", url = "ipc:///socket.ipc", features = ["archive","traces"] }},
]
....
  1. Run graph-node with config file:
    graph-node --config config.toml ...

  2. Observe errors:

INFO Creating transport, capabilities: archive, traces,
thread 'tokio-runtime-worker' panicked at /graph-node/chain/ethereum/src/transport.rs:32:14:
Failed to connect to Ethereum IPC: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })
urlnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
: file:///socket.ipc, provider: archive-N
INFO Creating transport, capabilities:
thread 'tokio-runtime-worker' panicked at /graph-node/chain/ethereum/src/transport.rs:32:14:
Failed to connect to Ethereum IPC: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
archive, traces, url: ipc:///socket.ipc, provider: archive-N
INFO Reading configuration file `/config.toml`
configuration error: the url `/socket.ipc` for provider archive-N is not a legal URL: relative URL without a base

Expected Behavior

IPC URLs in config.toml should be parsed correctly and the path extracted before being passed to web3::ipc::Ipc::new().

Root Cause

In node/src/chain.rs (line 297): Ipc => Transport::new_ipc(&web3.url).await

The URL is passed directly without extracting the file path. The config parser validates URLs using Url::parse() which requires proper URI format, but the web3 crate's IPC transport expects just a file path.

Mismatch between:

  • Config validation: expects valid URI (e.g., file:///path)
  • IPC transport: expects file path (e.g., /path)

Suggested Fix

Strip the URI scheme before passing to Transport::new_ipc():

  Ipc => {
      // Extract file path from URI
      let ipc_path = if let Ok(url) = Url::parse(&web3.url) {
          url.path().to_string()
      } else {
          web3.url.clone()
      };
      Transport::new_ipc(&ipc_path).await
  }

Or accept bare file paths in config validation for IPC transport.

Environment

  • Graph Node Version: v0.41.0
  • OS: Linux (Docker)

Additional Context

  • CLI argument ETHEREUM_IPC accepts IPC, but is useless, because it cannot be run with config.toml and therefore I am not able to validate if it works.
error: the argument '--config <CONFIG>' cannot be used with '--ethereum-ipc <NETWORK_NAME:[CAPABILITIES]:FILE>'

Same issues

#2356

Relevant log output

IPFS hash

No response

Subgraph name or link to explorer

No response

Some information to help us out

  • Tick this box if this bug is caused by a regression found in the latest release.
  • Tick this box if this bug is specific to the hosted service.
  • I have searched the issue tracker to make sure this issue is not a duplicate.

OS information

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions