0xSpaceShard / starknet-devnet-rs

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

Forking not working if origin URL uses https scheme #424

Closed FabijanC closed 5 months ago

FabijanC commented 6 months ago
  1. Run Devnet in fork mode, forking from an https network

    cargo run --release -- --accounts 0 --fork-network https://free-rpc.nethermind.io/sepolia-juno/v0_7 --fork-block 58801
  2. In a separate terminal, try getting a block that only exists in origin

    curl -sSf http://127.0.01:5050 --json '{
    "jsonrpc": "2.0",
    "method": "starknet_getBlockWithTxHashes",
    "id": 0,
    "params": {
        "block_id": { "block_number": 58800 }
    }
    }'
  3. Observe an error indicating that https is not supported

With https://rpc.pathfinder.equilibrium.co/integration-sepolia/rpc/v0_7 it's easier because simply changing https to http in the URL works, but with https://free-rpc.nethermind.io that's not possible.

FabijanC commented 6 months ago

I'm having a hard time configuring it to use https://crates.io/crates/hyper-tls, which was recommended in https://users.rust-lang.org/t/hyper-client-and-https-how/21571. hyper::client::connect::HttpConnector is not the same as hyper_util::client::legacy::connect::http::HttpConnector. Basically there is another needed crate called hyper_util which contains its own struct called HttpConnector which doesn't implement all the traits that the rest of the code needs. And when attempting to use reqwest::Client instead of hyper::Client, in #426, we get a not running on tokio 0.2.x runtime error, which might also be related to mismatching tokio requirements.

FabijanC commented 6 months ago

Before resorting to the thread channels approach used in #379, I would wait to see if applying the dependency updates suggested in #451 would make it easier to implement any of the approaches suggested in my previous comment.