0xSpaceShard / starknet-devnet-rs

A local testnet for Starknet... in Rust
https://0xspaceshard.github.io/starknet-devnet-rs/
MIT License
100 stars 56 forks source link

Devnet is failing to run with fork-network #530

Open mikiw opened 2 weeks ago

mikiw commented 2 weeks ago

Describe the bug (observed vs expected behavior)

Devnet is failing to run with: cargo run -- --port 1025 --initial-balance 500000000000000000000 --seed 42 --accounts 3 --chain-id TESTNET --fork-network 'http://rpc.pathfinder.equilibrium.co/integration-sepolia/rpc/v0_7'

Not reproducible on testnet

To Reproduce Steps to reproduce the behavior:

  1. Run devnet with CLI args: cargo run -- --port 1025 --initial-balance 500000000000000000000 --seed 42 --accounts 3 --chain-id TESTNET --fork-network 'http://rpc.pathfinder.equilibrium.co/integration-sepolia/rpc/v0_7'
  2. Get error:
    Forking from block: number=35172, hash=0x25a6765ed4756a519b23ba8b83cd11d9480ba4d798b392d74a9f14fd5c22b15
    2024-07-03T12:31:59.239105Z  WARN starknet_devnet: Origin chain ID (0x534e5f494e544547524154494f4e5f5345504f4c4941) does not match this Devnet's chain ID (0x534e5f5345504f4c4941).
    thread 'main' panicked at /Users/mikiw/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.36.0/src/runtime/blocking/shutdown.rs:51:21:
    Cannot drop a runtime in a context where blocking is not allowed. This happens when a runtime is dropped from within an asynchronous context.
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    2024-07-03T12:31:59.244142Z ERROR reqwest::blocking::client: Failed to communicate successful startup: Ok(())    

Devnet version

System specifications

mikiw commented 2 weeks ago

maybe the problem is with tokio join added recently - checking

FabijanC commented 2 weeks ago

doesn't happen if in release mode (--release)

mikiw commented 2 weeks ago

right cargo run --release -- --fork-network http://rpc.pathfinder.equilibrium.co/integration-sepolia/rpc/v0_7 works ...

FabijanC commented 2 weeks ago

I deleted my recent comment which was wrong (perhaps I should have just edited). The error is present even before commit 3ad81456 (immediately before #491 was merged and tokio join introduced).

FabijanC commented 2 weeks ago

Could be a reqwest issue: https://github.com/mozilla/sccache/issues/1161 Here they mention the same release vs debug mode problem

Here's what chatgpt says about debug-release differences (link to chat):

The difference between debug and release modes can sometimes expose race conditions or timing issues in your code. Optimizations in release mode can inadvertently mask these issues. Running your code with more extensive logging or using a tool like tokio-console can help you understand the runtime behavior in both modes.